17 character(len=256) :: filename
20 integer :: debug_level
25 character(len=40) :: dimname(4)
103 subroutine open_nc(this,filename,action,debug_level)
108 character(len=*),
intent(in) :: filename
109 character(len=1),
intent(in) :: action
110 integer,
intent(in),
optional :: debug_level
112 integer :: ncid, status
115 if(present(debug_level)) this%debug_level=debug_level
117 this%filename=trim(filename)
119 if(action==
"r" .or. action==
"R")
then
120 status = nf90_open(path = trim(filename), mode = nf90_nowrite, ncid = ncid)
121 elseif(action==
"w" .or. action==
"W")
then
122 status = nf90_open(path = trim(filename), mode = nf90_write, ncid = ncid)
124 write(6,*)
'unknow action :', action
127 if (status /= nf90_noerr) call this%handle_err(status)
130 if(this%debug_level>0)
then
131 write(6,*)
'>>> open file: ',trim(this%filename)
146 integer :: ncid, status
151 status = nf90_close(ncid)
152 if (status /= nf90_noerr) call this%handle_err(status)
166 character(len=*),
intent(in) :: attname
167 real,
intent(out) :: rval
169 integer :: ncid, status
175 status = nf90_get_att(ncid, nf90_global, trim(attname), rval)
176 if (status /= nf90_noerr) call this%handle_err(status)
190 character(len=*),
intent(in) :: attname
191 integer,
intent(out) :: ival
193 integer :: ncid, status
199 status = nf90_get_att(ncid, nf90_global, trim(attname), ival)
200 if (status /= nf90_noerr) call this%handle_err(status)
214 character(len=*),
intent(in) :: attname
215 character(len=*),
intent(out) :: string
217 integer :: ncid, status
223 status = nf90_get_att(ncid, nf90_global, trim(attname), string)
224 if (status /= nf90_noerr) call this%handle_err(status)
239 character(len=*),
intent(in) :: dimname
240 integer,
intent(out) :: dimvalue
242 integer :: ncid, status
249 status = nf90_inq_dimid(ncid,trim(dimname), dimid)
250 if (status /= nf90_noerr) call this%handle_err(status)
251 status = nf90_inquire_dimension(ncid, dimid, len = dimvalue)
252 if (status /= nf90_noerr) call this%handle_err(status)
270 character(len=*),
intent(in) :: varname
271 integer,
intent(in) :: nd1
272 character,
intent(in) :: field(nd1)
275 character*40,
parameter :: thissubname=
'replace_var_nc_char_1d'
282 if(this%debug_level>100)
then
283 write(6,*) trim(thissubname),
' show samples:'
284 write(6,*) (field(i),i=1,min(nd1,10))
287 call this%replace_var_nc_char(varname,ilength,field)
305 character(len=*),
intent(in) :: varname
306 integer,
intent(in) :: nd1,nd2
307 character,
intent(in) :: field(nd1,nd2)
310 character,
allocatable :: temp(:)
312 character*40,
parameter :: thissubname=
'replace_var_nc_char_2d'
315 integer :: istart,iend
319 allocate(temp(ilength))
324 temp(istart:iend)=field(:,j)
327 if(this%debug_level>100)
then
328 write(6,*) trim(thissubname),
' show samples:'
329 write(6,*) field(1,1)
332 call this%replace_var_nc_char(varname,ilength,temp)
353 character(len=*),
intent(in) :: varname
354 integer,
intent(in) :: nd1,nd2,nd3
355 character,
intent(in) :: field(nd1,nd2,nd3)
358 character,
allocatable :: temp(:)
360 character*40,
parameter :: thissubname=
'replace_var_nc_char_3d'
364 integer :: istart,iend
369 allocate(temp(ilength))
373 istart=(k-1)*length2d+(j-1)*nd1+1
374 iend =(k-1)*length2d+(j-1)*nd1+nd1
375 temp(istart:iend)=field(:,j,k)
379 if(this%debug_level>100)
then
380 write(6,*) trim(thissubname),
' show samples:'
381 write(6,*) field(1,1,1)
384 call this%replace_var_nc_char(varname,ilength,temp)
403 character(len=*),
intent(in) :: varname
404 integer,
intent(in) :: ilength
405 character,
intent(in) :: field(ilength)
411 integer :: ends(4),start(4)
413 integer :: length4d,length3d,length2d
414 integer :: ndims,ndim
417 character*40 :: dimname
419 character*40,
parameter :: thissubname=
'replace_var_nc_char'
427 status = nf90_inq_varid(ncid, trim(varname), varid)
428 if(status /= nf90_noerr) call this%handle_err(status)
437 status = nf90_inquire_variable(ncid, varid, xtype = xtype)
438 if(status /= nf90_noerr) call this%handle_err(status)
439 if(xtype==nf90_char)
then
442 write(6,*) trim(thissubname),
' ERROR: wrong data type, expect ',nf90_int,
' but read in ',xtype
447 status = nf90_inquire_variable(ncid, varid, ndims = ndims)
448 if(status /= nf90_noerr) call this%handle_err(status)
451 status = nf90_inquire_variable(ncid, varid, dimids = dimids(1:ndims))
452 if(status /= nf90_noerr) call this%handle_err(status)
455 status = nf90_inquire_dimension(ncid, dimids(i), dimname, len = ndim)
456 if (status /= nf90_noerr) call this%handle_err(status)
459 this%dimname(i)=trim(dimname)
460 if(this%ends(i) < 1)
then
461 write(6,*) trim(thissubname),
' Error, ends dimension should larger than 0 :', ends(i)
465 length2d=ends(1)*ends(2)
466 length3d=length2d*ends(3)
467 length4d=length3d*ends(4)
468 if(ilength .ne. length4d)
then
469 write(6,*) trim(thissubname),
'ERROR: ',ilength,
' should equal to ',length4d
474 status = nf90_put_var(ncid, varid, field, &
475 start = start(1:4) , &
477 if(status /= nf90_noerr) call this%handle_err(status)
479 write(6,*) trim(thissubname),
'Error: too many dimensions:',ndims
483 if(this%debug_level>0)
then
484 write(6,
'(a,a)')
'>>>replace variable: ',trim(varname)
486 if(this%debug_level>10)
then
487 write(6,
'(8x,a,I10)')
'data type : ',this%xtype
488 write(6,
'(8x,a,I10)')
'dimension size: ',this%nDims
490 write(6,
'(8x,a,I5,I10,2x,a)')
'rank, ends, name=',i,this%ends(i),trim(this%dimname(i))
510 character(len=*),
intent(in) :: varname
511 integer,
intent(in) :: nd1
512 real(4),
intent(in) :: field(nd1)
515 character*40,
parameter :: thissubname=
'replace_var_nc_real_1d'
522 if(this%debug_level>100)
then
523 write(6,*) trim(thissubname),
' show samples:'
524 write(6,*) (field(i),i=1,min(nd1,10))
527 call this%replace_var_nc_real(varname,ilength,field)
545 character(len=*),
intent(in) :: varname
546 integer,
intent(in) :: nd1,nd2
547 real(4),
intent(in) :: field(nd1,nd2)
550 real(4),
allocatable :: temp(:)
552 character*40,
parameter :: thissubname=
'replace_var_nc_real_2d'
555 integer :: istart,iend
559 allocate(temp(ilength))
564 temp(istart:iend)=field(:,j)
567 if(this%debug_level>100)
then
568 write(6,*) trim(thissubname),
' show samples:'
569 write(6,*)
'max,min:',maxval(field(:,:)),minval(field(:,:))
572 call this%replace_var_nc_real(varname,ilength,temp)
596 character(len=*),
intent(in) :: varname
597 integer,
intent(in) :: nd1,nd2,nd3
598 real(4),
intent(in) :: field(nd1,nd2,nd3)
601 real(4),
allocatable :: temp(:)
603 character*40,
parameter :: thissubname=
'replace_var_nc_real_3d'
607 integer :: istart,iend
612 allocate(temp(ilength))
616 istart=(k-1)*length2d+(j-1)*nd1+1
617 iend =(k-1)*length2d+(j-1)*nd1+nd1
618 temp(istart:iend)=field(:,j,k)
622 if(this%debug_level>100)
then
623 write(6,*) trim(thissubname),
' show samples:'
625 write(6,*)
'k,max,min:',k,maxval(field(:,:,k)),minval(field(:,:,k))
629 call this%replace_var_nc_real(varname,ilength,temp)
648 character(len=*),
intent(in) :: varname
649 integer,
intent(in) :: ilength
650 real(4),
intent(in) :: field(ilength)
656 integer :: ends(4),start(4)
658 integer :: length4d,length3d,length2d
659 integer :: ndims,ndim
662 character*40 :: dimname
664 character*40,
parameter :: thissubname=
'replace_var_nc_real'
672 status = nf90_inq_varid(ncid, trim(varname), varid)
673 if(status /= nf90_noerr) call this%handle_err(status)
682 status = nf90_inquire_variable(ncid, varid, xtype = xtype)
683 if(status /= nf90_noerr) call this%handle_err(status)
684 if(xtype==nf90_float)
then
687 write(6,*) trim(thissubname),
' ERROR: wrong data type, expect ',nf90_int,
' but read in ',xtype
692 status = nf90_inquire_variable(ncid, varid, ndims = ndims)
693 if(status /= nf90_noerr) call this%handle_err(status)
696 status = nf90_inquire_variable(ncid, varid, dimids = dimids(1:ndims))
697 if(status /= nf90_noerr) call this%handle_err(status)
700 status = nf90_inquire_dimension(ncid, dimids(i), dimname, len = ndim)
701 if (status /= nf90_noerr) call this%handle_err(status)
704 this%dimname(i)=trim(dimname)
705 if(this%ends(i) < 1)
then
706 write(6,*) trim(thissubname),
' Error, ends dimension should larger than 0 :', ends(i)
710 length2d=ends(1)*ends(2)
711 length3d=length2d*ends(3)
712 length4d=length3d*ends(4)
713 if(ilength .ne. length4d)
then
714 write(6,*) trim(thissubname),
'ERROR: ',ilength,
' should equal to ',length4d
719 status = nf90_put_var(ncid, varid, field, &
720 start = start(1:4) , &
722 if(status /= nf90_noerr) call this%handle_err(status)
724 write(6,*) trim(thissubname),
'Error: too many dimensions:',ndims
728 if(this%debug_level>0)
then
729 write(6,
'(a,a)')
'>>>replace variable: ',trim(varname)
731 if(this%debug_level>10)
then
732 write(6,
'(8x,a,I10)')
'data type : ',this%xtype
733 write(6,
'(8x,a,I10)')
'dimension size: ',this%nDims
735 write(6,
'(8x,a,I5,I10,2x,a)')
'rank, ends, name=',i,this%ends(i),trim(this%dimname(i))
757 character(len=*),
intent(in) :: varname
758 integer,
intent(in) :: nd1
759 real(8),
intent(in) :: field(nd1)
762 character*40,
parameter :: thissubname=
'replace_var_nc_double_1d'
769 if(this%debug_level>100)
then
770 write(6,*) trim(thissubname),
' show samples:'
771 write(6,*) (field(i),i=1,min(nd1,10))
774 call this%replace_var_nc_double(varname,ilength,field)
795 character(len=*),
intent(in) :: varname
796 integer,
intent(in) :: nd1,nd2
797 real(8),
intent(in) :: field(nd1,nd2)
800 real(8),
allocatable :: temp(:)
802 character*40,
parameter :: thissubname=
'replace_var_nc_double_2d'
805 integer :: istart,iend
809 allocate(temp(ilength))
814 temp(istart:iend)=field(:,j)
817 if(this%debug_level>100)
then
818 write(6,*) trim(thissubname),
' show samples:'
819 write(6,*)
'max,min:',maxval(field(:,:)),minval(field(:,:))
822 call this%replace_var_nc_double(varname,ilength,temp)
846 character(len=*),
intent(in) :: varname
847 integer,
intent(in) :: nd1,nd2,nd3
848 real(8),
intent(in) :: field(nd1,nd2,nd3)
851 real(8),
allocatable :: temp(:)
853 character*40,
parameter :: thissubname=
'replace_var_nc_double_3d'
857 integer :: istart,iend
862 allocate(temp(ilength))
866 istart=(k-1)*length2d+(j-1)*nd1+1
867 iend =(k-1)*length2d+(j-1)*nd1+nd1
868 temp(istart:iend)=field(:,j,k)
872 if(this%debug_level>100)
then
873 write(6,*) trim(thissubname),
' show samples:'
875 write(6,*)
'k,max,min:',k,maxval(field(:,:,k)),minval(field(:,:,k))
879 call this%replace_var_nc_double(varname,ilength,temp)
899 character(len=*),
intent(in) :: varname
900 integer,
intent(in) :: ilength
901 real(8),
intent(in) :: field(ilength)
907 integer :: ends(4),start(4)
909 integer :: length4d,length3d,length2d
910 integer :: ndims,ndim
913 character*40 :: dimname
915 character*40,
parameter :: thissubname=
'replace_var_nc_double'
923 status = nf90_inq_varid(ncid, trim(varname), varid)
924 if(status /= nf90_noerr) call this%handle_err(status)
933 status = nf90_inquire_variable(ncid, varid, xtype = xtype)
934 if(status /= nf90_noerr) call this%handle_err(status)
935 if(xtype==nf90_double)
then
938 write(6,*) trim(thissubname),
' ERROR: wrong data type, expect ',nf90_int,
' but read in ',xtype
943 status = nf90_inquire_variable(ncid, varid, ndims = ndims)
944 if(status /= nf90_noerr) call this%handle_err(status)
947 status = nf90_inquire_variable(ncid, varid, dimids = dimids(1:ndims))
948 if(status /= nf90_noerr) call this%handle_err(status)
951 status = nf90_inquire_dimension(ncid, dimids(i), dimname, len = ndim)
952 if (status /= nf90_noerr) call this%handle_err(status)
955 this%dimname(i)=trim(dimname)
956 if(this%ends(i) < 1)
then
957 write(6,*) trim(thissubname),
' Error, ends dimension should larger than 0 :', ends(i)
961 length2d=ends(1)*ends(2)
962 length3d=length2d*ends(3)
963 length4d=length3d*ends(4)
964 if(ilength .ne. length4d)
then
965 write(6,*) trim(thissubname),
'ERROR: ',ilength,
' should equal to ',length4d
970 status = nf90_put_var(ncid, varid, field, &
971 start = start(1:4) , &
973 if(status /= nf90_noerr) call this%handle_err(status)
975 write(6,*) trim(thissubname),
'Error: too many dimensions:',ndims
979 if(this%debug_level>0)
then
980 write(6,
'(a,a)')
'>>>replace variable: ',trim(varname)
982 if(this%debug_level>10)
then
983 write(6,
'(8x,a,I10)')
'data type : ',this%xtype
984 write(6,
'(8x,a,I10)')
'dimension size: ',this%nDims
986 write(6,
'(8x,a,I5,I10,2x,a)')
'rank, ends, name=',i,this%ends(i),trim(this%dimname(i))
1005 character(len=*),
intent(in) :: varname
1006 integer,
intent(in) :: nd1
1007 integer,
intent(in) :: field(nd1)
1010 character*40,
parameter :: thissubname=
'get_var_nc_int_1d'
1017 if(this%debug_level>100)
then
1018 write(6,*) trim(thissubname),
' show samples:'
1019 write(6,*) (field(i),i=1,min(nd1,10))
1022 call this%replace_var_nc_int(varname,ilength,field)
1043 character(len=*),
intent(in) :: varname
1044 integer,
intent(in) :: nd1,nd2
1045 integer,
intent(in) :: field(nd1,nd2)
1048 integer,
allocatable :: temp(:)
1050 character*40,
parameter :: thissubname=
'replace_var_nc_int_2d'
1053 integer :: istart,iend
1057 allocate(temp(ilength))
1062 temp(istart:iend)=field(:,j)
1065 if(this%debug_level>100)
then
1066 write(6,*) trim(thissubname),
' show samples:'
1067 write(6,*)
'max,min:',maxval(field(:,:)),minval(field(:,:))
1070 call this%replace_var_nc_int(varname,ilength,temp)
1091 character(len=*),
intent(in) :: varname
1092 integer,
intent(in) :: nd1,nd2,nd3
1093 integer,
intent(in) :: field(nd1,nd2,nd3)
1096 integer,
allocatable :: temp(:)
1098 character*40,
parameter :: thissubname=
'replace_var_nc_int_3d'
1102 integer :: istart,iend
1106 ilength=length2d*nd3
1107 allocate(temp(ilength))
1111 istart=(k-1)*length2d+(j-1)*nd1+1
1112 iend =(k-1)*length2d+(j-1)*nd1+nd1
1113 temp(istart:iend)=field(:,j,k)
1117 if(this%debug_level>100)
then
1118 write(6,*) trim(thissubname),
' show samples:'
1120 write(6,*)
'k,max,min:',k,maxval(field(:,:,k)),minval(field(:,:,k))
1124 call this%replace_var_nc_int(varname,ilength,temp)
1143 character(len=*),
intent(in) :: varname
1144 integer,
intent(in) :: ilength
1145 integer,
intent(in) :: field(ilength)
1151 integer :: ends(4),start(4)
1153 integer :: length4d,length3d,length2d
1154 integer :: ndims,ndim
1155 integer :: dimids(4)
1157 character*40 :: dimname
1159 character*40,
parameter :: thissubname=
'replace_var_nc_int'
1167 status = nf90_inq_varid(ncid, trim(varname), varid)
1168 if(status /= nf90_noerr) call this%handle_err(status)
1177 status = nf90_inquire_variable(ncid, varid, xtype = xtype)
1178 if(status /= nf90_noerr) call this%handle_err(status)
1179 if(xtype==nf90_int)
then
1182 write(6,*) trim(thissubname),
' ERROR: wrong data type, expect ',nf90_int,
' but read in ',xtype
1187 status = nf90_inquire_variable(ncid, varid, ndims = ndims)
1188 if(status /= nf90_noerr) call this%handle_err(status)
1191 status = nf90_inquire_variable(ncid, varid, dimids = dimids(1:ndims))
1192 if(status /= nf90_noerr) call this%handle_err(status)
1195 status = nf90_inquire_dimension(ncid, dimids(i), dimname, len = ndim)
1196 if (status /= nf90_noerr) call this%handle_err(status)
1198 this%ends(i)=ends(i)
1199 this%dimname(i)=trim(dimname)
1200 if(this%ends(i) < 1)
then
1201 write(6,*) trim(thissubname),
' Error, ends dimension should larger than 0 :', ends(i)
1205 length2d=ends(1)*ends(2)
1206 length3d=length2d*ends(3)
1207 length4d=length3d*ends(4)
1208 if(ilength .ne. length4d)
then
1209 write(6,*) trim(thissubname),
'ERROR: ',ilength,
' should equal to ',length4d
1214 status = nf90_put_var(ncid, varid, field, &
1215 start = start(1:4) , &
1217 if(status /= nf90_noerr) call this%handle_err(status)
1219 write(6,*) trim(thissubname),
'Error: too many dimensions:',ndims
1223 if(this%debug_level>0)
then
1224 write(6,
'(a,a)')
'>>>replace variable: ',trim(varname)
1226 if(this%debug_level>10)
then
1227 write(6,
'(8x,a,I10)')
'data type : ',this%xtype
1228 write(6,
'(8x,a,I10)')
'dimension size: ',this%nDims
1230 write(6,
'(8x,a,I5,I10,2x,a)')
'rank, ends, name=',i,this%ends(i),trim(this%dimname(i))
1249 character(len=*),
intent(in) :: varname
1250 integer,
intent(in) :: nd1
1251 real(8),
intent(out) :: field(nd1)
1254 character*40,
parameter :: thissubname=
'get_var_nc_double_1d'
1260 call this%get_var_nc_double(varname,ilength,field)
1262 if(nd1==this%ends(1))
then
1263 if(this%debug_level>100)
then
1264 write(6,*) trim(thissubname),
' show samples:'
1265 write(6,*) (field(i),i=1,min(nd1,10))
1268 write(6,*) trim(thissubname),
' ERROR: dimension does not match.'
1287 character(len=*),
intent(in) :: varname
1288 integer,
intent(in) :: nd1,nd2
1289 real(8),
intent(out) :: field(nd1,nd2)
1292 real(8),
allocatable :: temp(:)
1294 character*40,
parameter :: thissubname=
'get_var_nc_double_2d'
1297 integer :: istart,iend
1301 allocate(temp(ilength))
1303 call this%get_var_nc_double(varname,ilength,temp)
1305 if(nd1==this%ends(1) .and. nd2==this%ends(2))
then
1309 field(:,j)=temp(istart:iend)
1317 write(6,*) trim(thissubname),
' ERROR: dimension does not match.'
1318 write(6,*) nd1,this%ends(1),nd2,this%ends(2)
1339 character(len=*),
intent(in) :: varname
1340 integer,
intent(in) :: nd1,nd2,nd3
1341 real(8),
intent(out) :: field(nd1,nd2,nd3)
1344 real(8),
allocatable :: temp(:)
1346 character*40,
parameter :: thissubname=
'get_var_nc_double_3d'
1350 integer :: istart,iend
1354 ilength=length2d*nd3
1355 allocate(temp(ilength))
1357 call this%get_var_nc_double(varname,ilength,temp)
1359 if(nd1==this%ends(1) .and. nd2==this%ends(2) .and. nd3==this%ends(3))
then
1362 istart=(k-1)*length2d+(j-1)*nd1+1
1363 iend =(k-1)*length2d+(j-1)*nd1+nd1
1364 field(:,j,k)=temp(istart:iend)
1375 write(6,*) trim(thissubname),
' ERROR: dimension does not match.'
1376 write(6,*) nd1,this%ends(1),nd2,this%ends(2),nd3,this%ends(3)
1395 character(len=*),
intent(in) :: varname
1396 integer,
intent(in) :: ilength
1397 real(8),
intent(out) :: field(ilength)
1403 integer :: ends(4),start(4)
1405 integer :: length4d,length3d,length2d
1406 integer :: ndims,ndim
1407 integer :: dimids(4)
1409 character*40 :: dimname
1411 character*40,
parameter :: thissubname=
'get_var_nc_double'
1419 status = nf90_inq_varid(ncid, trim(varname), varid)
1420 if(status /= nf90_noerr) call this%handle_err(status)
1429 status = nf90_inquire_variable(ncid, varid, xtype = xtype)
1430 if(status /= nf90_noerr) call this%handle_err(status)
1431 if(xtype==nf90_double)
then
1434 write(6,*) trim(thissubname),
' ERROR: wrong data type, expect ',nf90_double,
' but read in ',xtype
1439 status = nf90_inquire_variable(ncid, varid, ndims = ndims)
1440 if(status /= nf90_noerr) call this%handle_err(status)
1443 status = nf90_inquire_variable(ncid, varid, dimids = dimids(1:ndims))
1444 if(status /= nf90_noerr) call this%handle_err(status)
1447 write(6,*)
'dimids(i) = ', dimids(i)
1448 status = nf90_inquire_dimension(ncid, dimids(i), dimname, len = ndim)
1449 if (status /= nf90_noerr) call this%handle_err(status)
1451 this%ends(i)=ends(i)
1452 this%dimname(i)=trim(dimname)
1453 if(this%ends(i) < 1)
then
1454 write(6,*) trim(thissubname),
' Error, ends dimension should larger than 0 :', ends(i)
1458 length2d=ends(1)*ends(2)
1459 length3d=length2d*ends(3)
1460 length4d=length3d*ends(4)
1461 if(ilength .ne. length4d)
then
1462 write(6,*) trim(thissubname),
'ERROR: ',ilength,
' should equal to ',length4d
1467 status = nf90_get_var(ncid, varid, field, &
1468 start = start(1:4) , &
1470 if(status /= nf90_noerr) call this%handle_err(status)
1472 write(6,*) trim(thissubname),
'Error: too many dimensions:',ndims
1476 if(this%debug_level>0)
then
1477 write(6,
'(a,a)')
'>>>read in variable: ',trim(varname)
1479 if(this%debug_level>10)
then
1480 write(6,
'(a,I10)')
' data type : ',this%xtype
1481 write(6,
'(a,I10)')
' dimension size: ',this%nDims
1483 write(6,
'(a,I5,I10,2x,a)')
' rank, ends, name=',i,this%ends(i),trim(this%dimname(i))
1502 character(len=*),
intent(in) :: varname
1503 integer,
intent(in) :: nd1
1504 real(4),
intent(out) :: field(nd1)
1507 character*40,
parameter :: thissubname=
'get_var_nc_real_1d'
1513 call this%get_var_nc_real(varname,ilength,field)
1515 if(nd1==this%ends(1))
then
1516 if(this%debug_level>100)
then
1517 write(6,*) trim(thissubname),
' show samples:'
1518 write(6,*) (field(i),i=1,min(nd1,10))
1521 write(6,*) trim(thissubname),
' ERROR: dimension does not match.'
1543 character(len=*),
intent(in) :: varname
1544 integer,
intent(in) :: nd1,nd2
1545 real(4),
intent(out) :: field(nd1,nd2)
1548 real(4),
allocatable :: temp(:)
1550 character*40,
parameter :: thissubname=
'get_var_nc_real_2d'
1553 integer :: istart,iend
1557 allocate(temp(ilength))
1559 call this%get_var_nc_real(varname,ilength,temp)
1561 if(nd1==this%ends(1) .and. nd2==this%ends(2))
then
1565 field(:,j)=temp(istart:iend)
1568 if(this%debug_level>100)
then
1569 write(6,*) trim(thissubname),
' show samples:'
1570 write(6,*)
'max,min:',maxval(field(:,:)),minval(field(:,:))
1573 write(6,*) trim(thissubname),
' ERROR: dimension does not match.'
1574 write(6,*) nd1,this%ends(1),nd2,this%ends(2)
1595 character(len=*),
intent(in) :: varname
1596 integer,
intent(in) :: nd1,nd2,nd3
1597 real(4),
intent(out) :: field(nd1,nd2,nd3)
1600 real(4),
allocatable :: temp(:)
1602 character*40,
parameter :: thissubname=
'get_var_nc_real_3d'
1606 integer :: istart,iend
1610 ilength=length2d*nd3
1611 allocate(temp(ilength))
1613 call this%get_var_nc_real(varname,ilength,temp)
1615 if(nd1==this%ends(1) .and. nd2==this%ends(2) .and. nd3==this%ends(3))
then
1618 istart=(k-1)*length2d+(j-1)*nd1+1
1619 iend =(k-1)*length2d+(j-1)*nd1+nd1
1620 field(:,j,k)=temp(istart:iend)
1624 if(this%debug_level>100)
then
1625 write(6,*) trim(thissubname),
' show samples:'
1627 write(6,*)
'k,max,min:',k,maxval(field(:,:,k)),minval(field(:,:,k))
1631 write(6,*) trim(thissubname),
' ERROR: dimension does not match.'
1632 write(6,*) nd1,this%ends(1),nd2,this%ends(2),nd3,this%ends(3)
1654 character(len=*),
intent(in) :: varname
1655 integer,
intent(in) :: ilength
1656 real(4),
intent(out) :: field(ilength)
1662 integer :: ends(4),start(4)
1664 integer :: length4d,length3d,length2d
1665 integer :: ndims,ndim
1666 integer :: dimids(4)
1668 character*40 :: dimname
1670 character*40,
parameter :: thissubname=
'get_var_nc_real'
1678 status = nf90_inq_varid(ncid, trim(varname), varid)
1679 if(status /= nf90_noerr) call this%handle_err(status)
1688 status = nf90_inquire_variable(ncid, varid, xtype = xtype)
1689 if(status /= nf90_noerr) call this%handle_err(status)
1690 if(xtype==nf90_float)
then
1693 write(6,*) trim(thissubname),
' ERROR: wrong data type, expect ',nf90_float,
' but read in ',xtype
1698 status = nf90_inquire_variable(ncid, varid, ndims = ndims)
1699 if(status /= nf90_noerr) call this%handle_err(status)
1702 status = nf90_inquire_variable(ncid, varid, dimids = dimids(1:ndims))
1703 if(status /= nf90_noerr) call this%handle_err(status)
1706 status = nf90_inquire_dimension(ncid, dimids(i), dimname, len = ndim)
1707 if (status /= nf90_noerr) call this%handle_err(status)
1709 this%ends(i)=ends(i)
1710 this%dimname(i)=trim(dimname)
1711 if(this%ends(i) < 1)
then
1712 write(6,*) trim(thissubname),
' Error, ends dimension should larger than 0 :', ends(i)
1716 length2d=ends(1)*ends(2)
1717 length3d=length2d*ends(3)
1718 length4d=length3d*ends(4)
1719 if(ilength .ne. length4d)
then
1720 write(6,*) trim(thissubname),
'ERROR: ',ilength,
' should equal to ',length4d
1725 status = nf90_get_var(ncid, varid, field, &
1726 start = start(1:4) , &
1728 if(status /= nf90_noerr) call this%handle_err(status)
1730 write(6,*) trim(thissubname),
'Error: too many dimensions:',ndims
1734 if(this%debug_level>0)
then
1735 write(6,
'(a,a)')
'>>>read in variable: ',trim(varname)
1737 if(this%debug_level>10)
then
1738 write(6,
'(8x,a,I10)')
'data type : ',this%xtype
1739 write(6,
'(8x,a,I10)')
'dimension size: ',this%nDims
1741 write(6,
'(8x,a,I5,I10,2x,a)')
'rank, ends, name=',i,this%ends(i),trim(this%dimname(i))
1760 character(len=*),
intent(in) :: varname
1761 integer,
intent(in) :: nd1
1762 integer,
intent(out) :: field(nd1)
1765 character*40,
parameter :: thissubname=
'get_var_nc_int_1d'
1771 call this%get_var_nc_int(varname,ilength,field)
1773 if(nd1==this%ends(1))
then
1774 if(this%debug_level>100)
then
1775 write(6,*) trim(thissubname),
' show samples:'
1776 write(6,*) (field(i),i=1,min(nd1,10))
1779 write(6,*) trim(thissubname),
' ERROR: dimension does not match.'
1801 character(len=*),
intent(in) :: varname
1802 integer,
intent(in) :: nd1,nd2
1803 integer,
intent(out) :: field(nd1,nd2)
1806 integer,
allocatable :: temp(:)
1808 character*40,
parameter :: thissubname=
'get_var_nc_int_2d'
1811 integer :: istart,iend
1815 allocate(temp(ilength))
1817 call this%get_var_nc_int(varname,ilength,temp)
1819 if(nd1==this%ends(1) .and. nd2==this%ends(2))
then
1823 field(:,j)=temp(istart:iend)
1826 if(this%debug_level>100)
then
1827 write(6,*) trim(thissubname),
' show samples:'
1828 write(6,*)
'max,min:',maxval(field(:,:)),minval(field(:,:))
1831 write(6,*) trim(thissubname),
' ERROR: dimension does not match.'
1832 write(6,*) nd1,this%ends(1),nd2,this%ends(2)
1853 character(len=*),
intent(in) :: varname
1854 integer,
intent(in) :: nd1,nd2,nd3
1855 integer,
intent(out) :: field(nd1,nd2,nd3)
1858 integer,
allocatable :: temp(:)
1860 character*40,
parameter :: thissubname=
'get_var_nc_int_3d'
1864 integer :: istart,iend
1868 ilength=length2d*nd3
1869 allocate(temp(ilength))
1871 call this%get_var_nc_int(varname,ilength,temp)
1873 if(nd1==this%ends(1) .and. nd2==this%ends(2) .and. nd3==this%ends(3))
then
1876 istart=(k-1)*length2d+(j-1)*nd1+1
1877 iend =(k-1)*length2d+(j-1)*nd1+nd1
1878 field(:,j,k)=temp(istart:iend)
1882 if(this%debug_level>100)
then
1883 write(6,*) trim(thissubname),
' show samples:'
1885 write(6,*)
'k,max,min:',k,maxval(field(:,:,k)),minval(field(:,:,k))
1889 write(6,*) trim(thissubname),
' ERROR: dimension does not match.'
1890 write(6,*) nd1,this%ends(1),nd2,this%ends(2),nd3,this%ends(3)
1912 character(len=*),
intent(in) :: varname
1913 integer,
intent(in) :: ilength
1914 integer,
intent(out) :: field(ilength)
1920 integer :: ends(4),start(4)
1922 integer :: length4d,length3d,length2d
1923 integer :: ndims,ndim
1924 integer :: dimids(4)
1926 character*40 :: dimname
1928 character*40,
parameter :: thissubname=
'get_var_nc_int'
1936 status = nf90_inq_varid(ncid, trim(varname), varid)
1937 if(status /= nf90_noerr) call this%handle_err(status)
1946 status = nf90_inquire_variable(ncid, varid, xtype = xtype)
1947 if(status /= nf90_noerr) call this%handle_err(status)
1948 if(xtype==nf90_int)
then
1951 write(6,*) trim(thissubname),
' ERROR: wrong data type, expect ',nf90_int,
' but read in ',xtype
1956 status = nf90_inquire_variable(ncid, varid, ndims = ndims)
1957 if(status /= nf90_noerr) call this%handle_err(status)
1960 status = nf90_inquire_variable(ncid, varid, dimids = dimids(1:ndims))
1961 if(status /= nf90_noerr) call this%handle_err(status)
1964 status = nf90_inquire_dimension(ncid, dimids(i), dimname, len = ndim)
1965 if (status /= nf90_noerr) call this%handle_err(status)
1967 this%ends(i)=ends(i)
1968 this%dimname(i)=trim(dimname)
1969 if(this%ends(i) < 1)
then
1970 write(6,*) trim(thissubname),
' Error, ends dimension should larger than 0 :', ends(i)
1974 length2d=ends(1)*ends(2)
1975 length3d=length2d*ends(3)
1976 length4d=length3d*ends(4)
1977 if(ilength .ne. length4d)
then
1978 write(6,*) trim(thissubname),
'ERROR: ',ilength,
' should equal to ',length4d
1983 status = nf90_get_var(ncid, varid, field, &
1984 start = start(1:4) , &
1986 if(status /= nf90_noerr) call this%handle_err(status)
1988 write(6,*) trim(thissubname),
'Error: too many dimensions:',ndims
1992 if(this%debug_level>0)
then
1993 write(6,
'(a,a)')
'>>>read in variable: ',trim(varname)
1995 if(this%debug_level>10)
then
1996 write(6,
'(8x,a,I10)')
'data type : ',this%xtype
1997 write(6,
'(8x,a,I10)')
'dimension size: ',this%nDims
1999 write(6,
'(8x,a,I5,I10,2x,a)')
'rank, ends, name=',i,this%ends(i),trim(this%dimname(i))
2018 character(len=*),
intent(in) :: varname
2019 integer,
intent(in) :: nd1
2020 integer(2),
intent(out) :: field(nd1)
2023 character*40,
parameter :: thissubname=
'get_var_nc_short_1d'
2029 call this%get_var_nc_short(varname,ilength,field)
2031 if(nd1==this%ends(1))
then
2032 if(this%debug_level>100)
then
2033 write(6,*) trim(thissubname),
' show samples:'
2034 write(6,*) (field(i),i=1,min(nd1,10))
2037 write(6,*) trim(thissubname),
' ERROR: dimension does not match.'
2059 character(len=*),
intent(in) :: varname
2060 integer,
intent(in) :: nd1,nd2
2061 integer(2),
intent(out) :: field(nd1,nd2)
2064 integer(2),
allocatable :: temp(:)
2066 character*40,
parameter :: thissubname=
'get_var_nc_short_2d'
2069 integer :: istart,iend
2073 allocate(temp(ilength))
2075 call this%get_var_nc_short(varname,ilength,temp)
2077 if(nd1==this%ends(1) .and. nd2==this%ends(2))
then
2081 field(:,j)=temp(istart:iend)
2084 if(this%debug_level>100)
then
2085 write(6,*) trim(thissubname),
' show samples:'
2086 write(6,*)
'max,min:',maxval(field(:,:)),minval(field(:,:))
2089 write(6,*) trim(thissubname),
' ERROR: dimension does not match.'
2090 write(6,*) nd1,this%ends(1),nd2,this%ends(2)
2109 character(len=*),
intent(in) :: varname
2110 integer,
intent(in) :: ilength
2111 integer(2),
intent(out) :: field(ilength)
2117 integer :: ends(4),start(4)
2119 integer :: length4d,length3d,length2d
2120 integer :: ndims,ndim
2121 integer :: dimids(4)
2123 character*40 :: dimname
2125 character*40,
parameter :: thissubname=
'get_var_nc_short'
2133 status = nf90_inq_varid(ncid, trim(varname), varid)
2134 if(status /= nf90_noerr) call this%handle_err(status)
2143 status = nf90_inquire_variable(ncid, varid, xtype = xtype)
2144 if(status /= nf90_noerr) call this%handle_err(status)
2145 if(xtype==nf90_short)
then
2148 write(6,*) trim(thissubname),
' ERROR: wrong data type, expect ',nf90_short,
' but read in ',xtype
2153 status = nf90_inquire_variable(ncid, varid, ndims = ndims)
2154 if(status /= nf90_noerr) call this%handle_err(status)
2157 status = nf90_inquire_variable(ncid, varid, dimids = dimids(1:ndims))
2158 if(status /= nf90_noerr) call this%handle_err(status)
2161 status = nf90_inquire_dimension(ncid, dimids(i), dimname, len = ndim)
2162 if (status /= nf90_noerr) call this%handle_err(status)
2164 this%ends(i)=ends(i)
2165 this%dimname(i)=trim(dimname)
2166 if(this%ends(i) < 1)
then
2167 write(6,*) trim(thissubname),
' Error, ends dimension should larger than 0 :', ends(i)
2171 length2d=ends(1)*ends(2)
2172 length3d=length2d*ends(3)
2173 length4d=length3d*ends(4)
2174 if(ilength .ne. length4d)
then
2175 write(6,*) trim(thissubname),
'ERROR: ',ilength,
' should equal to ',length4d
2180 status = nf90_get_var(ncid, varid, field, &
2181 start = start(1:4) , &
2183 if(status /= nf90_noerr) call this%handle_err(status)
2185 write(6,*) trim(thissubname),
'Error: too many dimensions:',ndims
2189 if(this%debug_level>0)
then
2190 write(6,
'(a,a)')
'>>>read in variable: ',trim(varname)
2192 if(this%debug_level>10)
then
2193 write(6,
'(8x,a,I10)')
'data type : ',this%xtype
2194 write(6,
'(8x,a,I10)')
'dimension size: ',this%nDims
2196 write(6,
'(8x,a,I5,I10,2x,a)')
'rank, ends, name=',i,this%ends(i),trim(this%dimname(i))
2215 character(len=*),
intent(in) :: varname
2216 integer,
intent(in) :: nd1
2217 character,
intent(out) :: field(nd1)
2220 character*40,
parameter :: thissubname=
'get_var_nc_char_1d'
2226 call this%get_var_nc_char(varname,ilength,field)
2228 if(nd1==this%ends(1))
then
2229 if(this%debug_level>100)
then
2230 write(6,*) trim(thissubname),
' show samples:'
2231 write(6,*) (field(i),i=1,min(nd1,10))
2234 write(6,*) trim(thissubname),
' ERROR: dimension does not match.'
2253 character(len=*),
intent(in) :: varname
2254 integer,
intent(in) :: nd1,nd2
2255 character,
intent(out) :: field(nd1,nd2)
2258 character,
allocatable :: temp(:)
2260 character*40,
parameter :: thissubname=
'get_var_nc_char_2d'
2263 integer :: istart,iend
2267 allocate(temp(ilength))
2269 call this%get_var_nc_char(varname,ilength,temp)
2271 if(nd1==this%ends(1) .and. nd2==this%ends(2))
then
2275 field(:,j)=temp(istart:iend)
2283 write(6,*) trim(thissubname),
' ERROR: dimension does not match.'
2284 write(6,*) nd1,this%ends(1),nd2,this%ends(2)
2305 character(len=*),
intent(in) :: varname
2306 integer,
intent(in) :: nd1,nd2,nd3
2307 character,
intent(out) :: field(nd1,nd2,nd3)
2310 character,
allocatable :: temp(:)
2312 character*40,
parameter :: thissubname=
'get_var_nc_char_3d'
2316 integer :: istart,iend
2320 ilength=length2d*nd3
2321 allocate(temp(ilength))
2323 call this%get_var_nc_char(varname,ilength,temp)
2325 if(nd1==this%ends(1) .and. nd2==this%ends(2) .and. nd3==this%ends(3))
then
2328 istart=(k-1)*length2d+(j-1)*nd1+1
2329 iend =(k-1)*length2d+(j-1)*nd1+nd1
2330 field(:,j,k)=temp(istart:iend)
2339 write(6,*) trim(thissubname),
' ERROR: dimension does not match.'
2340 write(6,*) nd1,this%ends(1),nd2,this%ends(2),nd3,this%ends(3)
2362 character(len=*),
intent(in) :: varname
2363 integer,
intent(in) :: ilength
2364 character,
intent(out) :: field(ilength)
2370 integer :: ends(4),start(4)
2372 integer :: length4d,length3d,length2d
2373 integer :: ndims,ndim
2374 integer :: dimids(4)
2376 character*40 :: dimname
2378 character*40,
parameter :: thissubname=
'get_var_nc_char'
2386 status = nf90_inq_varid(ncid, trim(varname), varid)
2387 if(status /= nf90_noerr) call this%handle_err(status)
2396 status = nf90_inquire_variable(ncid, varid, xtype = xtype)
2397 if(status /= nf90_noerr) call this%handle_err(status)
2398 if(xtype==nf90_char)
then
2401 write(6,*) trim(thissubname),
' ERROR: wrong data type, expect ',nf90_char,
' but read in ',xtype
2406 status = nf90_inquire_variable(ncid, varid, ndims = ndims)
2407 if(status /= nf90_noerr) call this%handle_err(status)
2410 status = nf90_inquire_variable(ncid, varid, dimids = dimids(1:ndims))
2411 if(status /= nf90_noerr) call this%handle_err(status)
2414 status = nf90_inquire_dimension(ncid, dimids(i), dimname, len = ndim)
2415 if (status /= nf90_noerr) call this%handle_err(status)
2417 this%ends(i)=ends(i)
2418 this%dimname(i)=trim(dimname)
2419 if(this%ends(i) < 1)
then
2420 write(6,*) trim(thissubname),
' Error, ends dimension should larger than 0 :', ends(i)
2424 length2d=ends(1)*ends(2)
2425 length3d=length2d*ends(3)
2426 length4d=length3d*ends(4)
2427 if(ilength .ne. length4d)
then
2428 write(6,*) trim(thissubname),
'ERROR: ',ilength,
' should equal to ',length4d
2433 status = nf90_get_var(ncid, varid, field, &
2434 start = start(1:4) , &
2436 if(status /= nf90_noerr) call this%handle_err(status)
2438 write(6,*) trim(thissubname),
'Error: too many dimensions:',ndims
2442 if(this%debug_level>0)
then
2443 write(6,
'(a,a)')
'>>>read in variable: ',trim(varname)
2445 if(this%debug_level>10)
then
2446 write(6,
'(8x,a,I10)')
'data type : ',this%xtype
2447 write(6,
'(8x,a,I10)')
'dimension size: ',this%nDims
2449 write(6,
'(8x,a,I5,I10,2x,a)')
'rank, ends, name=',i,this%ends(i),trim(this%dimname(i))
2465 integer,
intent ( in) :: status
2466 if(status /= nf90_noerr)
then
2467 print *, trim(nf90_strerror(status))
2485 real,
intent(in ) :: ps(nx,ny)
2486 real,
intent(inout) :: t2(nx,ny)
2489 real(8) :: rd,cp,rd_over_cp
2498 t2(i,j)=t2(i,j)*(ps(i,j)/1000.0)**rd_over_cp - 273.15
2521 character(len=*),
intent(in) :: varname,dname1,dname2,dname3 &
2523 integer :: status, ncid, dim1id, dim2id, dim3id, varid
2524 character(len=*),
intent(in) :: dtype
2526 status = nf90_redef(this%ncid)
2527 if (status /= nf90_noerr) call this%handle_err(status)
2529 status = nf90_inq_dimid(this%ncid, dname1, dim1id)
2530 if (status /= nf90_noerr) call this%handle_err(status)
2531 status = nf90_inq_dimid(this%ncid, dname2, dim2id)
2532 if (status /= nf90_noerr) call this%handle_err(status)
2533 status = nf90_inq_dimid(this%ncid, dname3, dim3id)
2534 if (status /= nf90_noerr) call this%handle_err(status)
2536 if(trim(dtype)==
"double")
then
2537 status = nf90_def_var(this%ncid, varname, nf90_double, &
2538 (/ dim1id, dim2id, dim3id /), varid)
2539 elseif(trim(dtype)==
"float")
then
2540 status = nf90_def_var(this%ncid, varname, nf90_float, &
2541 (/ dim1id, dim2id, dim3id /), varid)
2542 elseif(trim(dtype)==
"int")
then
2543 status = nf90_def_var(this%ncid, varname, nf90_int, &
2544 (/ dim1id, dim2id, dim3id /), varid)
2546 write(*,*)
' undefined data type ', trim(dtype)
2547 call this%handle_err(status)
2549 if (status /= nf90_noerr) call this%handle_err(status)
2551 status = nf90_put_att(this%ncid, varid,
'long_name', lname)
2552 if (status /= nf90_noerr) call this%handle_err(status)
2553 status = nf90_put_att(this%ncid, varid,
'units', units)
2554 if (status /= nf90_noerr) call this%handle_err(status)
2556 status = nf90_enddef(this%ncid)
2558 if (status /= nf90_noerr) call this%handle_err(status)
2578 character(len=*),
intent(in) :: varname,dname1,dname2 &
2580 integer :: status, ncid, dim1id, dim2id, varid
2581 character(len=*),
intent(in) :: dtype
2583 status = nf90_redef(this%ncid)
2584 if (status /= nf90_noerr) call this%handle_err(status)
2586 status = nf90_inq_dimid(this%ncid, dname1, dim1id)
2587 if (status /= nf90_noerr) call this%handle_err(status)
2588 status = nf90_inq_dimid(this%ncid, dname2, dim2id)
2589 if (status /= nf90_noerr) call this%handle_err(status)
2591 if(trim(dtype)==
"double")
then
2592 status = nf90_def_var(this%ncid, varname, nf90_double, &
2593 (/ dim1id, dim2id /), varid)
2594 elseif(trim(dtype)==
"float")
then
2595 status = nf90_def_var(this%ncid, varname, nf90_float, &
2596 (/ dim1id, dim2id /), varid)
2597 elseif(trim(dtype)==
"int")
then
2598 status = nf90_def_var(this%ncid, varname, nf90_int, &
2599 (/ dim1id, dim2id /), varid)
2601 write(*,*)
' undefined data type ', trim(dtype)
2602 call this%handle_err(status)
2604 if (status /= nf90_noerr) call this%handle_err(status)
2606 status = nf90_put_att(this%ncid, varid,
'long_name', lname)
2607 if (status /= nf90_noerr) call this%handle_err(status)
2608 status = nf90_put_att(this%ncid, varid,
'units', units)
2609 if (status /= nf90_noerr) call this%handle_err(status)
2611 status = nf90_enddef(this%ncid)
2613 if (status /= nf90_noerr) call this%handle_err(status)
procedure get_var_nc_int
Read in a 1d, 2d, 3d, or 4d field from the nc file.
procedure get_var_nc_short_1d
Read in a 1d, 2d, 3d, or 4d field from the nc file.
procedure replace_var_nc_real
Replace 1d, 2d, 3d, or 4d field from the nc file.
procedure get_var_nc_int_1d
Read in a 1d, 2d, 3d, or 4d field from the nc file.
generic get_var=> get_var_nc_double_1d, get_var_nc_double_2d,get_var_nc_double_3d,get_var_nc_real_1d, get_var_nc_real_2d,get_var_nc_real_3d,get_var_nc_short_1d, get_var_nc_short_2d,get_var_nc_int_1d, get_var_nc_int_2d,get_var_nc_int_3d,get_var_nc_char_1d, get_var_nc_char_2d,get_var_nc_char_3d
Read in a 1d, 2d, 3d, or 4d field from the nc file.
procedure replace_var_nc_int_2d
Replace 1d, 2d, 3d, or 4d field from the nc file.
procedure get_var_nc_int_3d
Read in a 1d, 2d, 3d, or 4d field from the nc file.
procedure replace_var_nc_double_3d
Replace 1d, 2d, 3d, or 4d field from the nc file.
procedure get_att_nc_real
Get attribute.
subroutine open_nc(this, filename, action, debug_level)
Open a netcdf file, set initial debug level.
generic get_att=> get_att_nc_int, get_att_nc_real, get_att_nc_string
Get attribute.
subroutine close_nc(this)
Close a netcdf file.
procedure replace_var_nc_char_1d
Replace character type variable.
procedure get_var_nc_double_2d
Read in a 1d, 2d, 3d, or 4d field from the nc file.
procedure get_var_nc_real_1d
Read in a 1d, 2d, 3d, or 4d field from the nc file.
procedure get_var_nc_double_1d
Read in a 1d, 2d, 3d, or 4d field from the nc file.
procedure get_var_nc_real_3d
Read in a 1d, 2d, 3d, or 4d field from the nc file.
Functions to read and write netcdf files.
procedure get_var_nc_real
Read in a 1d, 2d, 3d, or 4d field from the nc file.
procedure get_var_nc_short_2d
Read in a 1d, 2d, 3d, or 4d field from the nc file.
generic add_new_var=> add_new_var_2d,add_new_var_3d
Add a new 2d or 3d variable to ouput file.
procedure replace_var_nc_char
Replace character type variable.
procedure replace_var_nc_real_2d
Replace 1d, 2d, 3d, or 4d field from the nc file.
procedure convert_theta2t_2dgrid
Convert theta T (Kelvin) to T (deg C).
procedure replace_var_nc_int_1d
Replace 1d, 2d, 3d, or 4d field from the nc file.
procedure get_var_nc_char
Read in a 1d, 2d, 3d, or 4d field from the nc file.
procedure replace_var_nc_real_1d
Replace 1d, 2d, 3d, or 4d field from the nc file.
procedure get_var_nc_short
Read in a 1d, 2d, 3d, or 4d field from the nc file.
procedure add_new_var_3d
Add a new 3d variable to output file.
subroutine get_dim_nc(this, dimname, dimvalue)
Get dimensions in netcdf file.
procedure get_dim=> get_dim_nc
read in dimension from the nc file
procedure replace_var_nc_int
Replace 1d, 2d, 3d, or 4d field from the nc file.
procedure handle_err
Handle netCDF errors.
procedure get_var_nc_real_2d
Read in a 1d, 2d, 3d, or 4d field from the nc file.
procedure replace_var_nc_real_3d
Replace 1d, 2d, 3d, or 4d field from the nc file.
procedure replace_var_nc_double_1d
Replace 1d, 2d, 3d, or 4d field from the nc file.
procedure get_var_nc_double
Read in a 1d, 2d, 3d, or 4d field from the nc file.
procedure replace_var_nc_double
Replace 1d, 2d, 3d, or 4d field from the nc file.
procedure add_new_var_2d
Add a new 2d variable to output file.
procedure replace_var_nc_double_2d
Replace 1d, 2d, 3d, or 4d field from the nc file.
procedure replace_var_nc_char_2d
Replace character type variable.
procedure get_att_nc_string
Get attribute.
procedure get_var_nc_int_2d
Read in a 1d, 2d, 3d, or 4d field from the nc file.
procedure get_var_nc_char_1d
Read in a 1d, 2d, 3d, or 4d field from the nc file.
procedure get_var_nc_char_2d
Read in a 1d, 2d, 3d, or 4d field from the nc file.
procedure get_var_nc_char_3d
Read in a 1d, 2d, 3d, or 4d field from the nc file.
procedure get_var_nc_double_3d
Read in a 1d, 2d, 3d, or 4d field from the nc file.
procedure replace_var_nc_char_3d
Replace 3D character type variable.
generic replace_var=> replace_var_nc_double_1d, replace_var_nc_double_2d,replace_var_nc_double_3d,replace_var_nc_real_1d, replace_var_nc_real_2d,replace_var_nc_real_3d,replace_var_nc_int_1d, replace_var_nc_int_2d,replace_var_nc_int_3d,replace_var_nc_char_1d, replace_var_nc_char_2d,replace_var_nc_char_3d
Replace 1d, 2d, 3d, or 4d field from the nc file.
procedure get_att_nc_int
Get attribute.
procedure replace_var_nc_int_3d
Replace 1d, 2d, 3d, or 4d field from the nc file.