<div dir="ltr">Hi,<div><br></div><div>Thank you Will and Dennis, I have managed to modify my script to make it work for my data. </div><div><br></div><div>Since I am not interested in the time series plot but just the data I have prepared the second part of the script to write text files. I have read the manual, looked up on the ncl-talk archives and managed to get it to work, but it is not working properly and I cannot identify how to fix the problem. </div>

<div><br></div><div>The script should be producing 1 text file per EOF, each containing a date and the corresponding eof_ts value. There are two problems with it. First, all date values are 1970 and each text file is printing values corresponding to both neof quantities (however, the first one is being marked as missing) - this latter problem is not really that much of an issue. if I could solve the first problem I could get by.</div>

<div><br></div><div>Thanks and regards,</div><div>James</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 14 August 2014 15:53, Dennis Shea <span dir="ltr">&lt;<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>&gt;</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>Sometimes, when people answer, they are quickly typing and make errors.<br></div><div><br></div><div>

Will had a typo. He meant &#39;ispan&#39; ..... <br>This is one of the most basic functions in NCL. Please read documentation:<br>
       <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/ispan.shtml" target="_blank">https://www.ncl.ucar.edu/Document/Functions/Built-in/ispan.shtml</a>  <br><br>year = ispan(yrst, yren,1)               ; integer array of all years in the range<br>


<br><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Thu, Aug 14, 2014 at 6:29 AM, James Ciarlo` <span dir="ltr">&lt;<a href="mailto:james.ciarlo@physics.org" target="_blank">james.ciarlo@physics.org</a>&gt;</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="h5"><div dir="ltr">Hi Will,<div><br></div><div>Thanks for your help. However, the span command was not recognized.</div>

<div>
<br></div><div>Regards,</div><div>James</div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">

On 14 August 2014 09:08, Will Hobbs <span dir="ltr">&lt;<a href="mailto:Will.Hobbs@utas.edu.au" target="_blank">Will.Hobbs@utas.edu.au</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">








<div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<div>James</div>
<div><br>
</div>
<div>As the name of function might suggest month_to_season() is designed to convert monthly data to seasonal data; it&#39;s not designed to work with 4xtimes daily data. If in doubt about any function, your first step should ALWAYS be to consult the NCL help page
 for that function (<a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/month_to_season.shtml" target="_blank">http://www.ncl.ucar.edu/Document/Functions/Contributed/month_to_season.shtml</a>)</div>
<div><br>
</div>
<div>There is a page listing all of NCL&#39;s functions: <a href="http://www.ncl.ucar.edu/Document/Functions/climo.shtml" target="_blank">http://www.ncl.ucar.edu/Document/Functions/climo.shtml</a>, at the moment they only work with monthly or daily data, so you will have to use
 a different approach.</div>
<div><br>
</div>
<div>My advise would be to use one of NCL&#39;s date functions (<a href="http://www.ncl.ucar.edu/Document/Functions/date.shtml" target="_blank">http://www.ncl.ucar.edu/Document/Functions/date.shtml</a>) to find all the data points for a given season. I&#39;ve given an example below to calculate the seasonal mean for Jan-Mar (JFM), whcih you can adjust
 to your own purposes. This assumes that your data has an appropriate time coord system, which I&#39;m calling &#39;time&#39; here. Lt&#39;s say you have an array, x, dimensioned (time,lat,lon)</div>
<div><br>
</div>
<div>&gt; nyr    = yren - yrst+1   ;yrst and yren are the forst and last years in x</div>
<div>&gt; xSeas = x(:nyr-1,:,:)  ; nyr is the number of years in your data set</div>
<div>&gt;year = span(yrst, yren,1)               ; integer array of all years in the range</div>
<div>&gt; tdat = cd_calendar(x&amp;time, -5)  ; converts time to a multidimensional array giving year, month, day, time etc for each time step</div>
<div><br>
</div>
<div>&gt; do yy = 0, nyr-1</div>
<div>&gt;      ii = ind(tdat(:,0).eq.year(yy).and.tdat(:,1).ge.1.and.tdat(:,1).le.3)  ;location of all times in given year, that are between Jan (1) and March(3)</div>
<div>&gt;     xSeas(yy,:,:) = dim_avg_n(x(ii,:,:), 0)    ; get average of all those data points</div>
<div>&gt;    delete(ii)</div>
<div>&gt; end do</div>
<div><br>
</div>
<div><br>
</div>
<div>Hope that helps. Don&#39;t forget that there is an enormous amount of help to be gained by on the NCL website; it has a search function which includes archived &#39;ncl-talk&#39; posts. Nine times out of ten somebody else will have come across the same problem. </div>





<div><br>
</div>
<div>Will </div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<span>
<div style="font-family:Calibri;font-size:11pt;text-align:left;color:black;BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;PADDING-BOTTOM:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;BORDER-TOP:#b5c4df 1pt solid;BORDER-RIGHT:medium none;PADDING-TOP:3pt">





<span style="font-weight:bold">From: </span>James Ciarlo` &lt;<a href="mailto:james.ciarlo@physics.org" target="_blank">james.ciarlo@physics.org</a>&gt;<br>
<span style="font-weight:bold">Date: </span>Thursday, 14 August 2014 4:43 PM<br>
<span style="font-weight:bold">To: </span>&quot;<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>&quot; &lt;<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>&gt;<br>
<span style="font-weight:bold">Subject: </span>[ncl-talk] eof script problems<br>
</div><div><div>
<div><br>
</div>
<div>
<div>
<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Dear NCL users,</span>
<div style="font-family:arial,sans-serif;font-size:13px"><br>
</div>
<div style="font-family:arial,sans-serif;font-size:13px">I am new to NCL and am trying to modify an eof script to suit a different dataset. </div>
<div style="font-family:arial,sans-serif;font-size:13px"><br>
</div>
<div style="font-family:arial,sans-serif;font-size:13px">The data the script is designed for uses a command month_to_season but since my data is not monthly but rather 4 time daily, I need an alternative method. And in fact running the script gives me the following
 error (to start with, as I am sure fixing this will result in numerous other errors later but lets start with this)</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br>
</div>
<div style="font-family:arial,sans-serif;font-size:13px">(0)     contributed.ncl: month_to_season: dimension must be a multiple of 12</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br>
</div>
<div style="font-family:arial,sans-serif;font-size:13px">Regards,</div>
<div style="font-family:arial,sans-serif;font-size:13px">James</div>
</div>
</div>
</div>
</div></div></span>
</div>

</blockquote></div><br></div>
</div></div><br></div></div><div class="">_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></div></blockquote></div><br></div>
</blockquote></div><br></div>