<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Andrew,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks for the providing the files.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I took your script and heavily modified it to just read time and temperature off all the files, so I could see what was going on with time.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">It appears that your time variable is non-monotonic *in each individual file*, which violates coordinate array rules. NCL will still read it in, but will give you a warning about the non-monotonic arrays:</div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_default"><p class="gmail-p1" style="font-size:small"><span class="gmail-s1"><font face="monospace, monospace">warning:Aggregated dimension coordinate values are non-monotonic; check aggregated file ordering</font></span></p></div></blockquote><div class="gmail_default">
<p class="gmail-p1" style="font-size:small"><span class="gmail-s1">See the attached hamsr_time.ncl, which you can run to see how each time array on each file is non-monotonic.</span></p><p class="gmail-p1" style="font-size:small"><span class="gmail-s1">You were almost there there with trying to reorder the time dimension. </span></p><p class="gmail-p1" style="font-size:small"><span class="gmail-s1">What you need to do is call dim_pqsort to return the permutation vector needed to sort time:</span></p></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_default"><p class="gmail-p1"><font face="monospace, monospace">;--- return permutation vector for sorting time ip </font><span style="font-family:monospace,monospace">= dim_pqsort(temp_hamsr&time,1)</span></p></div></blockquote><div class="gmail_default"><div style="font-size:small"><div><font face="arial, helvetica, sans-serif">and then use "ip" to sort both temp_hamsr *and* the time coordinate array with one call: <br></font></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_default"><div style="font-size:small"><div><font face="monospace, monospace">temp_hamsr_reorder = temp_hamsr(ip,:) ; this reorders both temp_hamsr and temp_hamsr&time</font></div></div></div></blockquote><div class="gmail_default"><div><div style="font-size:small"><br></div>I created a separate script (plot_temp_hamsur_before_after.ncl) that just reads in temp across all files, and then I plotted this variable both before and after the time array had been sorted.</div><div><br><div style="font-size:small">You will notice some lines crossing each other in the before plot. This is because the time values were not monotonic.</div><div style="font-size:small"><br></div><div style="font-size:small">There are still some "jumps" in time, but this is probably because time is somewhat irregular in the spacing.</div><div style="font-size:small"><br></div><div style="font-size:small">Hopefully this makes sense.</div><div style="font-size:small"><br></div><div style="font-size:small">--Mary</div><div style="font-size:small"><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 8, 2017 at 7:11 AM, Andrew Kren - NOAA Affiliate <span dir="ltr"><<a href="mailto:andrew.kren@noaa.gov" target="_blank">andrew.kren@noaa.gov</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>I think I uploaded the files there now. I ran into a few issues putting them on there but I think it is fixed. Let me know if they are there, they should be listed as HAMSR*.nc</div><div><br></div><div>Thanks,</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 4, 2017 at 4:27 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">Hi Andrew,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">It would help if we could see a sample of your files so we can understand how the time dimension is getting out of order.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Can you provide a subset of them or even all of them? I can see that there might be issues when you are talking about data that is being collected at the seconds level.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">If you just have a few files, or if they are not too large, then you can use our ftp:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><div class="gmail_default"> ftp <a href="http://ftp.cgd.ucar.edu" target="_blank">ftp.cgd.ucar.edu</a></div><div class="gmail_default"> <log in as "anonymous"></div><div class="gmail_default"> <Use email address as password></div><div class="gmail_default"> cd incoming</div><div class="gmail_default"> put <your files></div><div class="gmail_default"> quit</div><div class="gmail_default"><br></div><div class="gmail_default">You can do this offline if you prefer.</div><div class="gmail_default"><br></div><div class="gmail_default">Thanks,</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><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_5675507409330725829h5">On Thu, May 4, 2017 at 8:05 AM, Andrew Kren - NOAA Affiliate <span dir="ltr"><<a href="mailto:andrew.kren@noaa.gov" target="_blank">andrew.kren@noaa.gov</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_5675507409330725829h5"><div dir="ltr">Dear ncl-talk,<div><br></div><div>I have data on airborne temperature and moisture retrievals. This data comes in netcdf format with output every 1-2 seconds. The data is binned into hourly netcdf files. I read in the data using addfiles so that I can store all of it together instead of looping over each one. I want to compare and average this data around the time of a dropsonde release. When I read in the data, the time dimension gets out of order and is not in increasing time. I have tried to do qsort and dim_pqsort_n in conjunction with example 3 here (<a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_pqsort_n.shtml" target="_blank">https://www.ncl.ucar.edu/Docu<wbr>ment/Functions/Built-in/dim_pq<wbr>sort_n.shtml</a>), but for some reason I can't find out how to re-order my temperature and moisture data along the time dimension.</div><div><br></div><div>My temperature and moisture data has format of (time, level). Any help is much appreciated, and attached is my ncl script.</div><div><br></div><div>Thanks,<span class="m_5675507409330725829m_-1013088390474385233HOEnZb"><font color="#888888"><br clear="all"><div><br></div>-- <br><div class="m_5675507409330725829m_-1013088390474385233m_1221919751036212463gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div>Andrew Kren, PhD<br>
Research Scientist I, Global Observing Systems Analysis (GOSA) Group<br>
NOAA ESRL Global Systems Division (Rm 3C515)<br>
325 Broadway, Boulder, CO 80305<br>
<a href="tel:%28303%29%20497-5418" value="+13034975847" target="_blank">(303) 497-5418</a><span><font color="#888888"><br>
</font></span></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</font></span></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_5675507409330725829gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div>Andrew Kren, PhD<br>
Research Scientist I, Global Observing Systems Analysis (GOSA) Group<br>
NOAA ESRL Global Systems Division (Rm 3C515)<br>
325 Broadway, Boulder, CO 80305<br>
<a href="tel:%28303%29%20497-5418" value="+13034975847" target="_blank">(303) 497-5418</a><span><font color="#888888"><br>
</font></span></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div>
</div></div></blockquote></div><br></div>