<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 &amp; 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 &gt; 2GB. This requires using netCDF-4.  The following option does this:<br><br>    Opt@NetCDFType  = &quot;netcdf4&quot;   ; 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>%&gt; cd /some/directory/of/yours<br><div>%&gt; 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-&gt;tmax            ; (time, y, x )     <br>    printVarSummary(var)        ; [time |  ] x [y | 8075] x [x | 7814]<br><br><br></div><div>    wgtFilePath = &quot;/some/directory/of/yours/WGT_daymet2Rect_bilinear.nc&quot;</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">&lt;<a href="mailto:debasish@ucar.edu" target="_blank">debasish@ucar.edu</a>&gt;</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: &#39;ESMF_RegridWeightGen&#39; was not successful.<br>
<br>
with regards<br>
-Deb<br>
<br>
Here is my scripts<br>
<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/gsn_code.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/gsn_csm.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/contributed.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/esmf/ESMF_regridding.ncl&quot;<br>
<br>
begin<br>
;---Read data off source file<br>
srcFileName = &quot;daymet_v3_tmax_monavg_1980_na<wbr>.nc4&quot;<br>
sfile       = addfile(srcFileName,&quot;r&quot;)<br>
    madis       = sfile-&gt;tmax(0,:,:)<br>
    madis@lat2d = sfile-&gt;lat<br>
    madis@lon2d = sfile-&gt;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(&quot;/glade/scratch/debasi<wbr>sh/CCSM4/CCSM4_T2_1958.nc&quot;,&quot;r&quot;<wbr>)<br>
    lat   = dfile-&gt;lat    ; Need these for coordinate arrays<br>
    lon   = dfile-&gt;lon    ; for regridding<br>
    lon = where(lon.gt.180,lon-360,lon)<br>
<br>
    ;---Options for regridding<br>
    Opt                 = True<br>
<br>
    Opt@SrcFileName     = &quot;AusSnow_src_SCRIP.nc&quot;<br>
    Opt@DstFileName     = &quot;AusSnow_dst_SCRIP.nc&quot;<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        = &quot;Australia Rectilinear Grid&quot; ; destination grid<br>
    Opt@DstGridLat      = lat<br>
    Opt@DstGridLon      = lon<br>
    Opt@DstRegional     = True<br>
<br>
    ;;Opt@PrintTimings  = True<br>
<br>
    Opt@InterpMethod = &quot;bilinear&quot;<br>
<br>
   Opt@WgtFileName  = &quot;AUS_Swath_2_Rect_bilinear.nc&quot;<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 &lt;<a href="mailto:debasish@ucar.edu" target="_blank">debasish@ucar.edu</a><br></span><span class="">
&lt;mailto:<a href="mailto:debasish@ucar.edu" target="_blank">debasish@ucar.edu</a>&gt;&gt; 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>
    &gt; I would try to use the NCL ESMF regridding tools, much faster and more<br>
    &gt; options<br>
    &gt;<br>
    &gt; On Thu, Dec 1, 2016 at 1:12 PM, debasish mazumder &lt;<a href="mailto:debasish@ucar.edu" target="_blank">debasish@ucar.edu</a> &lt;mailto:<a href="mailto:debasish@ucar.edu" target="_blank">debasish@ucar.edu</a>&gt;<br></span><span class="">
    &gt; &lt;mailto:<a href="mailto:debasish@ucar.edu" target="_blank">debasish@ucar.edu</a> &lt;mailto:<a href="mailto:debasish@ucar.edu" target="_blank">debasish@ucar.edu</a>&gt;&gt;&gt; wrote:<br>
    &gt;<br>
    &gt;     Hi All,<br>
    &gt;<br>
    &gt;     I am trying to interpolates data on a curvilinear grid to to a<br>
    &gt;     rectilinear grid using rcm2rgrid.<br>
    &gt;     Input data dimension is tmax(time = 12 months, y = 8075, x = 7814) and<br>
    &gt;     lat2d(y = 8075, x = 7814), lon2d(y = 8075, x = 7814)<br>
    &gt;<br>
    &gt;     output lat(192) and lon(288)<br>
    &gt;<br>
    &gt;     tmaxi  = rcm2rgrid(lat2d,lon2d,tmax,lat<wbr>,lon,0)<br>
    &gt;<br>
    &gt;     It took forever to perform the interpolation. Is there any faster way do<br>
    &gt;     that.<br>
    &gt;<br>
    &gt;     with regards<br>
    &gt;     -Deb<br>
    &gt;     _____________________________<wbr>__________________<br>
    &gt;     ncl-talk mailing list<br>
    &gt;     <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a> &lt;mailto:<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>&gt;<br></span>
    &lt;mailto:<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a> &lt;mailto:<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>&gt;&gt;<span class=""><br>
    &gt;     List instructions, subscriber options, unsubscribe:<br>
    &gt;     <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>
    &lt;<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>&gt;<br>
    &gt;     &lt;<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>
    &lt;<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>&gt;&gt;<br>
    &gt;<br>
    &gt;<br>
    &gt;<br>
    &gt;<br>
    &gt; --<br>
    &gt; Andrew Kren, PhD<br>
    &gt; Research Scientist I, Global Observing Systems Analysis (GOSA) Group<br>
    &gt; NOAA ESRL Global Systems Division (Rm 3C515)<br>
    &gt; 325 Broadway, Boulder, CO 80305<br></span>
    &gt; <a href="tel:%28303%29%20497-5418" value="+13034975418" target="_blank">(303) 497-5418</a> &lt;tel:%28303%29%20497-5418&gt; &lt;tel:%28303%29%20497-5418&gt;<br>
    ______________________________<wbr>_________________<br>
    ncl-talk mailing list<span class=""><br>
    <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a> &lt;mailto:<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>&gt;<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>
    &lt;<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>&gt;<br>
<br>
<br>
</span></blockquote>
</blockquote></div><br></div>