<div dir="ltr">To add to the discussion here, if you have these sorts of questions about functions that have the load "$NCARG_ROOT/"... line at the top of the documentation page. You can look in that file, search for the function name and take a browse at what the function is doing. <div><br></div><div><br></div><div>lines in question:</div><div><p style="margin:0px;font-size:12px;font-family:Consolas;color:rgb(242,242,34);background-color:rgb(56,56,56)"><b> if (NMO.eq.0) then</b></p>
<p style="margin:0px;font-size:12px;font-family:Consolas;color:rgb(242,242,34);background-color:rgb(56,56,56)"><b> nyrStrt = 1</b></p>
<p style="margin:0px;font-size:12px;font-family:Consolas;color:rgb(242,242,34);background-color:rgb(56,56,56)"><b> end if</b></p>
<p style="margin:0px;font-size:12px;font-family:Consolas;color:rgb(242,242,34);background-color:rgb(56,56,56)"><b> if (NMO.eq.nmos-1) then</b></p>
<p style="margin:0px;font-size:12px;font-family:Consolas;color:rgb(242,242,34);background-color:rgb(56,56,56)"><b> nyrLast = nyrs-2</b></p>
<p style="margin:0px;font-size:12px;font-family:Consolas;color:rgb(242,242,34);background-color:rgb(56,56,56)"><b> end if</b></p></div><div>This is checking whether season is DJF (NMO .eq. 0) or season is NDJ (NMO.eq.nmos-1). </div><div><br></div><div>After it loops through all the years it then fills in either the first or last year with:</div><div><p style="margin:0px;font-size:12px;font-family:Consolas;color:rgb(242,242,34);background-color:rgb(56,56,56)"><b> if (NMO.eq.0) then</b></p>
<p style="margin:0px;font-size:12px;font-family:Consolas;color:rgb(242,242,34);background-color:rgb(56,56,56)"><b> n = 0</b></p>
<p style="margin:0px;font-size:12px;font-family:Consolas;color:rgb(242,242,34);background-color:rgb(56,56,56)"><b> xSea(0) = (xMon(n) + xMon(n+1))*0.5</b></p>
<p style="margin:0px;font-size:12px;font-family:Consolas;color:rgb(242,242,34);background-color:rgb(56,56,56)"><b> end if</b></p>
<p style="margin:0px;font-size:12px;font-family:Consolas;color:rgb(242,242,34);background-color:rgb(56,56,56)"><b> if (NMO.eq.nmos-1) then</b></p>
<p style="margin:0px;font-size:12px;font-family:Consolas;color:rgb(242,242,34);background-color:rgb(56,56,56)"><b> n = (nyrs-1)*nmos + NMO</b></p>
<p style="margin:0px;font-size:12px;font-family:Consolas;color:rgb(242,242,34);background-color:rgb(56,56,56)"><b> xSea(nyrs-1) = (xMon(n) + xMon(n-1))*0.5</b></p>
<p style="margin:0px;font-size:12px;font-family:Consolas;color:rgb(242,242,34);background-color:rgb(56,56,56)"><b> end if</b></p></div><div><br></div><div>The function is rather simple and expects the input data to be January to December. If you pass it December to Nov. You would have to trick it by then asking for season JFM to get DJF. It might be better to just find the indices yourself and do some simple averaging. </div><div><br></div><div><br></div><div><div>This line works on my machine to echo the function in question from installed .ncl files to the terminal. </div><div><br></div><div>awk '/"month_to_season"/,/end$/' $NCARG_ROOT/lib/ncarg/nclscripts/csm/*.ncl<br></div><div><br></div><div>This may not work on your machine, and is just an example. If it doesn't work I'm not going to debug the problem.</div></div><div><br></div><div><br></div><div>Good luck. </div><div>~Alan.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 19, 2015 at 1:31 PM, Maria Gehne - NOAA Affiliate <span dir="ltr"><<a href="mailto:maria.gehne@noaa.gov" target="_blank">maria.gehne@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">It won't work. The routine expects the input to have full years, so the time dimension has to be divisible by 12. I haven't played around with the routine enough to know if it would work if you give it full years, but starting in December. So for example:<div><br></div><div>1979-Dec 1980-Jan .... 2001-Oct 2001-Nov</div><div><br></div><div>How about you just try that and see if it works? If it does, I would make sure that the result is what you expect by also computing the averages by index (since you know which months correspond to which indices).</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Maria</div><div><br></div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 19, 2015 at 11:05 AM, Erik Jan Schaffernicht <span dir="ltr"><<a href="mailto:eschaffe@uni-koeln.de" target="_blank">eschaffe@uni-koeln.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Ok, usually 3, single month seasons are dropped, and at the start a
two month season is possible. <br>
<br>
Now imagine I select from a long time covering netcdf a
sub-time-range and create a new netcdf based on that range. <br>
This new one has as a first entry 1979-Dec and goes on like you can
in the next line below. Last entry of my sub-time-file will be
2001-Feb: <br>
<br>
1979-Dec 1980-Jan 1980-Feb 1980-Mar...2000-Nov 2000-Dec
2001-Jan 2001-Feb <br>
<br>
If I now run ncl, ask to read in the slp for YYYY.ge.1979 to
YYYY.ge.2001 of this file and execute then: <br>
<br>
slpSeason= month_to_season(slp, "DJF")<br>
<br>
do I get then my seasonal field based on three months always? Even
for the first season 1979/80 which starts in Dec-1979 (as I deleted
all 1979AD-months before 1979-Dec beforehand)? <br><div><div>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<div>On 19.02.2015 17:55, Maria Gehne - NOAA
Affiliate wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">It should really do that, only the first year
average for DJF is JF and only the last year NDJ is ND. It
doesn't really make sense to talk about seasonal averages when
you only use 2 month averages for one of the season options. And
it's not necessary to only use 2 months for DJF in the middle of
the data where you have DJFs in a row. The reason the
documentation mentions the 2 month averages for the first DJF
and last NDJ average is so that people know those values are
only based on 2 months and not 3 like the rest of the DJF and
NDJ values.
<div><br>
</div>
<div>You can easily test the DJF averages by computing the
averages for a few years yourself and comparing that to the
result from month_to_season.
<div><br>
</div>
<div>Maria</div>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Feb 19, 2015 at 9:18 AM, Daniel
Barandiaran <span dir="ltr"><<a href="mailto:dbarandiaran@gmail.com" target="_blank">dbarandiaran@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote">
<p dir="ltr">does it really do that? my reading of the
documentation suggests that DJF is just JF for all years,
and similarly NDJ is just ND.</p>
<div>
<div>
<div class="gmail_quote">On Feb 19, 2015 8:30 AM, "Maria
Gehne - NOAA Affiliate" <<a href="mailto:maria.gehne@noaa.gov" target="_blank">maria.gehne@noaa.gov</a>>
wrote:<br type="attribution">
<blockquote class="gmail_quote">
<div dir="ltr">Hi Erik,
<div><br>
</div>
<div>month_to_season gives you as many seasons as
you have full years in your data. So if your
data has 13 years then you will end up with 13
values for DJF with the first one only being
computed for JF in the first year. The last
december value will be ignored, because that
would be the 14th season.</div>
<div><br>
</div>
<div>Does that help?</div>
<div><br>
</div>
<div>Maria</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Feb 19, 2015 at
12:56 AM, Erik Jan Schaffernicht <span dir="ltr"><<a href="mailto:eschaffe@uni-koeln.de" target="_blank">eschaffe@uni-koeln.de</a>></span>
wrote:<br>
<blockquote class="gmail_quote">I am not sure
how month_to_season() function works for
DJF (and NDJ is probably similar).<br>
<br>
Say, I select "DJF"<br>
<br>
I take the years like this:<br>
[snip]<br>
iYYYY= ind(YYYY.ge.1979 .and. YYYY.le.2003)<br>
slp= ifle->slp(iYYYY,:,:) + ...
(further steps, input from ncep slp <a href="http://data.nc" target="_blank">data.nc</a>, and I flip some
dimension to make it fitting to formal
requirements)<br>
slpSeason= month_to_season(slp, "DJF")<br>
[snip]<br>
<br>
What does the month_to_season() exactly do?<br>
<br>
My understanding of 'what belongs to a season'
written down looks like this, if I group it by
DJFseason:<br>
<br>
1979-Jan and 1979-Feb<br>
1979-Dec and 1980-Jan and 1980-Feb<br>
...<br>
2002-Dec and 2003-Jan and 2003-Feb<br>
2003-Dec<br>
<br>
How does month_to_season() process this?<br>
It says that DJF takes only two months?
Does it mean only two for the first entry of
this list, i.e. 1979-Jan 1979-Feb but
thereafter it takes always three, so 1979-Dec
+ 1980-Jan+1980-Feb, so three months in
general except for one exception at the
beginning?<br>
Or is it always<br>
1979-Jan-Feb<br>
1980-Jan-Feb<br>
1981-Jan-Feb, so December is skipped
completely? Then the "*D*JF" is confusing!?<br>
<br>
And what happens to the 'lonely' 2003-Dec? It
has no neighbouring DJFmonths due to time
range selection by years AD. Is it skipped?
Or is it: "take this month and define it as a
season"?<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<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>
</blockquote>
</div>
<br>
</div>
<br>
_______________________________________________<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>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a>
</pre>
</blockquote>
<br>
</div></div></div>
<br>_______________________________________________<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></blockquote></div><br></div>
</div></div><br>_______________________________________________<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></blockquote></div><br></div>