-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_cice5_restartUV.ncl
153 lines (121 loc) · 4.68 KB
/
plot_cice5_restartUV.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
;************************************************
; These files are loaded by default in NCL V6.2.0 and newer
; 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/contrib/cd_string.ncl"
;************************************************
;
;************************************************
batch = "no"
hemi="NH"
;hemi="SH"
minlat = 66.0
;minlat = 76.0
;minlat = 88.0
;minlat = 80.0
vmag = 0.50
vthn = 0.008
rad2deg=180.d0/acos(-1.0d0)
begin
;************************************************
; read in netCDF file
;************************************************
RT1 = "/scratch3/NCEPDEV/stmp1/Denise.Worthen/"
RT2 = "/scratch3/NCEPDEV/stmp2/Denise.Worthen/"
RT3 = "/scratch3/NCEPDEV/stmp3/Denise.Worthen/"
RT4 = "/scratch4/NCEPDEV/stmp4/Denise.Worthen/"
cdate = "2011040100"
;cdate = "2011090100"
cice5 = "cice5_model_0.25.res_"+cdate+".nc"
; this copy contains the center lats and lons in degrees, which
; is more convenient for plotting
dirsrc = "/scratch4/NCEPDEV/ocean/save/Denise.Worthen/NEMS_INPUT0.1/cice_data/mx024/"
; load the grid file
gr = addfile(dirsrc+"grid_cice_NEMS_mx025.nc","r")
icelonname = "lonT"
icelatname = "latT"
anglename = "anglet"
cice5file = addfile(RT1+cice5,"r")
wkstitle="restarts"+cdate
rotang = gr->$anglename$
ut = cice5file->uvel
vt = cice5file->vvel
ut@_FillValue = default_fillvalue("double")
vt@_FillValue = default_fillvalue("double")
ut@lon2d=gr->$icelonname$
ut@lat2d=gr->$icelatname$
vt@lon2d=gr->$icelonname$
vt@lat2d=gr->$icelatname$
; copy metadata
urot = ut
vrot = vt
urot = cos(rotang)*ut - sin(rotang)*vt
vrot = sin(rotang)*ut + cos(rotang)*vt
;printVarSummary(urot)
urot = where(urot@lat2d .ge. minlat, urot, ut@_FillValue)
vrot = where(vrot@lat2d .ge. minlat, vrot, vt@_FillValue)
print("urot min = "+min(urot)+" urot max = "+max(urot))
print("vrot min = "+min(vrot)+" vrot max = "+max(vrot))
;************************************************
; add a poly line showing the polar seem along
; great circle path from (lon1,lat1) to (lon2,lat2)
;************************************************
lon1=60.00
lon2=-120.00
lat1=60
lat2=60
;************************************************
; define the map
;************************************************
wkstype="X11"
;wkstype="png"
wkstype@wkWidth=800
wkstype@wkHeight=800
wks = gsn_open_wks (wkstype,"cice_uv") ; send graphics to X11 window
res = True ; plot mods desired
res@gsnDraw = False ; do not draw until the end
res@gsnFrame = False ; do not automatically advance 'frame'
res@vcRefMagnitudeF = vmag ; vec magnitude
res@vcRefLengthF = 0.10 ; size of ref vector
;res@vcMonoLineArrowColor = True ; multiple colors desired
res@vcMinDistanceF = vthn ; thins arrows near pole
;res@vcLineArrowThicknessF = 1.5
;res@vcGlyphStyle = "CurlyVector"
;res@vcPositionMode = "ArrowTail"
res@gsnPolar = hemi ; specify the hemisphere
if(hemi .eq. "NH")then
res@mpMinLatF = minlat ; minimum lat to plot
res@mpCenterLonF = -45
end if
if(hemi .eq. "SH")then
res@mpMaxLatF = -50 ; minimum lat to plot
res@mpCenterLonF = 0.0
end if
;************************************************
; Resources for the polyline
;************************************************
res@mpGreatCircleLinesOn = True
pres = True ; polyline mods desired
pres@gsLineThicknessF = 2.0 ; line thickness
pres@gsLineColor = "black" ; color of lines
pres@gsLineDashPattern = 1 ; dashes
;pres@tfPolyDrawOrder = "postDraw"
;************************************************
;
;************************************************
;plot = gsn_csm_vector_scalar_map_polar(wks,urot,vrot,avar,res) ; create the plot
plot = gsn_csm_vector_map_polar(wks,urot,vrot,res) ; create the plot
;plot = gsn_csm_contour_map_polar(wks,avar,res) ; create the plot
;dum= gsn_add_polyline(wks,plot,(/lon1, lon2/) , (/lat1, lat2/) ,pres)
;draw(plot)
;frame(wks)
;plot = gsn_csm_contour_map_polar(wks,vvar,res) ; create the plot
;dum= gsn_add_polyline(wks,plot,(/lon1, lon2/) , (/lat1, lat2/) ,pres)
;draw(plot)
;frame(wks)
;plot = gsn_csm_contour_map_polar(wks,avar,res) ; create the plot
dum= gsn_add_polyline(wks,plot,(/lon1, lon2/) , (/lat1, lat2/) ,pres)
draw(plot)
frame(wks)
exit
end