<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
span.hoenzb
{mso-style-name:hoenzb;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Good afternoon Adam,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Thank you for the input. I’ve learned a lot. In the example you provided, “data” was assumed to have the variable time with the depth of water. In my .nc files depth of water and time are not named in the same dimension.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>As a result I get the following message, “fatal:(time) is not a named dimension in variable (data). “ I tried to adjust the script by assigning a time variable to the defined data variable as shown below. However, this was unsuccessful. Any advice? Thank you for your time.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>begin<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>diri = "/scratch/conte/s/smit1770/RRB_Test_Simulation/RedRiver/OUTPUT_8x6.1hr_2018/SURFACEMODEL/200903/"<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>;fils = systemfunc("ls *.d01.nc")<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>fils = systemfunc("ls "+diri+"*.d01.nc") <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>;print(fils) ; make sure the desired files are listed in the correct order<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'> <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'> a = addfiles(fils,"r")<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'> data = a[:]->vic_lake_depth_inst<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'> data@time=a[:]->time<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'> ;time = a[:]->time ; assuming variable name is Depth_of_water<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'> ;print(time)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'> ;print(data)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'> print(data&time) ; check that the times read in are correct<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'> ;printVarSummary(data) ; examine data array<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'> data_aa = wgt_areaave(data,1.,1.,0) ; Not applying any area-weight to the data<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'> wks = gsn_open_wks("png","timeseries")<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'> res = True<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'> res@tmXBMode = "Explicit" ; explicit labels<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'> res@tmXBValues = time ; location of labels <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'> res@tmXBLabels = "Test" ; labels themselves<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'> res@tmLabelAutoStride = True ; nice stride on labels<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'> res@tiMainString = "Explicit axis labeling"; title<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'> ;plot = gsn_csm_xy(wks,ispan(0,dimsizes(data&time)-1,1,data_aa,res)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'> plot = gsn_csm_xy(wks,ispan(0,dimsizes(data&time)-1,1),data_aa,res)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>end<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Regards,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>-Stuart<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'> Adam Phillips [mailto:asphilli@ucar.edu] <br><b>Sent:</b> Thursday, January 18, 2018 12:32 PM<br><b>To:</b> Smith, Stuart <smit1770@purdue.edu><br><b>Cc:</b> Ncl-talk <ncl-talk@ucar.edu><br><b>Subject:</b> Re: [ncl-talk] NCL Creating Time Series Plots<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>Hi Stuart,<o:p></o:p></p><div><p class=MsoNormal>If the files are sequentially named, you can use addfiles to read all the files at once:<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>begin<o:p></o:p></p></div><div><p class=MsoNormal> fils = systemfunc("ls *.<a href="http://d01.nc" target="_blank">d01.nc</a>")<o:p></o:p></p></div><div><p class=MsoNormal> print(fils) ; make sure the desired files are listed in the correct order<o:p></o:p></p></div><div><p class=MsoNormal> a = addfiles(fils,"r")<o:p></o:p></p></div><div><p class=MsoNormal> data = a[:]->Depth_of_water ; assuming variable name is Depth_of_water<o:p></o:p></p></div><div><p class=MsoNormal> print(data&time) ; check that the times read in are correct<o:p></o:p></p></div><div><p class=MsoNormal> printVarSummary(data) ; examine data array<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal> data_aa = wgt_areaave(data,1.,1.,0) ; Not applying any area-weight to the data<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal> wks = gsn_open_wks("png","timeseries")<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal> res = True<o:p></o:p></p></div><div><p class=MsoNormal> ... ; set desired resources here<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal> plot = gsn_csm_xy(wks,ispan(0,dimsizes(data&time)-1,1,data_aa,res)<o:p></o:p></p></div><div><p class=MsoNormal>end<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Note:<o:p></o:p></p></div><div><p class=MsoNormal>1 - Make sure that the results from systemfunc list the files that you want to read in in the correct order.<o:p></o:p></p></div><div><p class=MsoNormal>2 - You may very well want to area weight the data, and this may have to be done by hand as I do not believe a function exists that can do that on an array with 2-dimensional latitudes/longitudes. <o:p></o:p></p></div><div><p class=MsoNormal>3 - There are lots of different resources that can be set for timeseries, specifically for the tickmarks. Review the examples here:<o:p></o:p></p></div><div><p class=MsoNormal><a href="http://www.ncl.ucar.edu/Applications/xy.shtml" target="_blank">http://www.ncl.ucar.edu/Applications/xy.shtml</a><o:p></o:p></p></div><div><p class=MsoNormal><a href="http://www.ncl.ucar.edu/Applications/time_labels.shtml" target="_blank">http://www.ncl.ucar.edu/Applications/time_labels.shtml</a><o:p></o:p></p></div><div><p class=MsoNormal><a href="http://www.ncl.ucar.edu/Applications/tickmarks.shtml" target="_blank">http://www.ncl.ucar.edu/Applications/tickmarks.shtml</a><o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal>Hope that helps. If you have any further questions please respond to the ncl-talk email list.<o:p></o:p></p></div><div><p class=MsoNormal>Adam<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div></div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Wed, Jan 17, 2018 at 2:24 PM, Smith, Stuart via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>> wrote:<o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Good afternoon,<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>My name is Stuart, and I am research assistant at Purdue University.. I tried using the serach ncl-talk archives, but received a “URL Not Found” message.<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>I am wanting to learn about generating time series plots with .nc files. The .nc files I have are daily timesteps (<a href="http://200903250000.d01.nc" target="_blank">200903250000.d01.nc</a>, <a href="http://200903260000.d01.nc" target="_blank">200903260000.d01.nc</a>). I would like to plot the .nc files as a spatially averaged(ex. Depth of water) time series plot for an entire month. <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>The dimension of time is 1, as to be expected. The dimension of the variable of interest is 2 [north_south|32] x [east_west |45]. My goal would be to calculate the average value over this area, and plot it with the appropriate day to create the time series.<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Could you please provide some examples of how this problem has been solved in the past? Thank you for your time.<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Regards,<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='color:#888888'> <o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='color:#888888'>-Stuart <o:p></o:p></span></p></div></div><p class=MsoNormal style='margin-bottom:12.0pt'><br>_______________________________________________<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" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><o:p></o:p></p></blockquote></div><p class=MsoNormal><br><br clear=all><o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal>-- <o:p></o:p></p><div><div><div><div><div><div><div><div><div><div><div><p class=MsoNormal><span style='color:#888888'>Adam Phillips </span><o:p></o:p></p></div><p class=MsoNormal><span style='color:#888888'>Associate Scientist, Climate and Global Dynamics Laboratory, NCAR</span><o:p></o:p></p></div></div><div><p class=MsoNormal><span style='color:#888888'><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a> 303-497-1726 </span><o:p></o:p></p></div><div><div><p class=MsoNormal><o:p> </o:p></p></div></div></div></div></div></div></div></div></div></div></div></div></body></html>