11 use gengrid_kinds,
only : cl,cm,cs
12 use grdvars,
only : nv
13 use charstrings,
only : dirout, res, staggerlocs, logmsg
24 subroutine make_postwgts
27 character(len=CL) :: fsrc, fdst, fwgt
28 character(len= 2) :: cstagger
30 character(len=CM),
dimension(2) :: methodname = (/
'conserve',
'bilinear'/)
32 type(ESMF_RegridMethod_Flag) :: method
34 integer :: k,rc,nd,ndest
35 character(len=CS),
allocatable,
dimension(:) :: destgrds
41 if(trim(res) .eq.
'400')
return 43 if(trim(res) .eq.
'100')
then 45 allocate(destgrds(ndest))
48 if(trim(res) .eq.
'050')
then 50 allocate(destgrds(ndest))
51 destgrds = (/
'1p0 ',
'0p5 '/)
53 if(trim(res) .eq.
'025')
then 55 allocate(destgrds(ndest))
56 destgrds = (/
'1p0 ',
'0p5 ',
'0p25'/)
64 method=esmf_regridmethod_bilinear
65 fdst = trim(dirout)//
'/'//
'Ct.mx'//trim(res)//
'_SCRIP.nc' 67 cstagger = trim(staggerlocs(k))
68 fsrc = trim(dirout)//
'/'//trim(cstagger)//
'.mx'//trim(res)//
'_SCRIP.nc' 69 fwgt = trim(dirout)//
'/'//
'tripole.mx'//trim(res)//
'.'//trim(cstagger)//
'.to.Ct.bilinear.nc' 70 logmsg =
'creating weight file '//trim(fwgt)
71 print
'(a)',trim(logmsg)
73 call esmf_regridweightgen(srcfile=trim(fsrc),dstfile=trim(fdst), &
74 weightfile=trim(fwgt), regridmethod=method, &
75 ignoredegenerate=.true., &
76 unmappedaction=esmf_unmappedaction_ignore, rc=rc)
77 if (esmf_logfounderror(rctocheck=rc, msg=esmf_logerr_passthru, &
78 line=__line__, file=__file__))
call esmf_finalize(endflag=esmf_end_abort)
88 fsrc = trim(dirout)//
'/'//
'Ct.mx'//trim(res)//
'_SCRIP.nc' 89 fdst = trim(dirout)//
'/rect.'//trim(destgrds(nd))//
'_SCRIP.nc' 91 do k = 1,
size(methodname)
92 if(trim(methodname(k)) .eq.
'bilinear')method=esmf_regridmethod_bilinear
93 if(trim(methodname(k)) .eq.
'conserve')method=esmf_regridmethod_conserve
95 fwgt = trim(dirout)//
'/'//
'tripole.mx'//trim(res)//
'.Ct.to.rect.'//trim(destgrds(nd)) &
96 //
'.'//trim(methodname(k))//
'.nc' 97 logmsg =
'creating weight file '//trim(fwgt)
98 print
'(a)',trim(logmsg)
100 call esmf_regridweightgen(srcfile=trim(fsrc),dstfile=trim(fdst), &
101 weightfile=trim(fwgt), regridmethod=method, &
102 ignoredegenerate=.true., &
103 unmappedaction=esmf_unmappedaction_ignore, rc=rc)
104 if (esmf_logfounderror(rctocheck=rc, msg=esmf_logerr_passthru, &
105 line=__line__, file=__file__))
call esmf_finalize(endflag=esmf_end_abort)
111 end subroutine make_postwgts