10 use grdvars, only: ni,nj,ulat,ulon,htn,hte,angle,wet4,mastertask
30 character(len=*),
intent(in) :: fname
33 integer :: ii,id,rc, ncid, dim2(2)
34 integer :: idimid,jdimid
36 character(len=2) :: vtype
37 character(len=CM) :: vname
38 character(len=CM) :: vlong
39 character(len=CM) :: vunit
48 rc = nf90_create(fname, nf90_write, ncid)
50 logmsg =
'==> writing CICE grid to '//trim(fname)
51 print
'(a)', trim(logmsg)
52 if(rc .ne. 0)print
'(a)',
'nf90_create = '//trim(nf90_strerror(rc))
55 rc = nf90_def_dim(ncid,
'ni', ni, idimid)
56 rc = nf90_def_dim(ncid,
'nj', nj, jdimid)
59 if(len_trim(cicevars(ii)%var_name) .gt. 0)
then
60 vname = trim(cicevars(ii)%var_name)
61 vlong = trim(cicevars(ii)%long_name)
62 vunit = trim(cicevars(ii)%unit_name)
63 vtype = trim(cicevars(ii)%var_type)
65 dim2(:) = (/idimid, jdimid/)
66 if(vtype .eq.
'r8')rc = nf90_def_var(ncid, vname, nf90_double, dim2, id)
67 if(vtype .eq.
'r4')rc = nf90_def_var(ncid, vname, nf90_float, dim2, id)
68 if(vtype .eq.
'i4')rc = nf90_def_var(ncid, vname, nf90_int, dim2, id)
69 rc = nf90_put_att(ncid, id,
'units', vunit)
70 rc = nf90_put_att(ncid, id,
'long_name', vlong)
73 rc = nf90_put_att(ncid, nf90_global,
'history', trim(history))
74 rc = nf90_enddef(ncid)
76 rc = nf90_inq_varid(ncid,
'ulon', id)
77 rc = nf90_put_var(ncid, id, ulon)
79 rc = nf90_inq_varid(ncid,
'ulat', id)
80 rc = nf90_put_var(ncid, id, ulat)
82 rc = nf90_inq_varid(ncid,
'htn', id)
83 rc = nf90_put_var(ncid, id, htn)
85 rc = nf90_inq_varid(ncid,
'hte', id)
86 rc = nf90_put_var(ncid, id, hte)
88 rc = nf90_inq_varid(ncid,
'angle', id)
89 rc = nf90_put_var(ncid, id, angle)
91 rc = nf90_inq_varid(ncid,
'kmt', id)
92 rc = nf90_put_var(ncid, id, int(wet4))
subroutine cicevars_typedefine
Define the variables written to the CICE grid file.
subroutine, public write_cicegrid(fname)
Write the CICE6 grid file.