11 use gengrid_kinds,
only : cl,cm,cs
12 use grdvars,
only : nv
13 use charstrings,
only : dirout, res, logmsg
23 subroutine make_postwgts
26 character(len=CL) :: fsrc, fdst, fwgt
28 character(len=CM),
dimension(2) :: methodname = (/
'conserve',
'bilinear'/)
30 type(ESMF_RouteHandle) :: rh
31 type(ESMF_RegridMethod_Flag) :: method
33 integer :: k,rc,nd,ndest
34 character(len=CS),
allocatable,
dimension(:) :: destgrds
40 if(trim(res) .eq.
'500')
then 42 allocate(destgrds(ndest))
45 if(trim(res) .eq.
'100')
then 47 allocate(destgrds(ndest))
48 destgrds = (/
'5p00',
'1p00'/)
50 if(trim(res) .eq.
'050')
then 52 allocate(destgrds(ndest))
53 destgrds = (/
'5p00',
'1p00',
'0p50'/)
55 if(trim(res) .eq.
'025')
then 57 allocate(destgrds(ndest))
58 destgrds = (/
'5p00',
'1p00',
'0p50',
'0p25'/)
68 fsrc = trim(dirout)//
'/'//
'Ct.mx'//trim(res)//
'_SCRIP.nc' 69 fdst = trim(dirout)//
'/rect.'//trim(destgrds(nd))//
'_SCRIP.nc' 71 do k = 1,
size(methodname)
72 if(trim(methodname(k)) .eq.
'bilinear')method=esmf_regridmethod_bilinear
73 if(trim(methodname(k)) .eq.
'conserve')method=esmf_regridmethod_conserve
75 fwgt = trim(dirout)//
'/'//
'tripole.mx'//trim(res)//
'.Ct.to.rect.'//trim(destgrds(nd)) &
76 //
'.'//trim(methodname(k))//
'.nc' 77 logmsg =
'creating weight file '//trim(fwgt)
78 print
'(a)',trim(logmsg)
80 call esmf_regridweightgen(srcfile=trim(fsrc),dstfile=trim(fdst), &
81 weightfile=trim(fwgt), regridmethod=method, &
82 ignoredegenerate=.true., regridroutehandle=rh, &
83 unmappedaction=esmf_unmappedaction_ignore, rc=rc)
84 if (esmf_logfounderror(rctocheck=rc, msg=esmf_logerr_passthru, &
85 line=__line__, file=__file__))
call esmf_finalize(endflag=esmf_end_abort)
91 end subroutine make_postwgts