<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Chris,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You were almost there.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The issue is that you are subsetting your data by selecting a lat/lon area of interest, but then trying to plot this data using the projection defined for the original data. When you set the "tfDoNDCOverlay" resource to True, this signals to NCL that you are plotting data in its "native" projection, and hence you need to set the map parameters exactly right for the data you are plotting.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">If you are plotting the original data (see narr_plot.ncl), then you can use the map projection parameters on the file to plot the data. This script shows how to plot the data on both a cylindrical equidistant projection using the 2D lat/lon arrays read off the file, and in the native projection using map projection information attached to the lat/lon arrays. I've attached the PNGs from this script.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">If you want to zoom in on the data, then unless you know the exact projection parameters for the zoomed data, you will have to subset the 2D lat/lon arrays in the same fashion as the data, and use these for plotting.  See the attached narr_plot_zoom.ncl and image.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Finally, I took your original script and applied the same concepts I used in narr_plot_zoom.ncl. Instead of using tfDoOverlay, it uses the subsetted lat/lon arrays to get the overlay correct:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><div class="gmail_default" style="font-size:small">  res@sfXArray               = lon2d_small</div><div class="gmail_default" style="font-size:small">  res@sfYArray               = lat2d_small</div><div style="font-size:small"><br></div><div style="font-size:small">Note that in narr_plot_zoom.ncl, I didn't use sfXArray / sfYArray.  Instead, I used:</div><div style="font-size:small"><br></div><div><div>  var_subset@lat2d = lat_subset                                 </div><div>  var_subset@lon2d = lon_subset</div><div style="font-size:small"><br></div></div><div style="font-size:small">These are essentially the same thing. I was just lazy and didn't want to have to attach the special "lat2d" and "lon2d" attributes to every variable being plotted.</div><div style="font-size:small"><br></div><div style="font-size:small">For more descriptive information on all this, you may want to visit our "plotting data on a map" page:</div><div style="font-size:small"><br></div><div><a href="http://www.ncl.ucar.edu/Applications/plot_data_on_map.shtml">http://www.ncl.ucar.edu/Applications/plot_data_on_map.shtml</a><br></div><div><br></div><div>Let me know if you have any questions about what I did.</div><div><br></div><div>--Mary</div><div><br></div><div style="font-size:small"><br></div><div style="font-size:small"><br></div><div style="font-size:small"><br></div></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 27, 2018 at 3:02 PM, Herbster, Christopher G. <span dir="ltr"><<a href="mailto:herbstec@erau.edu" target="_blank">herbstec@erau.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="m_4321895138347317005WordSection1">
<p class="MsoNormal">Hi folks,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Here is a sequence of events that we are using to download some NARR data from NOMADS at NCDC:<u></u><u></u></p>
<p class="MsoNormal">We use the <a href="http://get-httpsubset.pl" target="_blank">get-httpsubset.pl</a> script from<u></u><u></u></p>
<p class="MsoNormal"><a href="https://nomads.ncdc.noaa.gov/guide/index.php?name=advanced#adv-httpsubset" target="_blank">https://nomads.ncdc.noaa.gov/<wbr>guide/index.php?name=advanced#<wbr>adv-httpsubset</a> and the Perl scripts from<u></u><u></u></p>
<p class="MsoNormal"><a href="http://www.cpc.ncep.noaa.gov/products/wesley/fast_downloading_grib.html" target="_blank">http://www.cpc.ncep.noaa.gov/<wbr>products/wesley/fast_<wbr>downloading_grib.html</a> to grab a handful of parameters from the NARR dataset.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">This gives us GRIB files like: <u></u><u></u></p>
<p class="MsoNormal"><a href="http://wx.erau.edu/faculty/herbster/demo/.hidden/NCL/narr-a_221_20101201_1200_000.sub.grb" target="_blank">http://wx.erau.edu/faculty/<wbr>herbster/demo/.hidden/NCL/<wbr>narr-a_221_20101201_1200_000.<wbr>sub.grb</a>
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I then used: ncl_convert2nc narr-a_221_20101201_1200_000.<wbr>sub.grb -nc4c -l<u></u><u></u></p>
<p class="MsoNormal">To make <u></u><u></u></p>
<p class="MsoNormal"><a href="http://wx.erau.edu/faculty/herbster/demo/.hidden/NCL/narr-a_221_20101201_1200_000.sub.nc4" target="_blank">http://wx.erau.edu/faculty/<wbr>herbster/demo/.hidden/NCL/<wbr>narr-a_221_20101201_1200_000.<wbr>sub.nc4</a>
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I did this for 30 years of data ending 12-31-2010.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">We then used an NCL script to do some calculations on a month of data, and write the results into a new file.<u></u><u></u></p>
<p class="MsoNormal">Here is the script:<u></u><u></u></p>
<p class="MsoNormal"><a href="http://wx.erau.edu/faculty/herbster/demo/.hidden/NCL/read_narr_ncar-help.ncl" target="_blank">http://wx.erau.edu/faculty/<wbr>herbster/demo/.hidden/NCL/<wbr>read_narr_ncar-help.ncl</a>
<u></u><u></u></p>
<p class="MsoNormal">My apologies to those of you who actually know how to code in NCL.  I am strictly an amateur at this.
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Here is the file we created: <u></u><u></u></p>
<p class="MsoNormal"><a href="http://wx.erau.edu/faculty/herbster/demo/.hidden/NCL/D-Value_Monthly_Stats.2010.12.averages.1200.nc" target="_blank">http://wx.erau.edu/faculty/<wbr>herbster/demo/.hidden/NCL/D-<wbr>Value_Monthly_Stats.2010.12.<wbr>averages.1200.nc</a>
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Our problem seems to be aligning the data to the map background, as I can show with the following images:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">The grey area in this image is supposed to be where the terrain is higher than the calculated value:<u></u><u></u></p>
<p class="MsoNormal"><a href="http://wx.erau.edu/faculty/herbster/demo/.hidden/NCL/narr-paper.000001.png" target="_blank">http://wx.erau.edu/faculty/<wbr>herbster/demo/.hidden/NCL/<wbr>narr-paper.000001.png</a>
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">The data mask area is too far to the west, even extending out over the ocean.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">When we plot it in the Unidata IDV we get what we expect:<u></u><u></u></p>
<p class="MsoNormal"><a href="http://wx.erau.edu/faculty/herbster/demo/.hidden/NCL/IDV_4K_Mask_D-Val.png" target="_blank">http://wx.erau.edu/faculty/<wbr>herbster/demo/.hidden/NCL/IDV_<wbr>4K_Mask_D-Val.png</a>
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Then we decided to try plotting it in Matlab as another test.  We got:
<u></u><u></u></p>
<p class="MsoNormal"><a href="http://wx.erau.edu/faculty/herbster/demo/.hidden/NCL/Matlab_Plot_NARR_Mask.jpg" target="_blank">http://wx.erau.edu/faculty/<wbr>herbster/demo/.hidden/NCL/<wbr>Matlab_Plot_NARR_Mask.jpg</a>
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">While I suspect that I am not doing something properly with the mapping of the data, I am also wondering about the results of making the NetCDF file from the ncl_convert command.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">First, is the compression lossy?  I realized that the default compression is zero, so this step did not do much for disk space!  (Actually made bigger files, but never mind.)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">When I load the original GRIB file into the IDV it displays the region properly without any problem.  When I try to load the original NetCDF file, the IDV does not seem to know the geographic region of the data. 
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">This can be seen in the following images:<u></u><u></u></p>
<p class="MsoNormal"><a href="http://wx.erau.edu/faculty/herbster/demo/.hidden/NCL/load-both-idv.png" target="_blank">http://wx.erau.edu/faculty/<wbr>herbster/demo/.hidden/NCL/<wbr>load-both-idv.png</a> shows the Mean Sea Level Pressure data from both files.  They appear to match. 
 However, when I added the second panel (NetCDF file), the IDV did not display the data properly, and did so only after I selected a predefined CONUS projection (as shown).<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">When I open the NetCDF file and plotted MSLP in a window by itself, I got this:<u></u><u></u></p>
<p class="MsoNormal"><a href="http://wx.erau.edu/faculty/herbster/demo/.hidden/NCL/load-netcdf-idv.png" target="_blank">http://wx.erau.edu/faculty/<wbr>herbster/demo/.hidden/NCL/<wbr>load-netcdf-idv.png</a>
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I had to zoom way out to display this data.  It knows where to put the data, but the IDV thinks the data should be in the white box area, I think.  (I’m not really sure about this interpretation.)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">The questions I have are:<u></u><u></u></p>
<p class="m_4321895138347317005MsoListParagraph"><u></u><span>1)<span style="font:7.0pt "Times New Roman"">     
</span></span><u></u>Why does this happen?<u></u><u></u></p>
<p class="m_4321895138347317005MsoListParagraph"><u></u><span>2)<span style="font:7.0pt "Times New Roman"">     
</span></span><u></u>Is this related to my data masking and mapping problem, or are they separate issues?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks in advance for any help on any of these problems/questions.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Cheers,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Chris <u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">PS  If you want to test our script, there is a month of data in this tar file:<u></u><u></u></p>
<p class="MsoNormal"><a href="http://wx.erau.edu/faculty/herbster/demo/.hidden/NCL/sample-narr.tgz" target="_blank">http://wx.erau.edu/faculty/<wbr>herbster/demo/.hidden/NCL/<wbr>sample-narr.tgz</a>
<u></u><u></u></p>
<p class="MsoNormal">-- <u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Dr. Christopher G. Herbster<u></u><u></u></p>
<p class="MsoNormal">Associate Professor<u></u><u></u></p>
<p class="MsoNormal">Director of Science and Technology<u></u><u></u></p>
<p class="MsoNormal">for the ERAU Weather Center<u></u><u></u></p>
<p class="MsoNormal">Applied Aviation Sciences<u></u><u></u></p>
<p class="MsoNormal">Embry-Riddle Aeronautical Univ.<u></u><u></u></p>
<p class="MsoNormal">600 S. Clyde Morris Blvd.<u></u><u></u></p>
<p class="MsoNormal">Daytona Beach, FL 32114-3900<u></u><u></u></p>
<p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal"> <a href="tel:(386)%20226-6444" value="+13862266444" target="_blank">386.226.6444</a> Office<u></u><u></u></p>
<p class="MsoNormal"><a href="tel:(386)%20226-6446" value="+13862266446" target="_blank">386.226.6446</a> Weather Center<u></u><u></u></p>
<p class="MsoNormal"><a href="http://wx.erau.edu/" target="_blank">http://wx.erau.edu/</a><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Schedule at:  <a href="http://wx.erau.edu/faculty/herbster/Schedules/" target="_blank">http://wx.erau.edu/faculty/<wbr>herbster/Schedules/</a><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>

<br>______________________________<wbr>_________________<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/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>