<div dir="ltr">Hi Stuart,<div>I think the main issue is that you are joining the files together (you have to as they do not have a time dimension), and the joined time coordinate is not getting converted to be consistent amongst the timesteps.</div><div><br></div><div>Each of your two sample files has a time array with a different units attribute, with time set to 0 for each.</div><div><div><br></div><div>file 1:</div><div>Variable: time (file variable)</div><div>Type: float</div><div>Total Size: 8 bytes</div><div>            2 values</div><div>Number of Dimensions: 1</div><div>Dimensions and sizes:<span style="white-space:pre">      </span>[time | 2]</div><div>Coordinates: </div><div>            time: [ 0..80640]</div><div>Number Of Attributes: 5</div><div>  units :<span style="white-space:pre">     </span>minutes since 2009-01-20 00:00:00</div><div>  long_name :<span style="white-space:pre">       </span>time</div><div>  time_increment :<span style="white-space:pre">       </span>86400</div><div>  begin_date :<span style="white-space:pre">  </span>20090120</div><div>  begin_time :<span style="white-space:pre">       </span>000000</div></div><div><br></div><div>file 2:</div><div><div>Variable: time (file variable)</div><div>Type: float</div><div>Total Size: 8 bytes</div><div>            2 values</div><div>Number of Dimensions: 1</div><div>Dimensions and sizes:<span style="white-space:pre">     </span>[time | 2]</div><div>Coordinates: </div><div>            time: [ 0..80640]</div><div>Number Of Attributes: 5</div><div>  units :<span style="white-space:pre">     </span>minutes since 2009-03-17 00:00:00</div><div>  long_name :<span style="white-space:pre">       </span>time</div><div>  time_increment :<span style="white-space:pre">       </span>86400</div><div>  begin_date :<span style="white-space:pre">  </span>20090317</div><div>  begin_time :<span style="white-space:pre">       </span>000000</div></div><div><br></div><div><br></div><div>By default, addfiles will concatenate and adjust the time variable appropriately.</div><div><br></div><div><div>b = addfiles(fils,"r")</div><div>time = b[:]->time</div></div><div>print(time)</div><div><br></div><div><div>Variable: time</div><div>Type: float</div><div>Total Size: 8 bytes</div><div>            2 values</div><div>Number of Dimensions: 1</div><div>Dimensions and sizes:<span style="white-space:pre">     </span>[time | 2]</div><div>Coordinates: </div><div>            time: [ 0..80640]</div><div>Number Of Attributes: 5</div><div>  units :<span style="white-space:pre">     </span>minutes since 2009-01-20 00:00:00</div><div>  long_name :<span style="white-space:pre">       </span>time</div><div>  time_increment :<span style="white-space:pre">       </span>86400</div><div>  begin_date :<span style="white-space:pre">  </span>20090120</div><div>  begin_time :<span style="white-space:pre">       </span>000000</div><div>(0)<span style="white-space:pre">     </span> 0</div><div>(1)<span style="white-space:pre"> </span>80640</div></div><div><br></div><div>Thus, I think the solution is to continue to join your data arrays through addfiles, but also concatenate the time variable through a separate call to addfiles:</div><div><div>b = addfiles(fils,"r")</div><div>time = b[:]->time</div></div><div><br></div><div><div>a = addfiles(fils,"r")</div><div>ListSetType (a, "join")</div><div>data = a[:]->vic_lake_area_inst</div><div>data@time=a[:]->time</div><div>data!0 = "time"</div><div>data&time = time   ; assign time coordinate variable</div></div><div><br></div><div>; then, farther down your script change this:</div><div>date       = cd_calendar(a[:]->time,0)<br></div><div>to this:</div><div>date       = cd_calendar(data&time,0)<br></div><div><br></div><div>That should do it. If you have any further questions please respond to the ncl-talk email list.</div><div>Adam</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 3, 2018 at 4:00 PM, Smith, Stuart <span dir="ltr"><<a href="mailto:smit1770@purdue.edu" target="_blank">smit1770@purdue.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="#0563C1" vlink="#954F72"><div class="m_-519353721353786357WordSection1"><p class="MsoNormal">Hello,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I am trying to augment my code to improve the display of figures. My goal is to plot variables during specific months. The attached code is currently setup to read in all of the netCDF files from a specific year, join the files, and then plot a variable of interest. <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">When working to plot specific months, I added the “cd_calendar” function to change the values to calendar time. The output I get is listed below, which is also the same as when I print(data@time). This issue is caused by joining the arrays from the list of files.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"> Does anyone have any recommendations to change the array to the correct time format? I have attached sample data and the code. Thank you for your time.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">(362,0) 2009<u></u><u></u></p><p class="MsoNormal">(362,1)  1<u></u><u></u></p><p class="MsoNormal">(362,2)  1<u></u><u></u></p><p class="MsoNormal">(362,3)  0<u></u><u></u></p><p class="MsoNormal">(362,4)  0<u></u><u></u></p><p class="MsoNormal">(362,5)  0<u></u><u></u></p><p class="MsoNormal">(363,0) 2009<u></u><u></u></p><p class="MsoNormal">(363,1)  1<u></u><u></u></p><p class="MsoNormal">(363,2)  1<u></u><u></u></p><p class="MsoNormal">(363,3)  0<u></u><u></u></p><p class="MsoNormal">(363,4)  0<u></u><u></u></p><p class="MsoNormal">(363,5)  0<u></u><u></u></p><p class="MsoNormal">(364,0) 2009<u></u><u></u></p><p class="MsoNormal">(364,1)  1<u></u><u></u></p><p class="MsoNormal">(364,2)  1<u></u><u></u></p><p class="MsoNormal">(364,3)  0<u></u><u></u></p><p class="MsoNormal">(364,4)  0<u></u><u></u></p><p class="MsoNormal">(364,5)  0<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Regards,<span class="HOEnZb"><font color="#888888"><u></u><u></u></font></span></p><span class="HOEnZb"><font color="#888888"><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">-Stuart <u></u><u></u></p></font></span></div></div><br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">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/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist,  </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a>   </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</div>