<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Bian,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">There were three main issues with your script.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The first one I already mentioned. These two lines only cover half of the northern hemisphere:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><span class="m_5777174587484703520gmail-im" style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div class="gmail_default"><font face="monospace, monospace"> Opt@DstLLCorner = (/ 0.25d, 0.25d/)</font></div><div class="gmail_default"><font face="monospace, monospace"> Opt@DstURCorner = (/89.75d, 179.75d/)</font></div><div class="gmail_default"><br></div><div class="gmail_default">You need to change this to:</div><div class="gmail_default"><br></div></span><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div class="gmail_default"><font face="monospace, monospace"> Opt@DstLLCorner = (/ 0.25d, -180.00d/)</font></div><div class="gmail_default"><font face="monospace, monospace"> Opt@DstURCorner = (/89.75d, 179.75d</font>/)</div></div><br></div><div class="gmail_default" style="font-size:small">Second, since your swe2d variable has missing values in it, you need to specify these locations when you set SrcMaskGrid:</div><div class="gmail_default" style="font-size:small"><br></div><font face="monospace, monospace"> Opt@SrcMask2D = where(ismissing(lat2d).or.<wbr>ismissing(swe2d),0,1)</font><div><font face="monospace, monospace"><div class="gmail_default" style="font-size:small;display:inline"><br></div></font></div>Third, since your destination grid doesn't cover the whole globe, you need to set:<div><br><div><font face="monospace, monospace"> Opt@DstRegional = True<div class="gmail_default" style="font-size:small;display:inline"><span></span><div class="gmail_default" style="display:inline"></div></div></font></div><div><br><div class="gmail_default" style="display:inline"><p class="m_5777174587484703520gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><font face="arial, helvetica, sans-serif">I don't think the DstRegional is required in general, because your longitudes *do* wrap around the whole globe, but I don't think it hurts.</font></p><p class="m_5777174587484703520gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><font face="arial, helvetica, sans-serif"><br></font></p><p class="m_5777174587484703520gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><font face="arial, helvetica, sans-serif">I've included a modified version of your script and the image it produces. </font></p><p class="m_5777174587484703520gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><font face="arial, helvetica, sans-serif"><br></font></p><p class="m_5777174587484703520gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><font face="arial, helvetica, sans-serif">Let me know if you have any questions. I'm in a bit of a hurry, so I decided to just send this along without a lot of detail, but hopefully the script is self-explanatory.</font></p><p class="m_5777174587484703520gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><font face="arial, helvetica, sans-serif"><br></font></p><p class="m_5777174587484703520gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><font face="arial, helvetica, sans-serif">Regards,</font></p><p class="m_5777174587484703520gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><font face="arial, helvetica, sans-serif"><br></font></p><p class="m_5777174587484703520gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><font face="arial, helvetica, sans-serif">--Mary</font></p><p class="m_5777174587484703520gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><font face="arial, helvetica, sans-serif"><br></font></p></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 15, 2018 at 1:54 PM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>></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 style="font-size:small">Hi Bian,</div><div style="font-size:small"><br></div><div style="font-size:small">I'm looking into this.</div><div style="font-size:small"><br></div><div style="font-size:small">Meanwhile, I see that your original data goes from -180 to 180, but the lower left corner and upper right corner of the destination grid was set to:</div><div style="font-size:small"><br></div><div style="font-size:small"><span class=""><div><font face="monospace, monospace"> Opt@DstLLCorner = (/ 0.25d, 0.25d/)</font></div><div><font face="monospace, monospace"> Opt@DstURCorner = (/89.75d, 179.75d/)</font></div><div><br></div></span><div>This is restricting your data in the longitude direction to go from 0.25 and 179.75. Perhaps you meant for this to be:</div><div><br></div><div><div><font face="monospace, monospace"> Opt@DstLLCorner = (/ 0.25d, -180.00d/)</font></div><div><font face="monospace, monospace"> Opt@DstURCorner = (/89.75d, 179.75d</font>/)</div><div><br></div><div>However, this still doesn't fix the issue, so I'm looking into it further. I'm wondering if this is a missing value issue, because I noticed that your lat/lon has some missing values in it.</div><div><br></div><div>--Mary</div><div><br></div><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Thu, Mar 15, 2018 at 2:08 AM, Bian Qingyun <span dir="ltr"><<a href="mailto:bianqy@tea.ac.cn" target="_blank">bianqy@tea.ac.cn</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><span><p> </p>
<p>Hello,</p>
<p>I'm regridding AMSR-E L3 daily snow following the examples on NCL website <a href="http://www.ncl.ucar.edu/Applications/Scripts/ESMF_regrid_13.ncl" target="_blank">http://www.ncl.ucar.edu/Applic<wbr>ations/Scripts/ESMF_regrid_13.<wbr>ncl</a> and hdf website <a href="http://hdfeos.org/zoo/index_openNSIDC_Examples.php#AMSR_E" target="_blank">http://hdfeos.org/zoo/index_op<wbr>enNSIDC_Examples.php#AMSR_E</a>. </p>
<p>All is fine,but there are missing values along 90°E and 90°W after regridding while there are no missing values in original data along and near 90°E and 90°W 。</p>
</span><p>Below is my script. I also attached the AMSR-E data file in case.</p><div class="m_-1707253597578659555HOEnZb"><div class="m_-1707253597578659555h5">
<p>----------------------</p>
<p>----------------------</p>
<p>load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/esmf/ESMF_regridding.ncl"</p>
<p>begin<br>;-----read data<br> srcFileName = "AMSR_E_L3_DailySnow_V09_20100<wbr>311.hdf" ; Source file<br> eos_file = addfile(srcFileName + ".he2","r")<br> lon2d = eos_file->GridLon_Northern_Hem<wbr>isphere<br> lat2d = eos_file->GridLat_Northern_Hem<wbr>isphere<br> ; Process NAN (1e51) fillValue for LAMAZ geolocation.<br> lon2d=where(lon2d .gt. 1000, -999.0, lon2d)<br> lat2d=where(lat2d .gt. 1000, -999.0, lat2d)<br> <a href="mailto:lon2d@_FillValue" target="_blank">lon2d@_FillValue</a> = -999.0<br> <a href="mailto:lat2d@_FillValue" target="_blank">lat2d@_FillValue</a> = -999.0</p>
<p><br> hdf_file = addfile(srcFileName, "r")<br> ; Read the dataset.<br> hdf_data = hdf_file->SWE_NorthernDaily</p>
<p> ; Filter out invalid range values.<br> ; See "Table 2. Pixel Values ofr the SWE Feids" from [2].<br> hdf_data = where(hdf_data .gt. 240, <a href="mailto:hdf_data@_FillValue" target="_blank">hdf_data@_FillValue</a>, hdf_data)</p>
<p> ; Prepare data for plotting by converting type.<br> swe2d = tofloat(hdf_data)<br> <a href="mailto:swe2d@_FillValue" target="_blank">swe2d@_FillValue</a> = tofloat(<a href="mailto:hdf_data@_FillValue" target="_blank">hdf_data@_FillValue</a>)</p>
<p> ; Multiply by two according to data spec [2].<br> swe2d = 2 * swe2d</p>
<p> ; You can get the description of data set from the data spec [2].<br> <a href="mailto:swe2d@long_name" target="_blank">swe2d@long_name</a> = "Northern Hemisphere 5-day Snow Water Equivalent ~C~ (" + <a href="mailto:hdf_data@hdf_name" target="_blank">hdf_data@hdf_name</a> + ")"<br> <a href="mailto:swe2d@units" target="_blank">swe2d@units</a> = "mm"<br> ; Associate data with lat/lon.<br> <a href="mailto:swe2d@lon2d" target="_blank">swe2d@lon2d</a> = lon2d<br> <a href="mailto:swe2d@lat2d" target="_blank">swe2d@lat2d</a> = lat2d</p>
<p>;-----ESMF regridding<br> Opt = True ; Options for regridding</p>
<p> <a href="mailto:Opt@SrcFileName" target="_blank">Opt@SrcFileName</a> = "EASE_SCRIP.nc" ; Output files<br> <a href="mailto:Opt@DstFileName" target="_blank">Opt@DstFileName</a> = "NH_SCRIP.nc"<br> <a href="mailto:Opt@WgtFileName" target="_blank">Opt@WgtFileName</a> = "EASE_2_NH_patch.nc"<br> <a href="mailto:Opt@ForceOverwrite" target="_blank">Opt@ForceOverwrite</a> = True<br> <a href="mailto:Opt@SrcMask2D" target="_blank">Opt@SrcMask2D</a> = where(ismissing(lat2d),0,1)<br> <a href="mailto:Opt@SrcGridLat" target="_blank">Opt@SrcGridLat</a> = lat2d<br> <a href="mailto:Opt@SrcGridLon" target="_blank">Opt@SrcGridLon</a> = lon2d</p>
<p> <a href="mailto:Opt@DstGridType" target="_blank">Opt@DstGridType</a> = "0.25deg" ; Destination grid<br> <a href="mailto:Opt@DstTitle" target="_blank">Opt@DstTitle</a> = "Northern Hemisphere 0.25 resolution"<br> <a href="mailto:Opt@DstLLCorner" target="_blank">Opt@DstLLCorner</a> = (/ 0.25d, 0.25d/)<br> <a href="mailto:Opt@DstURCorner" target="_blank">Opt@DstURCorner</a> = (/89.75d, 179.75d/)</p>
<p> <a href="mailto:Opt@InterpMethod" target="_blank">Opt@InterpMethod</a> = "bilinear" ; Careful! Patch method takes a long time</p>
<p> <a href="mailto:Opt@Debug" target="_blank">Opt@Debug</a> = True</p>
<p> swe_regrid = ESMF_regrid(swe2d,Opt) ; Regrid swe<br> printVarSummary(swe_regrid)</p>
<p>;-----------------------------<wbr>------------------------------<wbr>-----------<br>; Plotting section<br>;-----------------------------<wbr>------------------------------<wbr>-----------<br> wks = gsn_open_wks("x11","ESMF_regri<wbr>d") ; send graphics to PNG file</p>
<p> res = True ; Plot mods desired.<br> <a href="mailto:res@gsnMaximize" target="_blank">res@gsnMaximize</a> = True ; Maximize plot</p>
<p> <a href="mailto:res@gsnDraw" target="_blank">res@gsnDraw</a> = False<br> <a href="mailto:res@gsnFrame" target="_blank">res@gsnFrame</a> = False</p>
<p> <a href="mailto:res@cnFillOn" target="_blank">res@cnFillOn</a> = True ; color plot desired<br> <a href="mailto:res@cnFillPalette" target="_blank">res@cnFillPalette</a> = "amwg" ; set color map<br> <a href="mailto:res@cnLinesOn" target="_blank">res@cnLinesOn</a> = False ; turn off contour lines<br> <a href="mailto:res@cnLineLabelsOn" target="_blank">res@cnLineLabelsOn</a> = False ; turn off contour labels<br> <a href="mailto:res@cnFillMode" target="_blank">res@cnFillMode</a> = "RasterFill" ; turn raster on</p>
<p> <a href="mailto:res@cnLevelSelectionMode" target="_blank">res@cnLevelSelectionMode</a>= "ExplicitLevels" ; set explicit contour levels<br> <a href="mailto:res@cnLevels" target="_blank">res@cnLevels</a> = (/-300,-250,-200,-150,-100, \<br> <wbr> 0,1,5,10,25,100,200,300,400/)</p>
<p> <a href="mailto:res@lbLabelBarOn" target="_blank">res@lbLabelBarOn</a> = False ; turn on in panel</p>
<p> <a href="mailto:res@trGridType" target="_blank">res@trGridType</a> = "TriangularMesh" ; allow missing coordinates</p>
<p><br> <a href="mailto:res@gsnPolar" target="_blank">res@gsnPolar</a> = "NH" ; specify the hemisphere<br> <a href="mailto:res@mpMinLatF" target="_blank">res@mpMinLatF</a> = 35</p>
<p>;---Plot original data.<br> <a href="mailto:res@gsnAddCyclic" target="_blank">res@gsnAddCyclic</a> = False<br> <a href="mailto:res@sfXArray" target="_blank">res@sfXArray</a> = lon2d<br> <a href="mailto:res@sfYArray" target="_blank">res@sfYArray</a> = lat2d<br> <a href="mailto:res@tiMainString" target="_blank">res@tiMainString</a> = "Original EASE grid (" + str_join(dimsizes(lat2d),",") + ")"<br> <a href="mailto:res@trGridType" target="_blank">res@trGridType</a> = "TriangularMesh"<br> <a href="mailto:res@cnFillMode" target="_blank">res@cnFillMode</a> = "RasterFill"</p>
<p> plot_orig = gsn_csm_contour_map_polar(wks,<wbr>swe2d,res)</p>
<p> delete(<a href="mailto:res@sfXArray" target="_blank">res@sfXArray</a>)<br> delete(<a href="mailto:res@sfYArray" target="_blank">res@sfYArray</a>)</p>
<p>;---Plot regridded data.<br> <a href="mailto:res@gsnAddCyclic" target="_blank">res@gsnAddCyclic</a> = True</p>
<p> dims = tostring(dimsizes(swe_regrid))<br> <a href="mailto:res@tiMainString" target="_blank">res@tiMainString</a> = "Regridded to 0.25 degree grid (" + \<br> str_join(dims," x ") + ")"</p>
<p> plot_regrid = gsn_csm_contour_map_polar(wks,<wbr>swe_regrid,res)</p>
<p>;---Compare the plots in a panel<br> pres = True<br> <a href="mailto:pres@gsnMaximize" target="_blank">pres@gsnMaximize</a> = True<br> <a href="mailto:pres@gsnPanelLabelBar" target="_blank">pres@gsnPanelLabelBar</a> = True<br> <a href="mailto:pres@lbLabelFontHeightF" target="_blank">pres@lbLabelFontHeightF</a> = 0.01<br> <a href="mailto:pres@pmLabelBarWidthF" target="_blank">pres@pmLabelBarWidthF</a> = 0.8</p>
<p> gsn_panel(wks,(/plot_orig,plot<wbr>_regrid/),(/1,2/),pres)<br>end</p>
<p>---------------------------</p>
<p>---------------------------</p>
<p>Any suggestions are appreciated! Thank you!</p>
<p>Best,</p>
<p>Qingyun</p>
<p> </p></div></div><br></div></div>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<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>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div>