[ncl-talk] NCL Creating Time Series Plots

Adam Phillips asphilli at ucar.edu
Thu Jan 18 10:31:58 MST 2018


Hi Stuart,
If the files are sequentially named, you can use addfiles to read all the
files at once:

begin
   fils = systemfunc("ls *.d01.nc")
   print(fils)   ; make sure the desired files are listed in the correct
order
   a = addfiles(fils,"r")
   data = a[:]->Depth_of_water    ; assuming variable name is Depth_of_water
   print(data&time)   ; check that the times read in are correct
   printVarSummary(data)    ; examine data array

   data_aa = wgt_areaave(data,1.,1.,0)   ; Not applying any area-weight to
the data

   wks = gsn_open_wks("png","timeseries")

   res = True
   ...   ; set desired resources here

  plot = gsn_csm_xy(wks,ispan(0,dimsizes(data&time)-1,1,data_aa,res)
end

Note:
1 - Make sure that the results from systemfunc list the files that you want
to read in in the correct order.
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.
3 - There are lots of different resources that can be set for timeseries,
specifically for the tickmarks. Review the examples here:
http://www.ncl.ucar.edu/Applications/xy.shtml
http://www.ncl.ucar.edu/Applications/time_labels.shtml
http://www.ncl.ucar.edu/Applications/tickmarks.shtml

Hope that helps. If you have any further questions please respond to the
ncl-talk email list.
Adam





On Wed, Jan 17, 2018 at 2:24 PM, Smith, Stuart via ncl-talk <
ncl-talk at ucar.edu> wrote:

> Good afternoon,
>
>
>
> 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.
>
>
>
> I am wanting to learn about generating time series plots with .nc files.
> The .nc files I have are daily timesteps (200903250000.d01.nc,
> 200903260000.d01.nc). I would like to plot the .nc files as a spatially
> averaged(ex. Depth of water)  time series plot for an entire month.
>
>
>
> 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.
>
>
>
> Could you please provide some examples of how this problem has been solved
> in the past? Thank you for your time.
>
>
>
> Regards,
>
>
>
> -Stuart
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>


-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180118/0bfefde7/attachment.html>


More information about the ncl-talk mailing list