-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathplot-timeseries.ncl
79 lines (49 loc) · 1.68 KB
/
plot-timeseries.ncl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
;;; NCL script for plotting 1-D netcdf file
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
;; Uncomment the following variables to hard-code them here, or pass
;; values in via command-line, e.g.:
;; ncl varname=\"tas\" infile=\"tas_CRCM_1979010103.nc\" outfile=\"plots/tas_CRCM_1979010103\" title=\"tas_CRCM_1979010103.nc\ \" time-section-plot.ncl
; varname = "tas"
; infile = "tas_CRCM_1986010103.nc"
; outfile = "plot-test"
; title = systemfunc("basename "+infile)+" "
if (.not. isvar("title")) then
title = systemfunc("basename "+infile)+" "
end if
fin = addfile(infile, "r")
time = fin->time
dims = filevardimsizes(fin,varname)
ny = dims(1)
nx = dims(2)
x0 = nx/2
y0 = ny/2
res = True
res@cnFillOn = True
res@cnLinesOn = False
res@cnFillMode = "RasterFill"
res@lbLabelAutoStride = True
res@lbBoxLinesOn = False
res@lbOrientation = "Vertical"
res@gsnSpreadColors = True
res@gsnMaximize = True
res@gsnPaperOrientation = "landscape"
res@vpWidthF = 1.0
res@vpHeightF = 0.3
;; create the plot
wks = gsn_open_wks("ps", outfile)
tres = True
tres@gsnMaximize = True
tres@gsnPaperOrientation = "landscape"
tres@vpWidthF = 1.0
tres@vpHeightF = 0.3
tres@tiMainString = title
tres@xyMarkLineMode = "Markers"
tres@xyMarker = 1
tres@xyMarkerSizeF = 0.01
plot = gsn_csm_xy(wks, time, fin->$varname$(:,y0,x0), tres)
delete(wks)
exit
;; Copyright 2009-2012 Univ. Corp. for Atmos. Research
;; Author: Seth McGinnis, [email protected]