22 use fckit_mpi_module,
only: fckit_mpi_status
30 real(kind_real),
allocatable :: lon(:)
31 real(kind_real),
allocatable :: lat(:)
32 integer,
allocatable :: og_to_lon(:)
33 integer,
allocatable :: og_to_lat(:)
37 integer,
allocatable :: og_to_proc(:)
38 integer,
allocatable :: proc_to_noga(:)
39 integer,
allocatable :: oga_to_og(:)
40 integer,
allocatable :: og_to_oga(:)
41 integer,
allocatable :: c0b_to_c0(:)
42 integer,
allocatable :: c0_to_c0b(:)
43 integer,
allocatable :: c0a_to_c0b(:)
46 logical,
allocatable :: mask(:,:)
69 class(io_type),
intent(inout) :: io
72 if (
allocated(io%lon))
deallocate(io%lon)
73 if (
allocated(io%lat))
deallocate(io%lat)
74 if (
allocated(io%og_to_lon))
deallocate(io%og_to_lon)
75 if (
allocated(io%og_to_lat))
deallocate(io%og_to_lat)
76 if (
allocated(io%og_to_proc))
deallocate(io%og_to_proc)
77 if (
allocated(io%proc_to_noga))
deallocate(io%proc_to_noga)
78 if (
allocated(io%oga_to_og))
deallocate(io%oga_to_og)
79 if (
allocated(io%og_to_oga))
deallocate(io%og_to_oga)
80 if (
allocated(io%c0b_to_c0))
deallocate(io%c0b_to_c0)
81 if (
allocated(io%c0_to_c0b))
deallocate(io%c0_to_c0b)
82 if (
allocated(io%c0a_to_c0b))
deallocate(io%c0a_to_c0b)
84 call io%com_AB%dealloc
85 if (
allocated(io%mask))
deallocate(io%mask)
93 subroutine io_fld_read(io,mpl,nam,geom,filename,varname,fld)
98 class(io_type),
intent(in) :: io
99 type(mpl_type),
intent(inout) :: mpl
100 type(nam_type),
intent(in) :: nam
101 type(geom_type),
intent(in) :: geom
102 character(len=*),
intent(in) :: filename
103 character(len=*),
intent(in) :: varname
104 real(kind_real),
intent(out) :: fld(geom%nc0a,geom%nl0)
107 integer :: ncid,fld_id,dum
108 real(kind_real) :: fld_c0(geom%nc0,geom%nl0)
109 character(len=1024) :: filename_proc
110 character(len=1024) :: subr =
'fld_read' 112 if (nam%field_io)
then 113 if (nam%split_io.and.(mpl%nproc>1))
then 115 write(filename_proc,
'(a,a,a,a,i4.4,a,i4.4,a)') trim(nam%datadir),
'/',trim(filename),
'_',mpl%nproc,
'-',mpl%myproc,
'.nc' 116 call mpl%ncerr(subr,nf90_open(trim(nam%datadir)//
'/'//trim(filename),nf90_nowrite,ncid))
119 call mpl%ncerr(subr,nf90_inq_varid(ncid,trim(varname),fld_id))
122 call mpl%ncerr(subr,nf90_get_var(ncid,fld_id,fld))
125 call mpl%ncerr(subr,nf90_close(ncid))
129 call mpl%ncerr(subr,nf90_open(trim(nam%datadir)//
'/'//trim(filename)//
'.nc',nf90_nowrite,ncid))
132 call mpl%ncerr(subr,nf90_inq_varid(ncid,trim(varname),fld_id))
135 call mpl%ncerr(subr,nf90_get_var(ncid,fld_id,fld_c0))
138 call mpl%ncerr(subr,nf90_close(ncid))
142 call mpl%glb_to_loc(geom%nl0,geom%nc0,geom%c0_to_proc,geom%c0_to_c0a,fld_c0,geom%nc0a,fld)
146 call mpl%abort(
'field/variable not read: '//trim(filename)//
'/'//trim(varname))
158 subroutine io_fld_write(io,mpl,nam,geom,filename,varname,fld)
163 class(io_type),
intent(in) :: io
164 type(mpl_type),
intent(inout) :: mpl
165 type(nam_type),
intent(in) :: nam
166 type(geom_type),
intent(in) :: geom
167 character(len=*),
intent(in) :: filename
168 character(len=*),
intent(in) :: varname
169 real(kind_real),
intent(in) :: fld(geom%nc0a,geom%nl0)
172 integer :: ic0a,ic0,il0,info
173 integer :: ncid,nc0a_id,nc0_id,nl0_id,fld_id,lon_id,lat_id
174 real(kind_real) :: fld_c0a(geom%nc0a,geom%nl0)
175 real(kind_real),
allocatable :: fld_c0(:,:),lon(:),lat(:)
176 character(len=1024) :: filename_proc
177 character(len=1024) :: subr =
'io_fld_write' 179 if (nam%field_io)
then 183 ic0 = geom%c0a_to_c0(ic0a)
184 if (geom%mask_c0(ic0,il0))
then 185 fld_c0a(ic0a,il0) = fld(ic0a,il0)
187 call msr(fld_c0a(ic0a,il0))
192 if (nam%split_io.and.(mpl%nproc>1))
then 194 write(filename_proc,
'(a,a,a,a,i4.4,a,i4.4,a)') trim(nam%datadir),
'/',trim(filename),
'_',mpl%nproc,
'-',mpl%myproc,
'.nc' 195 info = nf90_create(trim(filename_proc),or(nf90_noclobber,nf90_64bit_offset),ncid)
196 if (info==nf90_noerr)
then 198 call nam%ncwrite(mpl,ncid)
201 call mpl%ncerr(subr,nf90_put_att(ncid,nf90_global,
'_FillValue',
msvalr))
204 call mpl%ncerr(subr,nf90_open(trim(filename_proc),nf90_write,ncid))
207 call mpl%ncerr(subr,nf90_redef(ncid))
211 info = nf90_inq_dimid(ncid,
'nc0a',nc0a_id)
212 if (info/=nf90_noerr)
call mpl%ncerr(subr,nf90_def_dim(ncid,
'nc0a',geom%nc0a,nc0a_id))
213 info = nf90_inq_dimid(ncid,
'nl0',nl0_id)
214 if (info/=nf90_noerr)
call mpl%ncerr(subr,nf90_def_dim(ncid,
'nl0',geom%nl0,nl0_id))
215 info = nf90_inq_varid(ncid,
'lon',lon_id)
216 if (info/=nf90_noerr)
then 217 call mpl%ncerr(subr,nf90_def_var(ncid,
'lon',
ncfloat,(/nc0a_id/),lon_id))
218 call mpl%ncerr(subr,nf90_put_att(ncid,lon_id,
'_FillValue',
msvalr))
219 call mpl%ncerr(subr,nf90_put_att(ncid,lon_id,
'unit',
'degrees_north'))
221 info = nf90_inq_varid(ncid,
'lat',lat_id)
222 if (info/=nf90_noerr)
then 223 call mpl%ncerr(subr,nf90_def_var(ncid,
'lat',
ncfloat,(/nc0a_id/),lat_id))
224 call mpl%ncerr(subr,nf90_put_att(ncid,lat_id,
'_FillValue',
msvalr))
225 call mpl%ncerr(subr,nf90_put_att(ncid,lat_id,
'unit',
'degrees_east'))
227 info = nf90_inq_varid(ncid,trim(varname),fld_id)
228 if (info/=nf90_noerr)
then 229 call mpl%ncerr(subr,nf90_def_var(ncid,trim(varname),
ncfloat,(/nc0a_id,nl0_id/),fld_id))
230 call mpl%ncerr(subr,nf90_put_att(ncid,fld_id,
'_FillValue',
msvalr))
234 call mpl%ncerr(subr,nf90_enddef(ncid))
237 allocate(lon(geom%nc0a))
238 allocate(lat(geom%nc0a))
241 lon = geom%lon(geom%c0a_to_c0)*
rad2deg 242 lat = geom%lat(geom%c0a_to_c0)*
rad2deg 245 call mpl%ncerr(subr,nf90_put_var(ncid,lon_id,lon))
246 call mpl%ncerr(subr,nf90_put_var(ncid,lat_id,lat))
247 call mpl%ncerr(subr,nf90_put_var(ncid,fld_id,fld_c0a))
250 call mpl%ncerr(subr,nf90_close(ncid))
253 allocate(fld_c0(geom%nc0,geom%nl0))
256 call mpl%loc_to_glb(geom%nl0,geom%nc0a,fld_c0a,geom%nc0,geom%c0_to_proc,geom%c0_to_c0a,.false.,fld_c0)
260 info = nf90_create(trim(nam%datadir)//
'/'//trim(filename)//
'.nc',or(nf90_noclobber,nf90_64bit_offset),ncid)
261 if (info==nf90_noerr)
then 263 call nam%ncwrite(mpl,ncid)
266 call mpl%ncerr(subr,nf90_put_att(ncid,nf90_global,
'_FillValue',
msvalr))
269 call mpl%ncerr(subr,nf90_open(trim(nam%datadir)//
'/'//trim(filename)//
'.nc',nf90_write,ncid))
272 call mpl%ncerr(subr,nf90_redef(ncid))
276 info = nf90_inq_dimid(ncid,
'nc0',nc0_id)
277 if (info/=nf90_noerr)
call mpl%ncerr(subr,nf90_def_dim(ncid,
'nc0',geom%nc0,nc0_id))
278 info = nf90_inq_dimid(ncid,
'nl0',nl0_id)
279 if (info/=nf90_noerr)
call mpl%ncerr(subr,nf90_def_dim(ncid,
'nl0',geom%nl0,nl0_id))
280 info = nf90_inq_varid(ncid,
'lon',lon_id)
281 if (info/=nf90_noerr)
then 282 call mpl%ncerr(subr,nf90_def_var(ncid,
'lon',
ncfloat,(/nc0_id/),lon_id))
283 call mpl%ncerr(subr,nf90_put_att(ncid,lon_id,
'_FillValue',
msvalr))
284 call mpl%ncerr(subr,nf90_put_att(ncid,lon_id,
'unit',
'degrees_north'))
286 info = nf90_inq_varid(ncid,
'lat',lat_id)
287 if (info/=nf90_noerr)
then 288 call mpl%ncerr(subr,nf90_def_var(ncid,
'lat',
ncfloat,(/nc0_id/),lat_id))
289 call mpl%ncerr(subr,nf90_put_att(ncid,lat_id,
'_FillValue',
msvalr))
290 call mpl%ncerr(subr,nf90_put_att(ncid,lat_id,
'unit',
'degrees_east'))
292 info = nf90_inq_varid(ncid,trim(varname),fld_id)
293 if (info/=nf90_noerr)
then 294 call mpl%ncerr(subr,nf90_def_var(ncid,trim(varname),
ncfloat,(/nc0_id,nl0_id/),fld_id))
295 call mpl%ncerr(subr,nf90_put_att(ncid,fld_id,
'_FillValue',
msvalr))
299 call mpl%ncerr(subr,nf90_enddef(ncid))
302 allocate(lon(geom%nc0))
303 allocate(lat(geom%nc0))
310 call mpl%ncerr(subr,nf90_put_var(ncid,lon_id,lon))
311 call mpl%ncerr(subr,nf90_put_var(ncid,lat_id,lat))
312 call mpl%ncerr(subr,nf90_put_var(ncid,fld_id,fld_c0))
315 call mpl%ncerr(subr,nf90_close(ncid))
320 if (nam%grid_output)
call io%grid_write(mpl,nam,geom,filename,trim(varname)//
'_regridded',fld)
323 call mpl%warning(
'field/variable not written: '//trim(filename)//
'/'//trim(varname))
337 class(io_type),
intent(inout) :: io
338 type(mpl_type),
intent(inout) :: mpl
339 type(rng_type),
intent(inout) :: rng
340 type(nam_type),
intent(in) :: nam
341 type(geom_type),
intent(in) :: geom
344 integer ::ilon,ilat,i_s,i_s_loc,iog,iproc,ic0,ic0a,ic0b,ioga,il0,nn_index(1)
345 integer,
allocatable :: order(:),order_inv(:),interpg_lg(:)
346 real(kind_real) :: dlon,dlat,nn_dist(1)
347 real(kind_real),
allocatable :: lon_og(:),lat_og(:)
348 logical :: mask_c0(geom%nc0)
349 logical,
allocatable :: mask_lonlat(:,:),mask_og(:),lcheck_og(:),lcheck_c0b(:)
350 type(linop_type) :: ogfull
353 io%nlat = nint(
pi/nam%grid_resol)
355 dlon = 2.0*
pi/
real(io%nlon,kind_real)
356 dlat =
pi/
real(io%nlat,kind_real)
359 allocate(io%lon(io%nlon))
360 allocate(io%lat(io%nlat))
361 allocate(mask_lonlat(io%nlon,io%nlat))
364 write(mpl%info,
'(a7,a)',advance=
'no')
'',
'Setup output grid: ' 365 call mpl%prog_init(io%nlon*io%nlat)
369 io%lon(ilon) = (-
pi+dlon/2)+
real(ilon-1,kind_real)*dlon
370 io%lat(ilat) = (-
pi/2+dlat/2)+
real(ilat-1,kind_real)*dlat
373 call geom%mesh%inside(io%lon(ilon),io%lat(ilat),mask_lonlat(ilon,ilat))
375 if (mask_lonlat(ilon,ilat).and.(nam%mask_check.or.geom%mask_del))
then 377 call geom%kdtree%find_nearest_neighbors(io%lon(ilon),io%lat(ilat),1,nn_index,nn_dist)
380 call geom%check_arc(1,io%lon(ilon),io%lat(ilat),geom%lon(nn_index(1)),geom%lat(nn_index(1)),mask_lonlat(ilon,ilat))
384 call mpl%prog_print((ilat-1)*io%nlon+ilon)
387 write(mpl%info,
'(a)')
'100%' 391 write(mpl%info,
'(a7,a)')
'',
'Output grid:' 392 write(mpl%info,
'(a10,a,f7.2,a,f5.2,a)')
'',
'Effective resolution: ',0.5*(dlon+dlat)*
reqkm,
' km (', &
393 & 0.5*(dlon+dlat)*
rad2deg,
' deg.)' 394 write(mpl%info,
'(a10,a,i4,a,i4)')
'',
'Size (nlon x nlat): ',io%nlon,
' x ',io%nlat
397 io%nog = count(mask_lonlat)
398 allocate(io%og_to_lon(io%nog))
399 allocate(io%og_to_lat(io%nog))
400 allocate(lon_og(io%nog))
401 allocate(lat_og(io%nog))
402 allocate(mask_og(io%nog))
403 allocate(io%og_to_proc(io%nog))
404 allocate(order(io%nog))
405 allocate(order_inv(io%nog))
406 allocate(io%proc_to_noga(mpl%nproc))
407 allocate(io%og_to_oga(io%nog))
413 if (mask_lonlat(ilon,ilat))
then 415 lon_og(iog) = io%lon(ilon)
416 lat_og(iog) = io%lat(ilat)
417 io%og_to_lon(iog) = ilon
418 io%og_to_lat(iog) = ilat
426 call ogfull%interp(mpl,rng,geom%nc0,geom%lon,geom%lat,mask_c0,io%nog,lon_og,lat_og,mask_og,nam%grid_interp)
429 call msi(io%og_to_proc)
431 ic0 = ogfull%col(i_s)
432 iproc = geom%c0_to_proc(ic0)
433 iog = ogfull%row(i_s)
434 io%og_to_proc(iog) = iproc
436 if (
isanymsi(io%og_to_proc))
call mpl%abort(
'some output grid points are not interpolated')
438 io%proc_to_noga(iproc) = count(io%og_to_proc==iproc)
440 io%noga = io%proc_to_noga(mpl%myproc)
443 call qsort(io%nog,io%og_to_proc,order)
445 order_inv(order(iog)) = iog
447 io%og_to_lon = io%og_to_lon(order)
448 io%og_to_lat = io%og_to_lat(order)
450 ogfull%row(i_s) = order_inv(ogfull%row(i_s))
454 allocate(io%oga_to_og(io%noga))
457 do ioga=1,io%proc_to_noga(iproc)
459 io%og_to_oga(iog) = ioga
460 if (iproc==mpl%myproc) io%oga_to_og(ioga) = iog
465 allocate(lcheck_og(ogfull%n_s))
466 allocate(lcheck_c0b(geom%nc0))
474 ic0 = geom%c0a_to_c0(ic0a)
475 lcheck_c0b(ic0) = .true.
478 iog = ogfull%row(i_s)
479 iproc = io%og_to_proc(iog)
480 if (iproc==mpl%myproc)
then 481 ic0 = ogfull%col(i_s)
482 lcheck_og(i_s) = .true.
483 lcheck_c0b(ic0) = .true.
488 io%nc0b = count(lcheck_c0b)
489 io%og%n_s = count(lcheck_og)
492 allocate(io%c0b_to_c0(io%nc0b))
493 allocate(io%c0_to_c0b(geom%nc0))
496 if (lcheck_c0b(ic0))
then 498 io%c0b_to_c0(ic0b) = ic0
499 io%c0_to_c0b(ic0) = ic0b
504 allocate(io%c0a_to_c0b(geom%nc0a))
506 ic0 = geom%c0a_to_c0(ic0a)
507 ic0b = io%c0_to_c0b(ic0)
508 io%c0a_to_c0b(ic0a) = ic0b
512 allocate(interpg_lg(io%og%n_s))
515 if (lcheck_og(i_s))
then 517 interpg_lg(i_s_loc) = i_s
524 write(io%og%prefix,
'(a,i3.3)')
'og' 525 io%og%n_src = io%nc0b
526 io%og%n_dst = io%noga
528 do i_s_loc=1,io%og%n_s
529 i_s = interpg_lg(i_s_loc)
530 io%og%row(i_s_loc) = io%og_to_oga(ogfull%row(i_s))
531 io%og%col(i_s_loc) = io%c0_to_c0b(ogfull%col(i_s))
532 io%og%S(i_s_loc) = ogfull%S(i_s)
534 call io%og%reorder(mpl)
537 call io%com_AB%setup(mpl,
'com_AB',geom%nc0,geom%nc0a,io%nc0b,io%c0b_to_c0,io%c0a_to_c0b,geom%c0_to_proc,geom%c0_to_c0a)
540 allocate(io%mask(io%noga,geom%nl0))
543 ic0b = io%og%col(i_s)
544 ioga = io%og%row(i_s)
545 ic0 = io%c0b_to_c0(ic0b)
547 if (.not.geom%mask_c0(ic0,il0)) io%mask(ioga,il0) = .false.
552 write(mpl%info,
'(a7,a,i4)')
'',
'Parameters for processor #',mpl%myproc
553 write(mpl%info,
'(a10,a,i8)')
'',
'nc0 = ',geom%nc0
554 write(mpl%info,
'(a10,a,i8)')
'',
'nc0a = ',geom%nc0a
555 write(mpl%info,
'(a10,a,i8)')
'',
'nc0b = ',io%nc0b
556 write(mpl%info,
'(a10,a,i8)')
'',
'nog = ',io%nog
557 write(mpl%info,
'(a10,a,i8)')
'',
'noga = ',io%noga
558 write(mpl%info,
'(a10,a,i8)')
'',
'og%n_s = ',io%og%n_s
567 subroutine io_grid_write(io,mpl,nam,geom,filename,varname,fld)
572 class(io_type),
intent(in) :: io
573 type(mpl_type),
intent(inout) :: mpl
574 type(nam_type),
intent(in) :: nam
575 type(geom_type),
intent(in) :: geom
576 character(len=*),
intent(in) :: filename
577 character(len=*),
intent(in) :: varname
578 real(kind_real),
intent(in) :: fld(geom%nc0a,geom%nl0)
581 integer :: il0,info,ilon,ilat,iog,ioga,i,iproc
582 integer :: ncid,nlon_gridded_id,nlat_gridded_id,nlev_id,fld_id,lon_gridded_id,lat_gridded_id,lev_id
583 integer,
allocatable :: oga_to_og(:)
584 real(kind_real) :: fld_c0b(io%nc0b,geom%nl0)
585 real(kind_real) :: fld_oga(io%noga,geom%nl0)
586 real(kind_real),
allocatable :: sbuf(:),rbuf(:),fld_grid(:,:,:),lon_gridded(:),lat_gridded(:)
587 character(len=1024) :: subr =
'io_grid_write' 588 type(fckit_mpi_status) :: status
591 call io%com_AB%ext(mpl,geom%nl0,fld,fld_c0b)
593 call io%og%apply(mpl,fld_c0b(:,il0),fld_oga(:,il0),mssrc=.true.)
599 if (.not.io%mask(ioga,il0))
call msr(fld_oga(ioga,il0))
604 allocate(sbuf(io%noga*geom%nl0))
610 sbuf(i) = fld_oga(ioga,il0)
617 allocate(fld_grid(io%nlon,io%nlat,geom%nl0))
624 allocate(oga_to_og(io%proc_to_noga(iproc)))
625 allocate(rbuf(io%proc_to_noga(iproc)*geom%nl0))
627 if (iproc==mpl%ioproc)
then 629 oga_to_og = io%oga_to_og
633 call mpl%f_comm%receive(oga_to_og,iproc-1,mpl%tag,status)
634 call mpl%f_comm%receive(rbuf,iproc-1,mpl%tag+1,status)
640 do ioga=1,io%proc_to_noga(iproc)
641 iog = oga_to_og(ioga)
642 ilon = io%og_to_lon(iog)
643 ilat = io%og_to_lat(iog)
644 fld_grid(ilon,ilat,il0) = rbuf(i)
650 deallocate(oga_to_og)
655 call mpl%f_comm%send(io%oga_to_og,mpl%ioproc-1,mpl%tag)
656 call mpl%f_comm%send(sbuf,mpl%ioproc-1,mpl%tag+1)
658 call mpl%update_tag(2)
665 info = nf90_create(trim(nam%datadir)//
'/'//trim(filename)//
'.nc',or(nf90_noclobber,nf90_64bit_offset),ncid)
666 if (info==nf90_noerr)
then 668 call nam%ncwrite(mpl,ncid)
671 call mpl%ncerr(subr,nf90_put_att(ncid,nf90_global,
'_FillValue',
msvalr))
674 call mpl%ncerr(subr,nf90_open(trim(nam%datadir)//
'/'//trim(filename)//
'.nc',nf90_write,ncid))
677 call mpl%ncerr(subr,nf90_redef(ncid))
681 info = nf90_inq_dimid(ncid,
'nlon_gridded',nlon_gridded_id)
682 if (info/=nf90_noerr)
call mpl%ncerr(subr,nf90_def_dim(ncid,
'nlon_gridded',io%nlon,nlon_gridded_id))
683 info = nf90_inq_dimid(ncid,
'nlat_gridded',nlat_gridded_id)
684 if (info/=nf90_noerr)
call mpl%ncerr(subr,nf90_def_dim(ncid,
'nlat_gridded',io%nlat,nlat_gridded_id))
685 info = nf90_inq_dimid(ncid,
'nlev',nlev_id)
686 if (info/=nf90_noerr)
call mpl%ncerr(subr,nf90_def_dim(ncid,
'nlev',geom%nl0,nlev_id))
687 info = nf90_inq_varid(ncid,
'lon_gridded',lon_gridded_id)
688 if (info/=nf90_noerr)
then 689 call mpl%ncerr(subr,nf90_def_var(ncid,
'lon_gridded',
ncfloat,(/nlon_gridded_id/),lon_gridded_id))
690 call mpl%ncerr(subr,nf90_put_att(ncid,lon_gridded_id,
'_FillValue',
msvalr))
691 call mpl%ncerr(subr,nf90_put_att(ncid,lon_gridded_id,
'unit',
'degrees_north'))
693 info = nf90_inq_varid(ncid,
'lat_gridded',lat_gridded_id)
694 if (info/=nf90_noerr)
then 695 call mpl%ncerr(subr,nf90_def_var(ncid,
'lat_gridded',
ncfloat,(/nlat_gridded_id/),lat_gridded_id))
696 call mpl%ncerr(subr,nf90_put_att(ncid,lat_gridded_id,
'_FillValue',
msvalr))
697 call mpl%ncerr(subr,nf90_put_att(ncid,lat_gridded_id,
'unit',
'degrees_east'))
699 info = nf90_inq_varid(ncid,
'lev',lev_id)
700 if (info/=nf90_noerr)
then 701 call mpl%ncerr(subr,nf90_def_var(ncid,
'lev',
ncfloat,(/nlev_id/),lev_id))
702 call mpl%ncerr(subr,nf90_put_att(ncid,lev_id,
'_FillValue',
msvalr))
703 call mpl%ncerr(subr,nf90_put_att(ncid,lev_id,
'unit',
'layer'))
705 info = nf90_inq_varid(ncid,trim(varname),fld_id)
706 if (info/=nf90_noerr)
then 707 call mpl%ncerr(subr,nf90_def_var(ncid,trim(varname),
ncfloat,(/nlon_gridded_id,nlat_gridded_id,nlev_id/),fld_id))
708 call mpl%ncerr(subr,nf90_put_att(ncid,fld_id,
'_FillValue',
msvalr))
712 call mpl%ncerr(subr,nf90_enddef(ncid))
715 allocate(lon_gridded(io%nlon))
716 allocate(lat_gridded(io%nlat))
723 call mpl%ncerr(subr,nf90_put_var(ncid,lon_gridded_id,lon_gridded))
724 call mpl%ncerr(subr,nf90_put_var(ncid,lat_gridded_id,lat_gridded))
726 call mpl%ncerr(subr,nf90_put_var(ncid,lev_id,
real(il0,kind_real),(/il0/)))
728 call mpl%ncerr(subr,nf90_put_var(ncid,fld_id,fld_grid))
731 call mpl%ncerr(subr,nf90_close(ncid))
subroutine io_grid_init(io, mpl, rng, nam, geom)
subroutine io_dealloc(io)
subroutine io_grid_write(io, mpl, nam, geom, filename, varname, fld)
subroutine io_fld_write(io, mpl, nam, geom, filename, varname, fld)
subroutine io_fld_read(io, mpl, nam, geom, filename, varname, fld)
integer, parameter, public kind_real
real(fp), parameter, public pi