<div dir="ltr"><div class="gmail_default" style="font-size:small">I gave you an old version of the script. See this slightly better one, although either one should work.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 11, 2016 at 3:59 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">You need to be able to extract day 1 of months 3, 6, 9, and 12 from your time array so that you can locate where to put the MAM, JJA, SON, and DJF labels.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">If your time array is one that is in a "standard" format like "days since 2004-1-1" or "months since 2004", then you can use cd_calendar to extract the years, months, days, etc:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><div class="gmail_default"><font face="monospace, monospace">;---Reverse engineer the time array to get back year, month, day, etc dates = cd_calendar(time,0) ; n x 6 array </font><span style="font-family:monospace,monospace">years = toint(dates(:,0))</span></div><div class="gmail_default"><font face="monospace, monospace"> months = toint(dates(:,1))</font></div><div class="gmail_default"><font face="monospace, monospace"> days = toint(dates(:,2))</font></div><div><br></div></div><div class="gmail_default" style="font-size:small">You can then use this information to get the desired indexes from your time array:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace">;---Start constructing the strings for the X axis labels </font></div><div class="gmail_default"><span style="font-family:monospace,monospace"> month_vals = (/ 3, 6, 9, 12/) ; months where we want labels </span></div><div class="gmail_default"><font face="monospace, monospace"> season_strs = (/"MAM","JJA","SON","DJF"/) + "-" </font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">;---Get the indexes for the first day of the month for the first month of each season </font></div><div class="gmail_default"><font face="monospace, monospace"> ii = ind(months.eq.3.or.months.eq.6.or.months.eq.9.or.months.eq.12.and.days.eq.1)</font></div><div class="gmail_default"><font face="monospace, monospace"> nii = dimsizes(ii)</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace"> xaxis_labels = new(nii,string)</font></div><div class="gmail_default"><font face="monospace, monospace"> do n=0,dimsizes(month_vals)-1</font></div><div class="gmail_default"><font face="monospace, monospace"> xaxis_labels = where(months(ii).eq.month_vals(n),season_strs(n)+years(ii),xaxis_labels)</font></div><div class="gmail_default"><font face="monospace, monospace"> end do</font></div></div><div class="gmail_default" style="font-size:small"></div><div class="gmail_default" style="font-size:small">See the attached script, which uses a dummy array to create an XY plot with the time labels on the X axis.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Mon, Mar 7, 2016 at 12:41 PM, sudipta sarkar <span dir="ltr"><<a href="mailto:sdptsarkar2@gmail.com" target="_blank">sdptsarkar2@gmail.com</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="h5"><div dir="ltr">Hi Folks<div>I want to plot a pressure-height plot against seasonal values (DJF,MAM,JJA,SON) for different years. My variable has dimensions for season, time and level. </div><div><br></div><div>I can collapse the merge the season and time dimensions to show have a 2D array of time and level but I am not sure how to get a pressure-time plot from this where the x-axis will be labeled in terms of seasons from different years like: DJF-2004,MAM-04,JJA-2004,SON-2004,DJF-2005 like this. </div><div><br></div><div>Any suggestion how I can get this done?</div><div><br></div><div>Regards</div><div><br></div></div>
<br></div></div>_______________________________________________<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/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>