-
Notifications
You must be signed in to change notification settings - Fork 0
/
read_weights.F90
57 lines (37 loc) · 1.42 KB
/
read_weights.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
!----------------------------------------------------------------------------------------
subroutine read_weights(latlon, wgt_flnm)
use netcdf
use latlon_module
use tile_module, only : check_status
implicit none
type(latlongrid), intent(in) :: latlon
character(len=*), intent(in) :: wgt_flnm
integer :: ncid, dimidx, dimidy, dimidp
integer :: i, j, n, status
status = nf90_noerr
n = 0
!Open the file.
status = nf90_open(trim(wgt_flnm), nf90_nowrite, ncid)
call check_status(status)
!read lon
call nc_get1Dvar0(ncid, 'lon', latlon%lon, 1, latlon%nlon)
!read lat
call nc_get1Dvar0(ncid, 'lat', latlon%lat, 1, latlon%nlat)
!read pnt
call nc_get1Dvar0(ncid, 'pnt', latlon%pnt, 1, latlon%npnt)
!--read tile
call nc_get3Dint0(ncid, 'tile', latlon%tile, 1, latlon%nlon, &
1, latlon%nlat, 1, latlon%npnt)
!--read ilon
call nc_get3Dint0(ncid, 'ilon', latlon%ilon, 1, latlon%nlon, &
1, latlon%nlat, 1, latlon%npnt)
!--read jlat
call nc_get3Dint0(ncid, 'jlat', latlon%jlat, 1, latlon%nlon, &
1, latlon%nlat, 1, latlon%npnt)
!--read wgt
call nc_get3Dvar0(ncid, 'wgt', latlon%wgt, 1, latlon%nlon, &
1, latlon%nlat, 1, latlon%npnt)
status = nf90_close(ncid)
call check_status(status)
!print *, 'Finished Read weights from file: ', trim(wgt_flnm)
end subroutine read_weights