Hi Kamal,
I don't know what was happening, actually I modified the script according
to the example 3, here I am posting my code to do the regridding from 1KM
to 3 MIN:
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"
;======================================================================
; The main code
;======================================================================
;vname = "prcp"
;year = 1980
print("start to process the year of "+ year + " for variable " + vname)
;---Input file (Daymet joined tile) ;NE_all_1980_correct_$vname$ .nc
srcDirName = "/data/ecr/DAYMET/Grid/1KM/011213/"
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") ;generating big data
;out=addfile("/data/ecr/DAYMET/Grid/3MIN/" + vname + "_3MIN_lonlat_" +
year+".nc","c")
outDirName = "/data/ecr/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
Hope you can make it successful (it will better for NCL have a nicer
reference manual)
Ping
On Thu, Feb 14, 2013 at 5:35 PM, Dave Allured - NOAA Affiliate <
dave.allured@noaa.gov> wrote:
> All,
>
> Daymet files are relatively ordinary Netcdf files with curvilinear
> grids, two-dimensional geographic coordinates, and partial areas with
> all missing values. They conform to standard CF conventions for 2-D
> coordinates and most other metadada. This is true for original Daymet
> "tiles" as well as merged files made by the Daymet join script.
>
> Just treat these files the same way as many other data sets with 2-D
> coordinates to be found across various NCL examples.
>
> I do not have enough experience with regridding to make comparisons
> between the various NCL regridding methods.
>
> Kamal, the script that Mary drafted looks fine to me. The same goes
> for examples 2 and 3 on the NCL Daymet applications page. They all
> use the same ESMF regridding function, so they should be equivalent.
> Also, I suspect that NCL has other regridding functions that work well
> with 2-D coordinates. So please study the regridding applications
> page if you would like more alternatives.
>
> --Dave
>
> On Thu, Feb 14, 2013 at 1:29 PM, Mary Haley <haley@ucar.edu> wrote:
> > Kamal,
> >
> > I don't know anything about DAYMET files, so I can't answer about their
> differences.
> > Dave Allured might have some ideas there.
> >
> > Meanwhile, the ESMF WRF-to-curvilinear script is mostly a convenience
> > script that is tailored for WRF data. Really, it's just a
> curvilinear-to-curvilinear script.
> >
> > The script you have can easily be modifed to go from curvilinear to WRF.
> >
> > I've attached a sample script that likely has some errors in it, since I
> haven't tried it!
> >
> > --Mary
> >
> >
> > On Feb 12, 2013, at 9:57 PM, mmkamal@uwaterloo.ca wrote:
> >
> >> Hi,
> >>
> >> I want to re-grid the DAYMET data prepared using Dave's contributed
> >> NCL script
> >> (
> http://www.esrl.noaa.gov/psd/people/dave.allured/data/daymet/daymet.html)
> >> into WRF model grid. I can see that both data set is on curvilinear
> >> grid. It is stated in the "ESMF_WRF_to_curv.ncl" script's header file
> >> that "This is an NCL/ESMF template file for regridding from a WRF
> >> (curvilinear) grid to a different curvilinear grid". So, I want to
> >> know is there any difference between the DAYMET data prepared using
> >> Dave's contributed NCL script and WRF model output?
> >>
> >> I want to compare my WRF model output (dx=dy=8km) with the 1 km DAYMET
> >> data set. So, could you please tell me which NCL regridding script I
> >> should use?
> >>
> >>
> >> Thanks
> >> Kamal
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-- Ping Yang, Ph.D. CUNY Environmental Crossroads Initiative Marshak Science Building - Suite 925 The City College of New York - CUNY 160 Convent Avenue, New York NY 10031 Phone: 212-650-5769 Fax: 212-650-7064
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Feb 14 17:06:18 2013
This archive was generated by hypermail 2.1.8 : Thu Feb 21 2013 - 11:26:43 MST