<div dir="ltr"><div class="gmail_default" style="font-size:small">To ncl-talk,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">This discussion was taken offline at the NCL workshop. The data being passed to the regridding routine was calculated incorrectly, and hence the regridded results were also incorrect.  The second issue was that the source lat/lon grid was not being defined properly.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">These issues were fixed and now the regridding is working as expected.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 8, 2016 at 9:30 PM, Adv <span dir="ltr">&lt;<a href="mailto:advita6@gmail.com" target="_blank">advita6@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi NCL users,<br></div>I have printed below the program I use to plot a figure attached here. I doubt whether the regrid function works or not? Because, the figure looks so weird. Could someone help me to fix this bug?<br><br></div>Thank you<br></div>Adv<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl&quot;<br>begin<br>;a = (/1,2,3,4,5,6,7,8/)<br>;a0 = onedtond(a,(/4,2/))<br>;print(a0)<br>;printVarSummary(a0)<br>;return<br>strll  = asciiread(&quot;stationmac.txt&quot;, -1, &quot;string&quot;) ;<br>  print(strll)   ; STATION&quot;,&quot;STATION_NAME&quot;, &quot;LAT&quot;, &quot;LON&quot;<br>  print(&quot;=====&quot;)<br><br>sloc = str_get_field(strll , 2, &quot;,&quot;)<br>  lat  = tofloat( str_get_field(strll , 3, &quot;,&quot;)  )<br>  lon  = tofloat( str_get_field(strll , 4, &quot;,&quot;)  )<br>  print(sloc +&quot; : &quot;+lat+&quot; &quot;+lon)<br>print(lon)<br>;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;<br>lonm=lon(0:389)<br>latm=lat(0:389)<br>;minlat=min(latm)<br>;minlon=min(lonm)<br>;maxlat=max(latm)<br>;****************<br>mlon = 390<br>dlon = -90.35 / mlon<br>lonn  = fspan (-116.1, (mlon - 1) * dlon, mlon)<br>mlat = 390<br>dlat = 49.0 / mlat<br>latt  = fspan (40.00, (mlat - 1) * dlat, mlat)<br>print(lonn)<br>minlat=min(latt)<br>minlon=min(lonn)<br>maxlat=max(latt)<br>maxlon=max(lonn)<br>diri=&quot;/home/dailysimms/prec-obs/&quot;<br>z1 = asciiread(diri+&quot;prec_avg_Jan-Dec1965-2005&quot;,-1,&quot;float&quot;)<br>print(z1)<br>printVarSummary(z1)<br>z0 = onedtond(z1,(/390,390/))<br>print(z0)<br>printVarSummary(z0)<br>z0!0=&quot;lat&quot;<br>z0!1=&quot;lon&quot;<br>z0&amp;lat=latm<br>z0&amp;lon=lonm<br>printVarSummary(z0)<br>;print(z0)<br>;print(min(z0)-min(z1))<br>;print(max(z0)-max(z1))<br>print(min(z0))<br>print(max(z0))<br>;ESMF REGRID *******************<br>;---Set up options for regridding to 0.1 degree grid<br>  Opt                 = True<br><br>  Opt@SrcGridLat      = latm<br>Opt@SrcGridLon      = lonm<br>;---If you don&#39;t set these two, the regridding will be VERY slow<br>  Opt@DstLLCorner     = (/floor(minlat)-0.1,floor(minlon)+0.1/)<br>  Opt@DstURCorner     = (/ ceil(maxlat)-0.1, ceil(maxlon)+0.1/)<br>  Opt@DstGridType     = &quot;0.1deg&quot;                ; destination grid<br>  Opt@ForceOverwrite  = True<br>;  Opt@SrcGridMask    = where(.not.ismissing(z0),1,0)<br><br>  Opt@Debug           = True<br>  Opt@InterpMethod    = &quot;bilinear&quot;<br>  pwv_regrid_p = ESMF_regrid(z0,Opt)<br>  printVarSummary(pwv_regrid_p)<br>;---Plotting section<br> wks = gsn_open_wks(&quot;pdf&quot;,&quot;ESMF_regrid&quot;)<br>gsn_define_colormap(wks,&quot;rainbow&quot;)             ; Change color map<br><br>;---Resources to share between both plots<br>    res                     = True              ; Plot modes desired.<br><br>    res@gsnMaximize         = True              ; Maximize plot<br><br>    res@gsnDraw             = False<br>    res@gsnFrame            = False<br><br>    res@cnFillOn            = True              ; color plot desired<br>    res@cnLinesOn           = False             ; turn off contour lines<br>    res@cnLineLabelsOn      = False             ; turn off contour labels<br>    res@cnFillMode          = &quot;RasterFill&quot;      ; turn raster on<br>;    res@cnLevelSelectionMode = &quot;ExplicitLevels&quot;<br>;    res@cnLevels             = ispan(270,300,2)<br>  res@mpFillOn                    = False<br>res@mpLimitMode           = &quot;LatLon&quot;<br>  res@mpMinLatF             =   40.<br>  res@mpMaxLatF             =   49.<br>res@mpMinLonF             = -116<br>  res@mpMaxLonF             =  -90.1<br> res@mpFillOn            = False<br><br>    res@trGridType          = &quot;TriangularMesh&quot;  ; allow missing coordinates<br>    res@gsnAddCyclic        = False<br><br>    res@lbLabelBarOn        = False<br><br>    res@gsnAddCyclic        = False<br>;---Draw US states in a light gray<br>  res@mpOutlineBoundarySets       = &quot;GeophysicalAndUSStates&quot;<br>  res@mpUSStateLineColor          = &quot;Gray10&quot;<br><br>  res@tiMainString                = &quot;GPS PWV (18Z) (original)&quot;<br>res@tiMainString  = &quot;Regridded to 0.1 deg using &#39;patch&#39;&quot;<br>  map_regrid_p = gsn_csm_contour_map(wks,pwv_regrid_p,res)<br>pres                    = True<br>  pres@gsnPanelLabelBar   = True<br> pres@pmLabelBarWidthF   = 0.7<br>  pres@gsnMaximize        = True<br>  pres@lbBoxLinesOn       = False<br>  pres@lbLabelFontHeightF = 0.01<br><br>  gsn_panel(wks,(/map_regrid_p/),(/1,1/),pres)<br>end<br><br></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">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/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>