<div dir="ltr"><div><div><div><div><div><div><div><div><a href="http://yellowstone.ucar.edu">yellowstone.ucar.edu</a><br><br>cd /glade/p/work/shea/DEBASISH<br><br>===<br></div>Read & Plot: Read the file and plot the data<br><br>rcm_plot.ncl<br>Daymet.png<br><br>===<br></div>ESMF script to generate the weights<br><br>rcm2recl.ncl<br><br></div>The problem is that the source grid is quite large: (8075, 7814)<br><br></div>Both the source grid description file:<br><br> daymet_src_SCRIP.nc: 5300236936 bytes<br><br>and the generated weight file, located in:<br> /glade/p/ncldev/users/debasish/rcm<br><br>6312576491 WGT_daymet2Rect_bilinear.nc<br><br></div>are > 2GB. This requires using netCDF-4. The following option does this:<br><br> Opt@NetCDFType = "netcdf4" ; necessary for writing large variables<br><br></div>Further, when you get ESMF errors is is suggested that you use:<br><br> Opt@Debug = True ; provide additional information<br><br>======<br><br></div>Punch line: copy the WGT file to /some/directory/of/yours<br><br></div>%> cd /some/directory/of/yours<br><div>%> cp /glade/p/ncldev/users/debasish/rcm/WGT_daymet2Rect_bilinear.nc .<br><br></div><div>Use:<br> <a href="http://www.ncl.ucar.edu/Document/Functions/ESMF/ESMF_regrid_with_weights.shtml">http://www.ncl.ucar.edu/Document/Functions/ESMF/ESMF_regrid_with_weights.shtml</a><br><br> var = sfile->tmax ; (time, y, x ) <br> printVarSummary(var) ; [time | ] x [y | 8075] x [x | 7814]<br><br><br></div><div> wgtFilePath = "/some/directory/of/yours/WGT_daymet2Rect_bilinear.nc"</div><div><pre> var_regrid = <strong>ESMF_regrid_with_weights</strong>(var,wgtFilePath,False)
printVarSummary(var_regrid)
.<br>===<br></pre><pre>This should be VERY fast.<br></pre><pre>Let us know when you have copied the file so it can be deleted.<br></pre>Good Luck<br></div><div><div><br> <br><div><div><div><div><div><div><div><br></div></div></div></div></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 1, 2016 at 3:23 PM, debasish mazumder <span dir="ltr"><<a href="mailto:debasish@ucar.edu" target="_blank">debasish@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks. I have used your suggestion. However, I got following error- (0) ESMF_regrid_gen_weights: 'ESMF_RegridWeightGen' was not successful.<br>
<br>
with regards<br>
-Deb<br>
<br>
Here is my scripts<br>
<br>
load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/gsn_code.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/gsn_csm.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/contributed.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/esmf/ESMF_regridding.ncl"<br>
<br>
begin<br>
;---Read data off source file<br>
srcFileName = "daymet_v3_tmax_monavg_1980_na<wbr>.nc4"<br>
sfile = addfile(srcFileName,"r")<br>
madis = sfile->tmax(0,:,:)<br>
madis@lat2d = sfile->lat<br>
madis@lon2d = sfile->lon<br>
<br>
;---Assign zoom region<br>
minlon = min(madis@lon2d)<br>
maxlon = max(madis@lon2d)<br>
minlat = min(madis@lat2d)<br>
maxlat = max(madis@lat2d)<br>
<br>
;---Read data off destination file<br>
dfile = addfile("/glade/scratch/debasi<wbr>sh/CCSM4/CCSM4_T2_1958.nc","r"<wbr>)<br>
lat = dfile->lat ; Need these for coordinate arrays<br>
lon = dfile->lon ; for regridding<br>
lon = where(lon.gt.180,lon-360,lon)<br>
<br>
;---Options for regridding<br>
Opt = True<br>
<br>
Opt@SrcFileName = "AusSnow_src_SCRIP.nc"<br>
Opt@DstFileName = "AusSnow_dst_SCRIP.nc"<br>
Opt@ForceOverwrite = True<br>
<br>
Opt@SrcTitle = srcFileName ; source grid<br>
Opt@SrcMask2D = where(ismissing(madis),0,1)<br>
Opt@SrcRegional = True<br>
<br>
Opt@DstTitle = "Australia Rectilinear Grid" ; destination grid<br>
Opt@DstGridLat = lat<br>
Opt@DstGridLon = lon<br>
Opt@DstRegional = True<br>
<br>
;;Opt@PrintTimings = True<br>
<br>
Opt@InterpMethod = "bilinear"<br>
<br>
Opt@WgtFileName = "AUS_Swath_2_Rect_bilinear.nc"<br>
madis_regrid_b = ESMF_regrid(madis,Opt)<br>
<br>
printVarSummary(madis_regrid_b<wbr>)<br>
printMinMax(madis_regrid_b, True)<br>
<br>
end<span class=""><br>
<br>
<br>
<br>
<br>
On 12/1/16 2:58 PM, Dennis Shea wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
As suggested by Andrew, the ESMF approach is the way to go.<br>
<br>
[1] Save the weight file. Note: generating the weight file may be slow<br>
but it is done once.<br>
[2] Regrid using the weight file generated in [1]. This should be VERY<br>
FAST! It is basically a sparse matrix multiply.<br>
<br>
<a href="http://www.ncl.ucar.edu/Document/Functions/ESMF/ESMF_regrid_with_weights.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Docume<wbr>nt/Functions/ESMF/ESMF_regrid_<wbr>with_weights.shtml</a><br>
[3] See<br>
<br>
<a href="http://www.ncl.ucar.edu/Applications/ESMF.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Applic<wbr>ations/ESMF.shtml</a><br>
EXample 4 + numerous others.<br>
<br>
Good luck<br>
<br>
<br>
<br>
On Thu, Dec 1, 2016 at 2:17 PM, debasish mazumder <<a href="mailto:debasish@ucar.edu" target="_blank">debasish@ucar.edu</a><br></span><span class="">
<mailto:<a href="mailto:debasish@ucar.edu" target="_blank">debasish@ucar.edu</a>>> wrote:<br>
<br>
I tried with ESMF regridding but it is still slow. Any other suggestion?<br>
-Deb<br>
<br>
On 12/1/16 1:14 PM, Andrew Kren - NOAA Affiliate wrote:<br>
> I would try to use the NCL ESMF regridding tools, much faster and more<br>
> options<br>
><br>
> On Thu, Dec 1, 2016 at 1:12 PM, debasish mazumder <<a href="mailto:debasish@ucar.edu" target="_blank">debasish@ucar.edu</a> <mailto:<a href="mailto:debasish@ucar.edu" target="_blank">debasish@ucar.edu</a>><br></span><span class="">
> <mailto:<a href="mailto:debasish@ucar.edu" target="_blank">debasish@ucar.edu</a> <mailto:<a href="mailto:debasish@ucar.edu" target="_blank">debasish@ucar.edu</a>>>> wrote:<br>
><br>
> Hi All,<br>
><br>
> I am trying to interpolates data on a curvilinear grid to to a<br>
> rectilinear grid using rcm2rgrid.<br>
> Input data dimension is tmax(time = 12 months, y = 8075, x = 7814) and<br>
> lat2d(y = 8075, x = 7814), lon2d(y = 8075, x = 7814)<br>
><br>
> output lat(192) and lon(288)<br>
><br>
> tmaxi = rcm2rgrid(lat2d,lon2d,tmax,lat<wbr>,lon,0)<br>
><br>
> It took forever to perform the interpolation. Is there any faster way do<br>
> that.<br>
><br>
> with regards<br>
> -Deb<br>
> _____________________________<wbr>__________________<br>
> ncl-talk mailing list<br>
> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a> <mailto:<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br></span>
<mailto:<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a> <mailto:<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>>><span class=""><br>
> List instructions, subscriber options, unsubscribe:<br>
> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailm<wbr>an/listinfo/ncl-talk</a><br>
<<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailm<wbr>an/listinfo/ncl-talk</a>><br>
> <<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mail<wbr>man/listinfo/ncl-talk</a><br>
<<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailm<wbr>an/listinfo/ncl-talk</a>>><br>
><br>
><br>
><br>
><br>
> --<br>
> Andrew Kren, PhD<br>
> Research Scientist I, Global Observing Systems Analysis (GOSA) Group<br>
> NOAA ESRL Global Systems Division (Rm 3C515)<br>
> 325 Broadway, Boulder, CO 80305<br></span>
> <a href="tel:%28303%29%20497-5418" value="+13034975418" target="_blank">(303) 497-5418</a> <tel:%28303%29%20497-5418> <tel:%28303%29%20497-5418><br>
______________________________<wbr>_________________<br>
ncl-talk mailing list<span class=""><br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a> <mailto:<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailm<wbr>an/listinfo/ncl-talk</a>><br>
<br>
<br>
</span></blockquote>
</blockquote></div><br></div>