Dear NCL,
I was using the following script to regridding the joined Daymet grid (1
KM) to 3 acrmin, in which the projection was translated from LLC to lonlat
and the resolution from 1 KM to 3 arcmin. However, after I tried to
comparing different interpolation method based on the 3 arcmin data (I used
a conserve method for the ESMF regridding), I found the this 3 arcmin data
has problem in the edge/boundary.
I am including a graphs here to show the problem:
[image: Inline image 1]
The edge(coast and land) place especially in Maine (also massachusetts)
looks weird after the regridding, a mixture of no data value and real
values, and when I do a statistical of year sum, I got very small
values(below 10 mm) for one year.
The script I was using is:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"
vname ="pr"
srcFileName = vname + ".NE." + year +".nc"
;srcFileName = "NE_all_1980_correct_prcp.nc"
srcPathName = srcDirName+srcFileName
sfile = addfile(srcPathName,"r")
;---Set the destination file name
dstDirName = "/data/ecr/yangping/DAYMET/Grid/Intermediate/"
system("/bin/mkdir -p "+ dstDirName)
dstFileName = str_upper(vname)+"."+year+"_1KM.esmf.nc"
dstPathName = dstDirName+dstFileName
setfileoption("nc","Format","LargeFile")
;out=addfile("/data/ecr/yangping/DAYMET/Grid/3MIN/" + vname +
"_3MIN_lonlat_" + year+".nc","c")
outDirName = "/data/ecr/yangping/DAYMET/Grid/3MIN/"
outFileName = vname + ".3MIN.lonlat." + year+".nc"
outPathName = outDirName + outFileName
system("/bin/rm -f "+outPathName) ; delete any pre-existing file
out=addfile(outPathName,"c")
;--- ESMF regrid method: "conserve", "bilinear", "patch"
method = "conserve"
; method = "patch"
;===================================================
;---Options
Opt = True
Opt@SrcTitle = "Daymet Joined Grid "+year+" to rectlinear" ;
optional
Opt@WgtFileName = dstDirName + "Daymet_to_Rect.Wgt.nc"
Opt@ForceOverwrite = True
;;Opt@PrintTimings = True
;---Get the source file Daymet lat/lon grid
lat2d = sfile->lat
lon2d = sfile->lon
dim2d = dimsizes(lat2d)
nlat = dim2d(0)
nlon = dim2d(1)
print(nlat)
print(nlon)
;---Get the Daymet source variable
var = sfile->$vname$ ; (time, y, x)=>(365,232,221)
;Opt@SrcGridType = "curvilinear"
Opt@SrcGridLat = lat2d
Opt@SrcGridLon = lon2d
;---Create the destination lat/lon grid
dll=0.05 ;3MIN
latrange=abs(max(lat2d)-min(lat2d))
lonrange=abs(max(lon2d)-min(lon2d))
kpts_lat= toint(latrange/dll)+1
kpts_lon= toint(lonrange/dll)+1
lat = fspan( min(lat2d),max(lat2d), kpts_lat )
lon = fspan( min(lon2d),max(lon2d), kpts_lon )
newlon = fspan(-84.025,-64.875,384)
newlat = fspan(34.875,50.125,306)
Opt@DstGridType = "rectilinear"
;Opt@DstGridLat = lat
Opt@DstGridLat = newlat
;Opt@DstGridLon = lon
Opt@DstGridLon = newlon
Opt@CopyVarCoords= True ; default for 6.1.0
Opt@InterpMethod = method
Opt@SrcRegional = True
Opt@DstRegional = True
var_regrid = ESMF_regrid(var,Opt) ; Do the regridding for 'var'
printVarSummary(var_regrid)
var_regrid@grid_mapping = "lonlat" ;
out->$vname$=var_regrid ;output the regridding result
Can some here where is the problem and how to fix it?
Look forward to hearing from you.
Regards,
Ping
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2.1.8 : Mon Apr 15 2013 - 20:12:25 MDT