11 use gengrid_kinds,
only : cl,cm,cs
12 use grdvars,
only : nv, mastertask
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' 71 logmsg =
'creating weight file '//trim(fwgt)
72 print
'(a)',trim(logmsg)
75 call esmf_regridweightgen(srcfile=trim(fsrc),dstfile=trim(fdst), &
76 weightfile=trim(fwgt), regridmethod=method, &
77 ignoredegenerate=.true., &
78 unmappedaction=esmf_unmappedaction_ignore, rc=rc)
79 if (esmf_logfounderror(rctocheck=rc, msg=esmf_logerr_passthru, &
80 line=__line__, file=__file__))
call esmf_finalize(endflag=esmf_end_abort)
90 fsrc = trim(dirout)//
'/'//
'Ct.mx'//trim(res)//
'_SCRIP.nc' 91 fdst = trim(dirout)//
'/rect.'//trim(destgrds(nd))//
'_SCRIP.nc' 93 do k = 1,
size(methodname)
94 if(trim(methodname(k)) .eq.
'bilinear')method=esmf_regridmethod_bilinear
95 if(trim(methodname(k)) .eq.
'conserve')method=esmf_regridmethod_conserve
97 fwgt = trim(dirout)//
'/'//
'tripole.mx'//trim(res)//
'.Ct.to.rect.'//trim(destgrds(nd)) &
98 //
'.'//trim(methodname(k))//
'.nc' 100 logmsg =
'creating weight file '//trim(fwgt)
101 print
'(a)',trim(logmsg)
104 call esmf_regridweightgen(srcfile=trim(fsrc),dstfile=trim(fdst), &
105 weightfile=trim(fwgt), regridmethod=method, &
106 ignoredegenerate=.true., &
107 unmappedaction=esmf_unmappedaction_ignore, rc=rc)
108 if (esmf_logfounderror(rctocheck=rc, msg=esmf_logerr_passthru, &
109 line=__line__, file=__file__))
call esmf_finalize(endflag=esmf_end_abort)
115 end subroutine make_postwgts