[ncl-talk] Creating Time Series Graphs: Plotting Specific Time Periods

Smith, Stuart smit1770 at purdue.edu
Mon Mar 19 12:23:19 MDT 2018


Hello,

 

Listed below is a plotting script that plots the time varying spatial
average of a variable of interest (in this example it is surface water area
). The x-axis plots number of days since (2009/1/1), but I would like to
improve my graph to plot a specific month (March), instead of all of the
values. I have tried editing my NCL resources, but have not been able to
properly extract the time period of interest.  

 

Could I please have assistance, on converting and plotting specific time
periods? I have attached sample data if needed for clarification. Thank you
for your time.

 

Regards,

 

-Stuart 

 

 

 

 

begin

 

;Go to directory of interest 

 

;diri = "/scratch/conte/s/smit1770/TempStorage"

 

 

fili = "/scratch/conte/s/smit1770/TempStorage/surf_area.nc"

;print(fili)   ; make sure the desired files are listed in the correct order

 

; read in all files

 

f = addfile(fili,"r")

 

;Set variable of interest 

data = f->surf_area

;fix the mismatched _FillValue to properly recogonize the missing values
after they are read in

data at _FillValue := todouble (data at missing_value)

 

;data at lat2d = f->Y ;-- 2D latitudes

;data at lon2d = f->X ;-- 2D longitudes

data at time= f->T ;--2D time

;m=(/45.4375,48.9375/)

;n=(/-99.5625,-94.0625/)

 

 

 

 

;printVarSummary(data)

 

 

 

avg_data = wgt_areaave(data,1.,1.,0)

 

;print(data)

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

 

;set resources

resplot = True

restick = True

restick at ttFormat = "%d"

restick at ttmValues= (/(/2009,3,1/),(/2009,3,15/),(/2009,3,31/)/)

 

 

   

resplot at tiMainString      = "Lake Area (m^2)";title name

 

;time_axis_labels( data at time,resplot,restick)

 

 

plot = gsn_csm_xy(wks,data at time,avg_data,resplot)

 

 

end

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180319/b101b712/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: surf_area.nc.tar.gz
Type: application/x-gzip
Size: 1090956 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180319/b101b712/attachment-0001.bin>


More information about the ncl-talk mailing list