<div dir="ltr"><div class="gmail_default" style="font-size:small">Thanks for cleaning up the script.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I was able to get it to run and I see what the problem is.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You are subscripting snowh_rate with:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><div class="gmail_default" style="font-size:small"><font face="monospace, monospace"> snowh_rate_dom = snowh_rate(y_start:y_end,x_start:x_end)</font></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">and then trying to attach coordinate arrays to it with:</div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace"><br></font></div><div class="gmail_default" style="font-size:small"><div class="gmail_default"><font face="monospace, monospace"> lat_dom = xlat2d(y_start:y_end,x_start:x_end)</font></div><div class="gmail_default"><font face="monospace, monospace"> lon_dom = xlon2d(y_start:y_end,x_start:x_end)</font></div></div><div class="gmail_default"><div class="gmail_default" style="font-size:small"><font face="monospace, monospace"> snowh_rate_dom!0 = "lat_dom"</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace"> snowh_rate_dom!1 = "lon_dom"</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace"> snowh_rate_dom@lat_dom = lat_dom</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace"> snowh_rate_dom@lon_dom = lon_dom</font></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">This is not going to work, because snowh_rate_dom is still a curvilinear grid (i.e. a grid defined by 2D lat / lon coordinates), so you still need to do the "@lat2d" and "@lon2d" attachments.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Furthermore, when when you do this:<br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><div class="gmail_default" style="font-size:small"><font face="monospace, monospace"> snowh_rate_dom = snowh_rate(y_start:y_end,x_start:x_end)</font></div><div style="font-size:small"><br>the original lat2d and lon2d attributes from snowh_rate are copied over, and you end up with a lat2d and lon2d that are the wrong size. That's why you are getting these two errors:</div><div style="font-size:small"><br></div><div><div><font face="monospace, monospace">0)<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>is_valid_latlon2d_attr: Warning: The 'lat2d' attribute must either be the same dimension sizes as the data, or one element larger in both directions. Your data will most likely not be overlaid on the map correctly.</font></div><div><font face="monospace, monospace">(0)<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>is_valid_latlon2d_attr: Warning: The 'lon2d' attribute must either be the same dimension sizes as the data, or one element larger in both directions. Your data will most likely not be overlaid on the map correctly.</font></div></div><div><br></div><div>You almost have the right idea. </div><div><br></div><div>First, when you subscript snowh_rate, make sure the lat2d and lon2d don't get copied over by using the special (/ and /) syntax:</div><div><br></div><div><div class="gmail_default"><font face="monospace, monospace"> snowh_rate_dom = (/snowh_rate(y_start:y_end,x_start:x_end/)) ; enclosing a variable with (/ and /) will strip all metadata</font></div></div><div class="gmail_default"><br></div><div class="gmail_default">Now you need to attach new lat2d and lon2d to snowh_rate_dom that are subscripted the same way. You already have this with lat_dom and lon_dom, so just use those:</div><div class="gmail_default"><br></div><div class="gmail_default"><font face="monospace, monospace">snowh_rate@lat2d = lat_dom</font></div><div class="gmail_default"><font face="monospace, monospace">snowh_rate@lon2d = lon_dom</font></div><div class="gmail_default"><br></div><div class="gmail_default">Make sure you remove these lines:</div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace"> snowh_rate_dom!0 = "lat_dom"</font></div><div class="gmail_default"><font face="monospace, monospace"> snowh_rate_dom!1 = "lon_dom"</font></div><div class="gmail_default"><font face="monospace, monospace"> snowh_rate_dom@lat_dom = lat_dom</font></div><div class="gmail_default"><font face="monospace, monospace"> snowh_rate_dom@lon_dom = lon_dom</font></div><div class="gmail_default"><br></div><div class="gmail_default">--Mary</div><div class="gmail_default"><br></div><div class="gmail_default"><br></div></div><div class="gmail_default"><br></div><div><br></div></div></div><div style="font-size:small"><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 5, 2017 at 10:26 AM, Barry Lynn <span dir="ltr"><<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</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">Hi Mary:<div><br></div><div>This reads the files that I previously attached.</div><div><br></div><div>I left the wrf calls, but put them in a logical if statement.</div><div><br></div><div>I did not remove the code that sets the label bars, makes nice maps.</div><div><br></div><div>If I need to do this, please let me know.</div><div><br></div><div>The code now gives these errors (below), but I think you can ignore them.</div><div>(I am not sure how to manually add this information, for this "clean" version.</div><div><br></div><div>It still gives the one about the dimensions.</div><div><br></div><div>(Thanks.)</div><div><br></div><div><div>0)<span class="m_-8541097583354215696gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>is_valid_latlon2d_attr: Warning: The 'lat2d' attribute must either be the same dimension sizes as the data, or one element larger in both directions. Your data will most likely not be overlaid on the map correctly.</div><div>(0)<span class="m_-8541097583354215696gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>check_for_y_lat_coord: Warning: Data either does not contain a valid latitude coordinate array or doesn't contain one at all.</div><div>(0)<span class="m_-8541097583354215696gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>A valid latitude coordinate array should have a 'units' attribute equal to one of the following values: </div><div>(0)<span class="m_-8541097583354215696gmail-Apple-tab-span" style="white-space:pre-wrap">        </span> 'degrees_north' 'degrees-north' 'degree_north' 'degrees north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'</div><div>(0)<span class="m_-8541097583354215696gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>is_valid_latlon2d_attr: Warning: The 'lon2d' attribute must either be the same dimension sizes as the data, or one element larger in both directions. Your data will most likely not be overlaid on the map correctly.</div><div>(0)<span class="m_-8541097583354215696gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>check_for_lon_coord: Warning: Data either does not contain a valid longitude coordinate array or doesn't contain one at all.</div><div>(0)<span class="m_-8541097583354215696gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>A valid longitude coordinate array should have a 'units' attribute equal to one of the following values: </div><div>(0)<span class="m_-8541097583354215696gmail-Apple-tab-span" style="white-space:pre-wrap">        </span> 'degrees_east' 'degrees-east' 'degree_east' 'degrees east' 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' '</div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 5, 2017 at 7:11 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">Barry,<br><br>Offline for a bit. I still can't run your script because it's assuming that I have a WRF output file, but the "<a href="http://file_for_ncltalk.nc" target="_blank">file_for_ncltalk.nc</a>" file you gave me is not a WRF output file. I<div class="gmail_default" style="font-size:small;display:inline">t's very time-consuming for me to try to figure out how to change your script to work with this file, so please, send me a *clean* script that works with the files you've sent me so far.</div><div><div class="gmail_default" style="font-size:small;display:inline"><br></div></div><div><div class="gmail_default" style="font-size:small;display:inline">Thanks,</div></div><div><div class="gmail_default" style="font-size:small;display:inline"><br></div></div><div><div class="gmail_default" style="font-size:small;display:inline">--Mary</div></div><div><div class="gmail_default" style="font-size:small;display:inline"><br></div></div><div><div class="gmail_default" style="font-size:small;display:inline"></div>
</div></div><div class="m_-8541097583354215696HOEnZb"><div class="m_-8541097583354215696h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 5, 2017 at 9:58 AM, Barry Lynn <span dir="ltr"><<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</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">Hello:<div><br></div><div>I have attached the wrf_times.file.</div><div><br></div><div>However, I added res@gsnAddCyclic = False</div><div><br></div><div>and sres@gsnAddCyclic = False, but the error remains.</div><div><br></div><div>The problem pertains not to the mapping of the terrain ("res"), but of the snowh_rate_dom variable.</div><div><br></div><div>Since, I am plotting a subdomain of terrain by setting:</div><div><br></div><div><div> res@mpFillOn = False</div><div> res@mpMaxLatF = lat_end ; specify the plot domain</div><div> res@mpMinLatF = lat_beg</div><div> res@mpMinLonF = lon_beg ;</div><div> res@mpMaxLonF = lon_end</div></div><div><br></div><div>I need to excerpt snowh_rate_dom from snowh_rate.</div><div><br></div><div>I do this as follows, and this is where the error message pertains to.</div><div><br></div><div>(Note, if you try to run the program, you have to read in the uploaded nc file, not wrf_output, and set ntimes = 0.)</div><div><br></div><div><div> i_loc = 1</div><div> j_loc = 1</div><div> GET_IJ::get_ij(xlat2d,xlon2d,l<wbr>at_beg,lon_beg,i_loc,j_loc,dim<wbr>s2d(0),dims2d(1))</div><div> x_start = i_loc</div><div> y_start = j_loc</div><div><br></div><div> print("x_start = " + x_start)</div><div> print("y_start = " + y_start)</div><div> GET_IJ::get_ij(xlat2d,xlon2d,l<wbr>at_end,lon_end,i_loc,j_loc,dim<wbr>s2d(0),dims2d(1))</div><div> x_end = i_loc</div><div> y_end = j_loc</div><div> print("x_end = " + x_end)</div><div> print("y_end = " + y_end)</div><div> snowh_rate_dom = snowh_rate(y_start:y_end,x_sta<wbr>rt:x_end)</div><div> printVarSummary(snowh_rate_dom<wbr>)</div><div> printVarSummary(snowh_rate)</div><div><br></div><div> lat_dom = xlat2d(y_start:y_end,x_start:x<wbr>_end)</div><div> lon_dom = xlon2d(y_start:y_end,x_start:x<wbr>_end)</div><div> snowh_rate_dom!0 = "lat_dom"</div><div> snowh_rate_dom!1 = "lon_dom"</div><div> snowh_rate_dom@lat_dom = lat_dom</div><div> snowh_rate_dom@lon_dom = lon_dom</div></div><div><br></div><div><br></div></div><div class="m_-8541097583354215696m_-4294232288934853161HOEnZb"><div class="m_-8541097583354215696m_-4294232288934853161h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 5, 2017 at 5:45 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 class="gmail_default" style="font-size:small">Barry,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I was unable to run the script because I was missing an ASCII file.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I think the problem is that NCL is trying to add a longitude cyclic point, and you don't want to do this for WRF data. What's happening is that NCL is taking your 270 x 270 data array and turning it into a 270 x 271 array, but the lat2d and lon2d are untouched (because gsnAddCyclic doesn't touch these), and hence you end up with two arrays of different sizes.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Try setting:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"> res@gsnAddCyclic = False</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"><div><div class="m_-8541097583354215696m_-4294232288934853161m_-8642245181990319030h5">On Thu, Jan 5, 2017 at 1:42 AM, Barry Lynn <span dir="ltr"><<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</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="m_-8541097583354215696m_-4294232288934853161m_-8642245181990319030h5"><div dir="ltr"><div>Hello:</div><div><br></div><div>I thought that I have done what was indicated on this page, but I continue to get an error in dimensioning the second variable. I am trying to plot a subset of the first variable (no problem), and then extract the same subset from the second variable. I've done it before, but</div><div>it doesn't work here.</div><div><br></div><div>I been at this about 4 or 5 hours, tried different things, including adapting the suggestions here:</div><div><br></div><div><a href="https://www.ncl.ucar.edu/Support/talk_archives/2012/2697.html" target="_blank">https://www.ncl.ucar.edu/Suppo<wbr>rt/talk_archives/2012/2697.htm<wbr>l</a><br></div><div><br></div><div>I uploaded an extraction of the original WRF file, in case this is need.</div><div><br></div><div>Thank you.</div><div><br></div><div>ftp> put wrfsnow.ncl</div><div>local: wrfsnow.ncl remote: wrfsnow.ncl</div><div>229 Entering Extended Passive Mode (|||49155|).</div><div>150 Ok to send data.</div><div>100% |*****************************<wbr>******************************<wbr>*********| 7521 3.06 MiB/s 00:00 ETA</div><div>226 Transfer complete.</div><div>7521 bytes sent in 00:00 (11.93 KiB/s)</div><div>ftp> put wrfsnow.out.file</div><div>local: wrfsnow.out.file remote: wrfsnow.out.file</div><div>229 Entering Extended Passive Mode (|||49161|).</div><div>150 Ok to send data.</div><div>100% |*****************************<wbr>******************************<wbr>*********| 2566 8.21 MiB/s 00:00 ETA</div><div>226 Transfer complete.</div><div>2566 bytes sent in 00:00 (6.15 KiB/s)</div><div>ftp> put <a href="http://file_for_ncltalk.nc" target="_blank">file_for_ncltalk.nc</a></div><div>local: <a href="http://file_for_ncltalk.nc" target="_blank">file_for_ncltalk.nc</a> remote: <a href="http://file_for_ncltalk.nc" target="_blank">file_for_ncltalk.nc</a></div><div>229 Entering Extended Passive Mode (|||49179|).</div><div>150 Ok to send data.</div><div>100% |*****************************<wbr>******************************<wbr>*********| 2279 KiB 278.71 KiB/s 00:00 ETA</div><div>226 Transfer complete.</div><div>2333728 bytes sent in 00:08 (260.45 KiB/s)</div><div><br></div><div><br></div>-- <br><div class="m_-8541097583354215696m_-4294232288934853161m_-8642245181990319030m_-601649810148298472m_5559598412581958747gmail_signature"><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Lecturer,</div><div><div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)"></div><span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div></div><div><span style="color:rgb(136,136,136)"><br></span></div><div>C.E.O, Weather It Is, LTD<br>Weather and Climate Focus<br><a href="http://weather-it-is.com" target="_blank">http://weather-it-is.com</a><br>Jerusalem, Israel<br>Local: 02 930 9525<br>Cell: 054 7 231 170<br>Int-IS: x972 2 930 9525<br>US <a href="tel:(914)%20432-3108" value="+19144323108" target="_blank">914 432 3108</a><br></div></div></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><br clear="all"><div><br></div>-- <br><div class="m_-8541097583354215696m_-4294232288934853161m_-8642245181990319030gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Lecturer,</div><div><div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)"></div><span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div></div><div><span style="color:rgb(136,136,136)"><br></span></div><div>C.E.O, Weather It Is, LTD<br>Weather and Climate Focus<br><a href="http://weather-it-is.com" target="_blank">http://weather-it-is.com</a><br>Jerusalem, Israel<br>Local: 02 930 9525<br>Cell: 054 7 231 170<br>Int-IS: x972 2 930 9525<br>US <a href="tel:(914)%20432-3108" value="+19144323108" target="_blank">914 432 3108</a><br></div></div></div>
</div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_-8541097583354215696gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Lecturer,</div><div><div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)"></div><span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div></div><div><span style="color:rgb(136,136,136)"><br></span></div><div>C.E.O, Weather It Is, LTD<br>Weather and Climate Focus<br><a href="http://weather-it-is.com" target="_blank">http://weather-it-is.com</a><br>Jerusalem, Israel<br>Local: 02 930 9525<br>Cell: 054 7 231 170<br>Int-IS: x972 2 930 9525<br>US <a href="tel:(914)%20432-3108" value="+19144323108" target="_blank">914 432 3108</a><br></div></div></div>
</div>
</div></div></blockquote></div><br></div>