<div dir="ltr"><div class="gmail_default" style="font-size:small">Stuart,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Sorry for the delay.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The answer follows, but I want to point out that almost half of your lat/lon values on the file are missing. I'll discuss this in a little bit.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">If you look at one of your data files using ncl_filedump, you will see that the lat/lon arrays are two-dimensional (I edited the output for clarity):<br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace"> Variable: lat</font></div><div class="gmail_default"><font face="monospace, monospace"> Type: float</font></div><div class="gmail_default"><font face="monospace, monospace"> Number of Dimensions: 2</font></div><div class="gmail_default"><font face="monospace, monospace"> Dimensions and sizes:<span style="white-space:pre-wrap"> </span>[ 29 <north_south> x 45 <east_west> ]</font></div><div class="gmail_default"><font face="monospace, monospace"> Coordinates:</font></div><div class="gmail_default"><font face="monospace, monospace"> Number of Attributes: 9</font></div><div class="gmail_default"><font face="monospace, monospace"> units<span style="white-space:pre-wrap"> </span>: <span style="white-space:pre-wrap"> </span>degree_north</font></div><div class="gmail_default"><font face="monospace, monospace"> standard_name<span style="white-space:pre-wrap"> </span>: <span style="white-space:pre-wrap"> </span>latitude</font></div><div class="gmail_default"><font face="monospace, monospace"> long_name<span style="white-space:pre-wrap"> </span>: <span style="white-space:pre-wrap"> </span>latitude</font></div><div class="gmail_default"><br></div><div class="gmail_default"><br></div><div class="gmail_default"><font face="monospace, monospace"> Variable: lon</font></div><div class="gmail_default"><font face="monospace, monospace"> Type: float</font></div><div class="gmail_default"><font face="monospace, monospace"> Number of Dimensions: 2</font></div><div class="gmail_default"><font face="monospace, monospace"> Dimensions and sizes:<span style="white-space:pre-wrap"> </span>[ 29 <north_south> x 45 <east_west> ]</font></div><div class="gmail_default"><span style="font-family:monospace,monospace"> Coordinates:</span><br></div><div class="gmail_default"><font face="monospace, monospace"> Number of Attributes: 9</font></div><div class="gmail_default"><font face="monospace, monospace"> units<span style="white-space:pre-wrap"> </span>: <span style="white-space:pre-wrap"> </span>degree_east</font></div><div class="gmail_default"><font face="monospace, monospace"> standard_name<span style="white-space:pre-wrap"> </span>: <span style="white-space:pre-wrap"> </span>longitude</font></div><div class="gmail_default"><font face="monospace, monospace"> long_name<span style="white-space:pre-wrap"> </span>: <span style="white-space:pre-wrap"> </span>longitude</font></div><div class="gmail_default"><br></div><div class="gmail_default">Data that is defined by two-dimensional lat/lon arrays is said to be on a "curvilinear" grid. In order to sub-select regions from curvilinear data, you need to use either getind_latlon2d or region_ind.</div><div class="gmail_default"><br></div><div class="gmail_default">Also, you don't want to use the [:] syntax to read the lat/lon arrays off the file, because then you will get back 2 x 29 x 45 arrays, which is unnecessary if your lat/lon arrays don't change with each time step.</div><div class="gmail_default"><br></div><div class="gmail_default">Instead, simply read off one timestep of the lat / lon using [0]:<span style="font-family:monospace,monospace"> </span></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace"> a = addfiles(fils,"r")</font></div><div class="gmail_default"><font face="monospace, monospace"> ListSetType (a, "join")</font></div><div class="gmail_default"><font face="monospace, monospace"> data = a[:]->Tair_f_tavg</font></div><div class="gmail_default"><font face="monospace, monospace"> data@time = a[:]->time</font></div><div class="gmail_default"><font face="monospace, monospace"> lon2d = a[0]->lon</font></div><div class="gmail_default"><font face="monospace, monospace"> lat2d = a[0]->lat</font></div><div class="gmail_default"><br></div><div class="gmail_default">You can then get the index locations into lat2d and lon2d that are equal to LAT and LON as follows:</div><div class="gmail_default"><br></div><div class="gmail_default"><font face="monospace, monospace"> LAT = (/ 48.5625/)</font></div><div class="gmail_default"><font face="monospace, monospace"> LON = (/-98.9375/)</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace"> nm = getind_latlon2d (lat2d,lon2d, LAT, LON)</font></div><div class="gmail_default"><font face="monospace, monospace"> n = nm(0,0)</font></div><div class="gmail_default"><font face="monospace, monospace"> m = nm(0,1)</font></div><div class="gmail_default"><font face="monospace, monospace"> print("=======================<wbr>===========================")</font></div><div class="gmail_default"><font face="monospace, monospace"> print("Original lat/lon : " + LAT +" "+LON)</font></div><div class="gmail_default"><font face="monospace, monospace"> print("Actual lat/lon : " + lat2d(n,m)+" "+lon2d(n,m))</font></div><div class="gmail_default"><font face="monospace, monospace"> print("=======================<wbr>===========================")</font></div><div class="gmail_default"><br></div><div class="gmail_default">To slice the data at that particular location:</div><div class="gmail_default"> <br></div><div class="gmail_default"><font face="monospace, monospace"> data_slice = data(:,n,m)</font></div><div class="gmail_default"><font face="monospace, monospace"> printVarSummary(data)</font></div><div class="gmail_default"><font face="monospace, monospace"> printVarSummary(data_slice)</font></div><div class="gmail_default"><font face="monospace, monospace"> printMinMax(data_slice,0)</font></div><div class="gmail_default"><br></div></div><div class="gmail_default"><br></div><div class="gmail_default">We have some examples of using these functions. Please see:</div><div class="gmail_default"><br></div><div class="gmail_default"><a href="http://www.ncl.ucar.edu/Applications/latlon_subset.shtml" target="_blank">http://www.ncl.ucar.edu/<wbr>Applications/latlon_subset.<wbr>shtml</a><br></div><div class="gmail_default"><br></div><div class="gmail_default">These examples show the difference between region_ind and getind_latlon2d, which is important if you want to grab a sub-region of data, rather than just a single slice.</div><div class="gmail_default"><br></div><div class="gmail_default">Back to the lat/lon values being missing. It's always incredibly important to look at your data and understand it before you start doing calculations on it, or try to plot it. Dennis Shea mentioned to me offline that your lat/lon arrays had a high number of missing values, so I simply added the following two lines to check this:</div><div class="gmail_default"><br></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace"> print("=======================<wbr>===========================")</font></div><div class="gmail_default"><font face="monospace, monospace"> print("# of valid latitude values = " + num(.not.ismissing(lat2d)))</font></div><div class="gmail_default"><font face="monospace, monospace"> print("# of missing latitude values = " + num(ismissing(lat2d)))</font></div><div class="gmail_default"><font face="monospace, monospace"> print("=======================<wbr>===========================")</font></div><div class="gmail_default"><font face="monospace, monospace"> print("# of valid longitude values = " + num(.not.ismissing(lon2d)))</font></div><div class="gmail_default"><font face="monospace, monospace"> print("# of missing longitude values = " + num(ismissing(lon2d)))</font></div><div class="gmail_default"><font face="monospace, monospace"> print("=======================<wbr>===========================")</font></div><div class="gmail_default"><br></div><div class="gmail_default">which gave me the following output:</div><div class="gmail_default"><br></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace">==============================<wbr>====================</font></div><div class="gmail_default"><font face="monospace, monospace"># of valid latitude values = 703</font></div><div class="gmail_default"><font face="monospace, monospace"># of missing latitude values = 602</font></div><div class="gmail_default"><font face="monospace, monospace">==============================<wbr>====================</font></div><div class="gmail_default"><font face="monospace, monospace"># of valid longitude values = 703</font></div><div class="gmail_default"><font face="monospace, monospace"># of missing longitude values = 602</font></div><div class="gmail_default"><font face="monospace, monospace">==============================<wbr>====================</font></div><div class="gmail_default"><br></div><div class="gmail_default">It's likely that the lat/lon arrays have missing values in the same location.</div><div class="gmail_default"><br></div><div class="gmail_default">Now maybe this is perfectly valid for your data, but it's something we wanted to be sure you were aware of. It's somewhat unusual to see this many missing values in lat / lon arrays.</div><div class="gmail_default"><br></div></div></div><div class="gmail_default">--Mary</div><div class="gmail_default"><br></div><div class="gmail_default"><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 Sat, Apr 28, 2018 at 12:32 PM, Smith, Stuart <span dir="ltr"><<a href="mailto:smit1770@purdue.edu" target="_blank">smit1770@purdue.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_2888780830917156680WordSection1"><p class="MsoNormal">Hello,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Attached is a NCL script I have been using to output model simulation results. My goal is to enhance this script to plot outputs from specific grid cells. <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">The plotting script was originally designed to read in netCDF files, which were outputted from the model simulation in a daily time step as a netCDF file (ex. <a href="http://200903180000.d01.nc" target="_blank">200903180000.d01.nc</a>). In order to create a timeseries, the script joins the files into an array and plots the total average data. I would like to enhance the NCL script to plot a time series of the raw outputted data from a defined grid cell.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I have been able to do this successfully looking at individual files, but when I try joining the data into an array for time series analysis of the grid cell I get the following error “fatal:Dimension (east_west) of (data) does not have an associated coordinate variable fatal" on line 28. Could I please have assistance on understanding the error and correcting this issue? Attached are example output results from a model simulation as well. Thank you for your time.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Regards,<span class="HOEnZb"><font color="#888888"><u></u><u></u></font></span></p><span class="HOEnZb"><font color="#888888"><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">-Stuart <u></u><u></u></p></font></span></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>