<div dir="ltr"><div><div>Never mind - It works now. <br><br></div>Thanks again for your help!<br><br></div>Sean<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 8, 2016 at 10:42 AM, Sean Egan <span dir="ltr"><<a href="mailto:sdegan@alaska.edu" target="_blank">sdegan@alaska.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><div>To add:<br><br></div>It seems that your suggestions helped, Mary. The values do seem to plot correctly (as long as tfDoNDCOverlay is set to False).<br><br></div><div>But I cannot seem to get the plot to overlay on top of the map. As soon as the contour is drawn, the map gets overwritten. I have set gsnDraw and gsnFrame to False...<span class="HOEnZb"><font color="#888888"><br><br></font></span></div><span class="HOEnZb"><font color="#888888"><div>Sean <br></div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 8, 2016 at 8:54 AM, Sean Egan <span dir="ltr"><<a href="mailto:sdegan@alaska.edu" target="_blank">sdegan@alaska.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><div><div><div><div><div><div>Hi Mary,<br><br></div>Thanks for the tips. Sorry about the typo - the NN shouldn't proceed the ash variable. I've attached (and copy/pasted) the script as well as the variable summaries to this e-mail. If you would like to look at the HDF file, you can download it by connecting via FTP to <a href="http://emc2.iarc.uaf.edu" target="_blank">emc2.iarc.uaf.edu</a> with username set to anonymous. No password is required. The file is named file1.hdf. <br><br></div>Thanks,<br></div>Sean<br><br>------------------------------<wbr>---<br></div>VARIABLE SUMMARIES<br>------------------------------<wbr>---<br><br><span style="font-size:12.8px">ncl 61> printVarSummary(ash)<br><br>Variable: ash<br>Type: float<br>Total Size: 13363200 bytes<br> 3340800 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [lines | 900] x [elements | 3712]<br>Coordinates: <br>Number Of Attributes: 10<br> algorithm_name : VOLCAT volcanic ash retrieval<br> algorithm_version : none<br> algorithm_index : 10<br> reference : Pavolonis and Heidinger<br> units : none<br> scaling_method : 0<br> scale_factor : 1<br> add_offset : 0<br> _FillValue : -999<br> hdf_name : volcld_ret_14_15_16_ash_mass_l<wbr>oading<br><br>ncl 62> printVarSummary(latN)<br><br>Variable: latN<br>Type: float<br>Total Size: 13363200 bytes<br> 3340800 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [900] x [3712]<br>Coordinates: <br>Number Of Attributes: 1<br> _FillValue : -32768<br><br></span><br><span style="font-size:12.8px">ncl 63> printVarSummary(lonN)<br><br>Variable: lonN<br>Type: float<br>Total Size: 13363200 bytes<br> 3340800 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [900] x [3712]<br>Coordinates: <br>Number Of Attributes: 1<br> _FillValue : -32768<br><br>------------------------------<wbr>---<br></span></div><span style="font-size:12.8px">MAX AND MIN VALUES<br>------------------------------<wbr>---<br><br>ncl 64> printMinMax(ash,0)<br>(0) min=0 max=4.58412<br><br><br>ncl 65> printMinMax(latN,0)<br>(0) min=27.5848 max=81.2629<br><br>ncl 66> printMinMax(lonN,0) <br>(0) min=-79.6368 max=79.6368<br><br>---------------------------<br></span></div><span style="font-size:12.8px">START OF SCRIPT<br>---------------------------<span><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/wrf/WRFUserARW.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/contributed.ncl"<br><br></span><span>a = addfile("file1.hdf","r")<br><br></span><span>wks=gsn_open_wks("x11","testin<wbr>g")<br><br>latS = a->pixel_latitude<br>latN = latS * 0.002746665852839747<br>lonS = a->pixel_longitude<br>lonN = lonS * 0.005493331705679495<br>ash = a->volcld_ret_14_15_16_ash_mas<wbr>s_loading<br><br>b = addfile("wrfout_d01_2010-04-16<wbr>_00:00:00","r")<br><br></span><span>gsn_define_colormap(wks,"WhBlG<wbr>rYeRe")<br>res = True<br>res@gsnMaximize = False<br>res@gsnDraw = False ; Turn off for now.<br>res@gsnFrame = False ; Will draw later<br>res@tiMainOn = False<br><br>mpres <wbr> = res<br></span>mpres <wbr> = wrf_map_resources(b,mpres)<span><br>mpres@mpOutlineBoundarySets <wbr> = "GeophysicalAndUSStates"<br>mpres@mpFillOn <wbr> = False<br>mpres@mpOutlineOn <wbr> = True<br>mpres@mpCountyLineThicknessF <wbr> = 2.5<br>mpres@mpGeophysicalLineThickne<wbr>ssF = 2.5<br>mpres@mpNationalLineThicknessF<wbr> = 2.5<br>mpres@mpProvincialLineThicknes<wbr>sF = 2.5<br>mpres@mpUSStateLineThicknessF <wbr> = 2.5<br>mpres@mpCountyLineColor <wbr> = "Black"<br>mpres@mpGeophysicalLineColor <wbr> = "Black"<br>mpres@mpNationalLineColor <wbr> = "Black"<br>mpres@mpUSStateLineColor <wbr> = "Black"<br><br>cnres = res<br>cnres@tfDoNDCOverlay = False ; Testing<br>cnres@cnFillOn = True<br>cnres@lbLabelBarOn = True<br>cnres@cnLinesOn = False<br>cnres@lbOrientation = "Vertical"<br></span><span>cnres@sfXArray = lonN<br>cnres@sfYArray = latN<br></span><span>cnres@cnLevelSelectionMode = "ManualLevels"<br>cnres@cnFillMode = "RasterFill"<br>cnres@cnRasterSmoothingOn = False<br>cnres@cnFillOpacityF = 0.75<br>cnres@cnMinLevelValF = 0.<br>cnres@cnMaxLevelValF = 2.0<br>cnres@cnLevelSpacingF = 0.05<br><br>map = gsn_csm_map(wks,mpres)<br></span>ash_contour = gsn_csm_contour(wks,ash,cnres)<br><br>overlay(map,ash_contour)<br>draw(map)<br>frame(wks)<br><br>end<br><br>-------------------------<br></span></div><span style="font-size:12.8px">SCRIPT ERRORS<br>-------------------------<br><br>pacman13 % ncl testing.ncl <br> Copyright (C) 1995-2013 - All Rights Reserved<br> University Corporation for Atmospheric Research<br> NCAR Command Language Version 6.1.2<br> The use of this software is governed by a License Agreement.<br> See <a href="http://www.ncl.ucar.edu/" target="_blank">http://www.ncl.ucar.edu/</a> for more details.<br>warning:mpNestTime is not a valid resource in map at this time<br>warning:start_lat is not a valid resource in map at this time<br>warning:start_lon is not a valid resource in map at this time<br>warning:end_lat is not a valid resource in map at this time<br>warning:end_lon is not a valid resource in map at this time<br><br><br></span></div><div class="gmail_extra"><div><div><br><div class="gmail_quote">On Thu, Sep 8, 2016 at 8:19 AM, 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 class="gmail_default" style="font-size:small">Sean,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">First, I recommend using "wrf_map_resources" to set the necessary WRF map resources for you. This will allow you to get rid of all this code:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><span><div class="gmail_default" style="font-size:small">mpres@mpProjection = "LambertConformal"</div><div class="gmail_default" style="font-size:small">mpres@mpLimitMode = "Corners"</div><div class="gmail_default" style="font-size:small">mpres@mpLeftCornerLatF = lat(0,0)</div><div class="gmail_default" style="font-size:small">mpres@mpLeftCornerLonF = lon(0,0)</div><div class="gmail_default" style="font-size:small">mpres@mpRightCornerLatF = lat(nlat-1,nlon-1)</div><div class="gmail_default" style="font-size:small">mpres@mpRightCornerLonF = lon(nlat-1,nlon-1)</div><div class="gmail_default" style="font-size:small">mpres@mpLambertParallel1F = b@TRUELAT1</div><div class="gmail_default" style="font-size:small">mpres@mpLambertParallel2F = b@TRUELAT2</div><div class="gmail_default" style="font-size:small">mpres@mpLambertMeridianF = b@STAND_LON</div><div class="gmail_default" style="font-size:small">mpres@mpDataBaseVersion = "MediumRes"</div><div class="gmail_default" style="font-size:small"><br></div></span><div class="gmail_default" style="font-size:small">and replace it with one line:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">mpres = wrf_map_resources(b,mpres)</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The other resources you are setting:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><span><div class="gmail_default">mpres@mpOutlineBoundarySets = "GeophysicalAndUSStates"</div><div class="gmail_default">mpres@mpFillOn = False</div><div class="gmail_default">mpres@mpOutlineOn = True</div><div class="gmail_default">mpres@mpCountyLineThicknessF = 2.5</div><div class="gmail_default">mpres@mpGeophysicalLineThickne<wbr>ssF = 2.5</div><div class="gmail_default">mpres@mpNationalLineThicknessF = 2.5</div><div class="gmail_default">mpres@mpProvincialLineThicknes<wbr>sF = 2.5</div><div class="gmail_default">mpres@mpUSStateLineThicknessF = 2.5</div><div class="gmail_default">mpres@mpCountyLineColor = "Black"</div><div class="gmail_default">mpres@mpGeophysicalLineColor = "Black"</div><div class="gmail_default">mpres@mpNationalLineColor = "Black"</div><div class="gmail_default">mpres@mpUSStateLineColor = "Black"</div><div class="gmail_default"><br></div></span><div class="gmail_default">are also set by "wrf_map_resources", but since you are using different values than what wrf_map_resources uses, I recommend leaving these alone. Just make sure you set all these resources *after* you call wrf_map_resources. You can always do a "print(mpres)" after you call wrf_map_resources to see exactly what values it is setting for you.</div><div class="gmail_default"><br></div></div><div class="gmail_default" style="font-size:small">As for the "ash" array you are trying to plot: please look at your latN and lonN arrays to make sure they look correct, and that they in "degrees" units. That is, the lat values should range from -90 to 90, and the longitude values from -180 to 180 or 0 to 360:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"> printMinMax(latN,0)</div><div class="gmail_default" style="font-size:small"> printMinMax(lonN,0)</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You have the sfXArray and sfYArray arrays set correctly, but you do NOT want to set this:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px">cnres@sfDataArray = ash </span></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You also do not need this, because the gsn_csm_contour function will set it for you:</div><div class="gmail_default"><br><span style="font-size:12.8px">cnres@sfMissingValueV = ash@_FillValue</span><br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I'm not sure if this is a typo:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px">ash_contour = gsn_csm_contour(wks,ashNN,</span><span style="font-size:12.8px">cnre<wbr>s)</span><br style="font-size:12.8px"></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px"><br></span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px">but shouldn't "asnNN" be "ash"?</span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px"><br></span></div><div class="gmail_default"><span style="font-size:12.8px">Finally, you want to be sure that "ash" doesn't already have some kind of coordinate arrays attached to it.</span></div><div class="gmail_default"><span style="font-size:12.8px"><br></span></div><div class="gmail_default"><span style="font-size:12.8px">If you continue to have problems, it would really help if we could get the latest version of your script and your data, or, if you can't provide the data, then insert a bunch of "printVarSummary" and "printMinMax" statements so we can see what your data looks like:</span></div><div class="gmail_default"><span style="font-size:12.8px"><br></span></div><div class="gmail_default"><span style="font-size:12.8px">printVarSummary(ash)</span></div><div class="gmail_default"><span style="font-size:12.8px">printVarSummary(latN)</span></div><div class="gmail_default"><span style="font-size:12.8px">printVarSummary(lonN)</span></div><div class="gmail_default"><div class="gmail_default"><span style="font-size:12.8px">printMinMax(ash,0)</span></div><div class="gmail_default"><span style="font-size:12.8px">printMinMax</span><span style="font-size:12.8px">(latN</span><span style="font-size:12.8px">,0</span><span style="font-size:12.8px">)</span></div><div class="gmail_default"><span style="font-size:12.8px">printMinMax</span><span style="font-size:12.8px">(lonN</span><span style="font-size:12.8px">,0</span><span style="font-size:12.8px">)</span></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Thu, Sep 8, 2016 at 9:57 AM, Genito Amos Maure <span dir="ltr"><<a href="mailto:genito.maure@uem.mz" target="_blank">genito.maure@uem.mz</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>Hi Sean.<br>
Is that "i" before the zero in the expression<br>
<span> lat = b->XLAT(i0,:,:) ;Not a nested domain<br>
</span>a typo?<br>
<br>
<br>
<br>
On Thu, 8 Sep 2016 07:48:52 -0800, Sean Egan wrote<br>
<div><div>> Hi,<br>
><br>
> I have an HDF file that contains volcanic ash column densities in a 900x3712<br>
array. Most of the elements are fill values. In addition, there are two arrays<br>
of latitudes and longitudes, both 900x3712.<br>
><br>
> I am trying to use gsn_contour or gsn_csm_contour to plot the ash<br>
concentrations over a WRF model domain. Currently, I'm unable to get NCL to<br>
reference the ash array with the latitude and longitude arrays. I have posted<br>
my script below and can upload the HDF file if needed.<br>
><br>
> Any tips as to why I cannot get NCL to reference the lat and lon arrays<br>
correctly would be greatly appreciated. I believe it may have something to do<br>
with the sfXArray and sfYArray resources....<br>
><br>
> Thanks,<br>
><br>
> Sean<br>
><br>
> Script Start<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/wrf/WRFUserARW.ncl"<br>
> load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/contributed.ncl"<br>
><br>
> begin<br>
><br>
> a = addfile("file1.hdf","r")<br>
> b = addfile("wrfout_d01_2010-04-16<wbr>_00:00:00","r")<br>
> wks=gsn_open_wks("x11","testin<wbr>g")<br>
><br>
> latS = a->pixel_latitude<br>
> latN = latS * 0.002746665852839747<br>
> lonS = a->pixel_longitude<br>
> lonN = lonS * 0.005493331705679495<br>
> ash = a->volcld_ret_14_15_16_ash_mas<wbr>s_loading<br>
><br>
> lat = b->XLAT(i0,:,:) ;Not a nested domain<br>
> lon = b->XLONG(0,:,:)<br>
> dims = dimsizes(lat)<br>
> nlat = dims(0)<br>
> nlon = dims(1)<br>
><br>
> gsn_define_colormap(wks,"WhBlG<wbr>rYeRe")<br>
> res = True<br>
> res@gsnMaximize = False<br>
> res@gsnDraw = False ; Turn off for now.<br>
> res@gsnFrame = False ; Will draw later<br>
> res@tiMainOn = False<br>
><br>
> mpres <wbr> = res<br>
> mpres@mpProjection <wbr> = "LambertConformal"<br>
> mpres@mpLimitMode <wbr> = "Corners"<br>
> mpres@mpLeftCornerLatF <wbr> = lat(0,0)<br>
> mpres@mpLeftCornerLonF <wbr> = lon(0,0)<br>
> mpres@mpRightCornerLatF <wbr> = lat(nlat-1,nlon-1)<br>
> mpres@mpRightCornerLonF <wbr> = lon(nlat-1,nlon-1)<br>
> mpres@mpLambertParallel1F <wbr> = b@TRUELAT1<br>
> mpres@mpLambertParallel2F <wbr> = b@TRUELAT2<br>
> mpres@mpLambertMeridianF <wbr> = b@STAND_LON<br>
> mpres@mpDataBaseVersion <wbr> = "MediumRes"<br>
> mpres@mpOutlineBoundarySets <wbr> = "GeophysicalAndUSStates"<br>
> mpres@mpFillOn <wbr> = False<br>
> mpres@mpOutlineOn <wbr> = True<br>
> mpres@mpCountyLineThicknessF <wbr> = 2.5<br>
> mpres@mpGeophysicalLineThickne<wbr>ssF = 2.5<br>
> mpres@mpNationalLineThicknessF<wbr> = 2.5<br>
> mpres@mpProvincialLineThicknes<wbr>sF = 2.5<br>
> mpres@mpUSStateLineThicknessF <wbr> = 2.5<br>
> mpres@mpCountyLineColor <wbr> = "Black"<br>
> mpres@mpGeophysicalLineColor <wbr> = "Black"<br>
> mpres@mpNationalLineColor <wbr> = "Black"<br>
> mpres@mpUSStateLineColor <wbr> = "Black"<br>
><br>
> cnres = res<br>
> cnres@tfDoNDCOverlay = False ; Testing<br>
> cnres@cnFillOn = True<br>
> cnres@lbLabelBarOn = True<br>
> cnres@cnLinesOn = False<br>
> cnres@lbOrientation = "Vertical"<br>
> cnres@sfDataArray = ash <br>
> cnres@sfXArray = lonN<br>
> cnres@sfYArray = latN<br>
> cnres@sfMissingValueV = ash@_FillValue<br>
> cnres@cnLevelSelectionMode = "ManualLevels"<br>
> cnres@cnFillMode = "RasterFill"<br>
> cnres@cnRasterSmoothingOn = False<br>
> cnres@cnFillOpacityF = 0.75<br>
> cnres@cnMinLevelValF = 0.<br>
> cnres@cnMaxLevelValF = 2.0<br>
> cnres@cnLevelSpacingF = 0.05<br>
><br>
> map = gsn_csm_map(wks,mpres)<br>
> ash_contour = gsn_csm_contour(wks,ashNN,cnre<wbr>s)<br>
><br>
> overlay(map,ash_contour)<br>
> draw(map)<br>
> frame(wks)<br>
><br>
> end<br>
<br>
<br>
<br>
</div></div></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>
</blockquote></div><br></div>
</blockquote></div><br><br clear="all"><br></div></div><span>-- <br><div data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font size="1">PO1 Sean D. Egan, US Navy<br></font><font size="1">PhD Candidate<br></font><font size="1">Geophysical Institute<br></font><div><font size="1">University of Alaska Fairbanks<br></font></div><div><font size="1">903 Koyukuk Drive<br>Fairbanks, AK 99775<br><a href="mailto:sdegan@alaska.edu" target="_blank">sdegan@alaska.edu</a> | <a href="tel:907%20474-5483" value="+19074745483" target="_blank">907 474-5483</a><br></font></div><font size="1">IARC Office 334 | <a href="http://www.gi.alaska.edu/~sdegan" target="_blank">www.gi.alaska.edu/~sdegan</a><br></font></div></div></div></div></div></div>
</span></div>
</blockquote></div><br><br clear="all"><br>-- <br><div data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font size="1">PO1 Sean D. Egan, US Navy<br></font><font size="1">PhD Candidate<br></font><font size="1">Geophysical Institute<br></font><div><font size="1">University of Alaska Fairbanks<br></font></div><div><font size="1">903 Koyukuk Drive<br>Fairbanks, AK 99775<br><a href="mailto:sdegan@alaska.edu" target="_blank">sdegan@alaska.edu</a> | <a href="tel:907%20474-5483" value="+19074745483" target="_blank">907 474-5483</a><br></font></div><font size="1">IARC Office 334 | <a href="http://www.gi.alaska.edu/~sdegan" target="_blank">www.gi.alaska.edu/~sdegan</a><br></font></div></div></div></div></div></div>
</div>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font size="1">PO1 Sean D. Egan, US Navy<br></font><font size="1">PhD Candidate<br></font><font size="1">Geophysical Institute<br></font><div><font size="1">University of Alaska Fairbanks<br></font></div><div><font size="1">903 Koyukuk Drive<br>Fairbanks, AK 99775<br><a href="mailto:sdegan@alaska.edu" target="_blank">sdegan@alaska.edu</a> | 907 474-5483<br></font></div><font size="1">IARC Office 334 | <a href="http://www.gi.alaska.edu/~sdegan" target="_blank">www.gi.alaska.edu/~sdegan</a><br></font></div></div></div></div></div></div>
</div>