17 use kinds, only: r_kind, r_single, i_short, rmissing
29 character(len=6) :: datatype
39 character(len=20),
allocatable :: varnames(:)
40 character(len=20),
allocatable :: latname
41 character(len=20),
allocatable :: lonname
42 character(len=20),
allocatable :: dimnameEW
43 character(len=20),
allocatable :: dimnameNS
44 character(len=20),
allocatable :: dimnameTIME
46 real(r_kind),
allocatable :: nwp_mask(:,:,:)
47 real(r_kind),
allocatable :: nwp_sst(:,:,:)
48 real(r_kind),
allocatable :: nwp_ice(:,:,:)
49 real(r_kind),
allocatable :: nwp_sfcT(:,:,:)
50 real(r_kind),
allocatable :: nwp_iceT(:,:,:)
59 type(nwpbase),
pointer :: tail => NULL()
82 character(len=6),
intent(in) :: itype
85 if (itype==
' FVCOM')
then
95 allocate(this%varnames(this%numvar))
96 this%varnames(1) =
'glmask'
97 this%varnames(2) =
'tsfc'
98 this%varnames(3) =
'aice'
99 this%varnames(4) =
'tisfc'
101 allocate(this%latname)
102 allocate(this%lonname)
106 allocate(this%dimnameEW)
107 allocate(this%dimnameNS)
108 allocate(this%dimnameTIME)
109 this%dimnameEW =
'lon'
110 this%dimnameNS =
'lat'
111 this%dimnameTIME =
'Time'
115 else if (trim(itype)==
'FV3LAM')
then
116 this%datatype = itype
125 allocate(this%varnames(this%numvar))
126 this%varnames(1) =
'slmsk'
127 this%varnames(2) =
'tsea'
128 this%varnames(3) =
'fice'
129 this%varnames(4) =
'tisfc'
131 allocate(this%latname)
132 allocate(this%lonname)
133 this%latname =
'yaxis_1'
134 this%lonname =
'xaxis_1'
136 allocate(this%dimnameEW)
137 allocate(this%dimnameNS)
138 allocate(this%dimnameTIME)
139 this%dimnameEW =
'xaxis_1'
140 this%dimnameNS =
'yaxis_1'
141 this%dimnameTIME =
'Time'
146 write(*,*)
'Unknown data type:', itype
153 write(*,*)
'Finished initial_nwp'
169 write(*,*)
'List initial setup for ', this%datatype
170 write(*,*)
'number of variables ', this%numvar
171 write(*,*)
'variable index: mask, sst, ice, sfcT'
172 write(*,
'(15x,10I3)') this%i_mask, this%i_sst, this%i_ice, &
174 write(*,*)
'variable name:'
176 write(*,*) k,trim(this%varnames(k))
179 write(*,*)
'Finished list_initial_nwp'
201 subroutine read_nwp(this,filename,itype,numlon,numlat,numtimes,time_to_get,mask,sst,ice,sfcT,iceT)
205 character(len=5),
intent(in) :: itype
206 character(len=*),
intent(in) :: filename
208 integer,
intent(in) :: time_to_get
209 integer,
intent(inout) :: numlon, numlat, numtimes
211 real(r_kind),
intent(inout) :: mask(:,:),sst(:,:),ice(:,:),sfct(:,:) &
217 call ncdata%open(trim(filename),
'r',200)
218 call ncdata%get_dim(this%dimnameEW,this%xlon)
219 call ncdata%get_dim(this%dimnameNS,this%xlat)
220 call ncdata%get_dim(this%dimnameTIME,this%xtime)
222 write(*,*)
'number of longitudes for file ', filename, this%xlon
224 write(*,*)
'number of latitudes for file ', filename, this%xlat
226 write(*,*)
'number of times for file ', filename, this%xtime
227 numtimes = this%xtime
231 allocate(this%nwp_mask(this%xlon,this%xlat,this%xtime))
232 allocate(this%nwp_sst(this%xlon,this%xlat,this%xtime))
233 allocate(this%nwp_ice(this%xlon,this%xlat,this%xtime))
234 allocate(this%nwp_sfcT(this%xlon,this%xlat,this%xtime))
235 allocate(this%nwp_iceT(this%xlon,this%xlat,this%xtime))
240 if (this%i_mask .gt. 0)
then
241 call ncdata%get_var(this%varnames(this%i_mask),this%xlon, &
242 this%xlat,this%xtime,this%nwp_mask)
243 mask = this%nwp_mask(:,:,1)
245 if (this%i_sst .gt. 0)
then
246 call ncdata%get_var(this%varnames(this%i_sst),this%xlon, &
247 this%xlat,this%xtime,this%nwp_sst)
248 sst = this%nwp_sst(:,:,time_to_get)
250 if (this%i_ice .gt. 0)
then
251 call ncdata%get_var(this%varnames(this%i_ice),this%xlon, &
252 this%xlat,this%xtime,this%nwp_ice)
253 ice = this%nwp_ice(:,:,time_to_get)
255 if (this%i_sfcT .gt. 0)
then
256 call ncdata%get_var(this%varnames(this%i_sfcT),this%xlon, &
257 this%xlat,this%xtime,this%nwp_sfcT)
258 sfct = this%nwp_sfcT(:,:,time_to_get)
260 if (this%i_iceT .gt. 0)
then
261 call ncdata%get_var(this%varnames(this%i_iceT),this%xlon, &
262 this%xlat,this%xtime,this%nwp_iceT)
263 icet = this%nwp_iceT(:,:,time_to_get)
270 write(*,*)
'Finished read_nwp'
283 type(nwpbase),
pointer :: thisobs,thisobsnext
285 deallocate(this%varnames)
286 deallocate(this%latname)
287 deallocate(this%lonname)
288 deallocate(this%dimnameEW)
289 deallocate(this%dimnameNS)
290 deallocate(this%dimnameTIME)
291 deallocate(this%nwp_mask)
292 deallocate(this%nwp_sst)
293 deallocate(this%nwp_ice)
294 deallocate(this%nwp_sfcT)
295 deallocate(this%nwp_iceT)
298 if(.NOT.
associated(thisobs))
then
299 write(*,*)
'No memory to release'
302 do while(
associated(thisobs))
305 thisobsnext => thisobs%next
306 call thisobs%destroy()
307 thisobs => thisobsnext
310 write(*,*)
'Finished finish_nwp'
Module to hold specification kinds for variable declaration.
This module defines nwp observation data structure and the method to read and write observations from...
Functions to read and write netcdf files.
procedure read_n=> read_nwp
Initialize arrays, get data.
procedure finish=> finish_nwp
Finish and deallocate.
This module defines FV3LAM and FVCOM forecast data structure and the method to read and write observa...
subroutine list_initial_nwp(this)
This subroutine lists the setup for NWP data that was done by the initial_nwp subroutine.
subroutine read_nwp(this, filename, itype, numlon, numlat, numtimes, time_to_get, mask, sst, ice, sfcT, iceT)
This subroutine initializes arrays to receive the NWP data, and opens the file and gets the data...
procedure initial=> initial_nwp
Defines vars and names.
subroutine finish_nwp(this)
Finish and deallocate.
procedure list_initial=> list_initial_nwp
List the setup.
subroutine initial_nwp(this, itype)
This subroutine defines the number of variables and their names for each NWP data type...