<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">hmmmm… <div>You could use a csh script (or whatever shell you are comfortable with) to delimitate the text file year, start, and end values. You feed this into environment variables and import into ncl. ncl would then use ascii read, and the getenv to set the ranges. After that, run stat_dispersion, and export to netcdf.</div><div><br></div><div><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/asciiread.shtml">http://www.ncl.ucar.edu/Document/Functions/Built-in/asciiread.shtml</a></div><div><a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/fspan.shtml">https://www.ncl.ucar.edu/Document/Functions/Built-in/fspan.shtml</a></div><div><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/getenv.shtml">http://www.ncl.ucar.edu/Document/Functions/Built-in/getenv.shtml</a></div><div><br></div><div>-Jonathan</div><div><br></div><div><br><div><div>On Sep 12, 2014, at 1:05 PM, Marcella, Marc <<a href="mailto:MMarcella@AIR-WORLDWIDE.COM">MMarcella@AIR-WORLDWIDE.COM</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div lang="EN-US" link="blue" vlink="purple" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="WordSection1" style="page: WordSection1;"><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">Hmm thanks, but therein lies the problem, the start and end or increment is variable from year to year (and the year values are in a separate text file than the wind values which are in a text file) So start end for year one may be 1 4 but for year 2 it may be 5 5 and year 3 6-12, etc.<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></div><div><div style="border-style: solid none none; border-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding: 3pt 0in 0in;"><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><b><span style="font-size: 10pt; font-family: Tahoma, sans-serif;">From:</span></b><span style="font-size: 10pt; font-family: Tahoma, sans-serif;"><span class="Apple-converted-space"> </span>jbuzan [<a href="mailto:jbuzan@purdue.edu" style="color: purple; text-decoration: underline;">mailto:jbuzan@purdue.edu</a>]<span class="Apple-converted-space"> </span><br><b>Sent:</b><span class="Apple-converted-space"> </span>Friday, September 12, 2014 1:04 PM<br><b>To:</b><span class="Apple-converted-space"> </span>Marcella, Marc<br><b>Cc:</b><span class="Apple-converted-space"> </span><a href="mailto:ncl-talk@ucar.edu" style="color: purple; text-decoration: underline;">ncl-talk@ucar.edu</a><br><b>Subject:</b><span class="Apple-converted-space"> </span>Re: [ncl-talk] calculating annual max values with varying amount of yearly values<o:p></o:p></span></div></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">ah. <o:p></o:p></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">Well, a quick way to deal with this is to parse the data into years using nco commands. (ncks -d time start,end,increment data_in.nc data_out.nc). Then run stat_dispersion.<o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p> </o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">-Jonathan<o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p> </o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p> </o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p> </o:p></div><div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">On Sep 12, 2014, at 1:01 PM, Marcella, Marc <<a href="mailto:MMarcella@AIR-WORLDWIDE.COM" style="color: purple; text-decoration: underline;">MMarcella@AIR-WORLDWIDE.COM</a>> wrote:<o:p></o:p></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><br><br><o:p></o:p></div><div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">This is 1D data. It’s an array for the wind value for each event for a given year at a specific lat/lon location</span><o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span><o:p></o:p></div></div><div><div style="border-style: solid none none; border-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding: 3pt 0in 0in;"><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><b><span style="font-size: 10pt; font-family: Tahoma, sans-serif;">From:</span></b><span class="apple-converted-space"><span style="font-size: 10pt; font-family: Tahoma, sans-serif;"> </span></span><span style="font-size: 10pt; font-family: Tahoma, sans-serif;">jbuzan [<a href="mailto:jbuzan@purdue.edu" style="color: purple; text-decoration: underline;"><span style="color: purple;">mailto:jbuzan@purdue.edu</span></a>]<span class="apple-converted-space"> </span><br><b>Sent:</b><span class="apple-converted-space"> </span>Friday, September 12, 2014 1:01 PM<br><b>To:</b><span class="apple-converted-space"> </span>Marcella, Marc<br><b>Cc:</b><span class="apple-converted-space"> </span><a href="mailto:ncl-talk@ucar.edu" style="color: purple; text-decoration: underline;"><span style="color: purple;">ncl-talk@ucar.edu</span></a><br><b>Subject:</b><span class="apple-converted-space"> </span>Re: [ncl-talk] calculating annual max values with varying amount of yearly values</span><o:p></o:p></div></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"> <o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">stat_dispersion only works on 1D data. So you have to loop through each grid cell. However, it will provide you with the local statistics of each grid cell.<o:p></o:p></div></div><div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"> <o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">-Jonathan<o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"> <o:p></o:p></div></div><div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"> <o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"> <o:p></o:p></div></div><div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"> <o:p></o:p></div></div><div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">On Sep 12, 2014, at 12:55 PM, Marcella, Marc <<a href="mailto:MMarcella@AIR-WORLDWIDE.COM" style="color: purple; text-decoration: underline;"><span style="color: purple;">MMarcella@AIR-WORLDWIDE.COM</span></a>> wrote:<o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><br><br><br><o:p></o:p></div></div><div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">Yes, I know of stat dispersion, but wont this look at the statistics/distribution of the entire dataset? I was looking to figure out only for each year. I believe I could use the max command provided I can get the beginning and final index value for each year easily enough.</span><o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span><o:p></o:p></div></div><div><div style="border-style: solid none none; border-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding: 3pt 0in 0in;"><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><b><span style="font-size: 10pt; font-family: Tahoma, sans-serif;">From:</span></b><span class="apple-converted-space"><span style="font-size: 10pt; font-family: Tahoma, sans-serif;"> </span></span><span style="font-size: 10pt; font-family: Tahoma, sans-serif;">jbuzan [<a href="mailto:jbuzan@purdue.edu" style="color: purple; text-decoration: underline;"><span style="color: purple;">mailto:jbuzan@purdue.edu</span></a>]<span class="apple-converted-space"> </span><br><b>Sent:</b><span class="apple-converted-space"> </span>Friday, September 12, 2014 12:54 PM<br><b>To:</b><span class="apple-converted-space"> </span>Marcella, Marc<br><b>Cc:</b><span class="apple-converted-space"> </span><a href="mailto:ncl-talk@ucar.edu" style="color: purple; text-decoration: underline;"><span style="color: purple;">ncl-talk@ucar.edu</span></a><br><b>Subject:</b><span class="apple-converted-space"> </span>Re: [ncl-talk] calculating annual max values with varying amount of yearly values</span><o:p></o:p></div></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"> <o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">I recommend using stat_dispersion:<o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/stat_dispersion.shtml" style="color: purple; text-decoration: underline;"><span style="color: purple;">http://www.ncl.ucar.edu/Document/Functions/Contributed/stat_dispersion.shtml</span></a><o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"> <o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">-Jonathan<o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"> <o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"> <o:p></o:p></div></div><div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"> <o:p></o:p></div></div><div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">On Sep 12, 2014, at 12:49 PM, Marcella, Marc <<a href="mailto:MMarcella@AIR-WORLDWIDE.COM" style="color: purple; text-decoration: underline;"><span style="color: purple;">MMarcella@AIR-WORLDWIDE.COM</span></a>> wrote:<o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><br><br><br><br><o:p></o:p></div></div><div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;">Hi all,</span><o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><br>Im having a bit of a problem trying to elegantly script calculating annual max values when I have varying amount of values for each year. For example, I have one text file with the year stamp for each event, and in another I have the corresponding wind value for that event. Some years there are four measurements, some years one, other years ten. Im trying to use a do loop that goes through each year in the text file to find the beginning and end index (i.e. what index refers to the beginning of that year’s values in the wind file and the index that refers to the last value of that year). I was then going to use that specific year’s indices with the max command on the wind value file. But I’m having not having too much luck and it’s getting messy with all the do and if statements. Any ideas? Are there simpler functions that Im not aware of built into NCL that can help with this? Any help would be greatly appreciated.</span><o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;"> </span><o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;">Thanks,<br>Marc</span><o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 9pt; font-family: Helvetica, sans-serif;">_______________________________________________<br>ncl-talk mailing list<br>List instructions, subscriber options, unsubscribe:<br><a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" style="color: purple; text-decoration: underline;"><span style="color: purple;">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</span></a></span></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></blockquote></div><br></div></body></html>