13 use charstrings, only : dirout, res, staggerlocs, logmsg
27 character(len=CL) :: fsrc, fdst, fwgt
28 character(len= 2) :: cstagger
30 character(len=CM),
dimension(2) :: methodname = (/
'conserve',
'bilinear'/)
32 type(esmf_routehandle
) :: rh
33 type(esmf_regridmethod_flag
) :: method
35 integer :: k,rc,nd,ndest
36 character(len=CS),
allocatable,
dimension(:) :: destgrds
42 if(trim(res) .eq.
'500')
then
44 allocate(destgrds(ndest))
47 if(trim(res) .eq.
'100')
then
49 allocate(destgrds(ndest))
50 destgrds = (/
'5p00',
'1p00'/)
52 if(trim(res) .eq.
'050')
then
54 allocate(destgrds(ndest))
55 destgrds = (/
'5p00',
'1p00',
'0p50'/)
57 if(trim(res) .eq.
'025')
then
59 allocate(destgrds(ndest))
60 destgrds = (/
'5p00',
'1p00',
'0p50',
'0p25'/)
68 method=esmf_regridmethod_bilinear
69 fdst = trim(dirout)//
'/'//
'Ct.mx'//trim(res)//
'_SCRIP.nc'
71 cstagger = trim(staggerlocs(k))
72 fsrc = trim(dirout)//
'/'//trim(cstagger)//
'.mx'//trim(res)//
'_SCRIP.nc'
73 fwgt = trim(dirout)//
'/'//
'tripole.mx'//trim(res)//
'.'//trim(cstagger)//
'.to.Ct.bilinear.nc'
74 logmsg =
'creating weight file '//trim(fwgt)
75 print
'(a)',trim(logmsg)
77 call esmf_regridweightgen(srcfile=trim(fsrc),dstfile=trim(fdst), &
78 weightfile=trim(fwgt), regridmethod=method, &
79 ignoredegenerate=.true., &
80 unmappedaction=esmf_unmappedaction_ignore, rc=rc)
81 if (esmf_logfounderror(rctocheck=rc, msg=esmf_logerr_passthru, &
82 line=__line__, file=__file__)) call esmf_finalize(endflag=esmf_end_abort)
92 fsrc = trim(dirout)//
'/'//
'Ct.mx'//trim(res)//
'_SCRIP.nc'
93 fdst = trim(dirout)//
'/rect.'//trim(destgrds(nd))//
'_SCRIP.nc'
95 do k = 1,
size(methodname)
96 if(trim(methodname(k)) .eq.
'bilinear')method=esmf_regridmethod_bilinear
97 if(trim(methodname(k)) .eq.
'conserve')method=esmf_regridmethod_conserve
99 fwgt = trim(dirout)//
'/'//
'tripole.mx'//trim(res)//
'.Ct.to.rect.'//trim(destgrds(nd)) &
100 //
'.'//trim(methodname(k))//
'.nc'
101 logmsg =
'creating weight file '//trim(fwgt)
102 print
'(a)',trim(logmsg)
104 call esmf_regridweightgen(srcfile=trim(fsrc),dstfile=trim(fdst), &
105 weightfile=trim(fwgt), regridmethod=method, &
106 ignoredegenerate=.true., regridroutehandle=rh, &
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)
subroutine make_postwgts
Create the ESMF weights files to remap velocity points from their native stagger location to the cent...