forked from cycle13/Code-NCL-1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEOF分析及图像.ncl
More file actions
140 lines (98 loc) · 3.99 KB
/
Copy pathEOF分析及图像.ncl
File metadata and controls
140 lines (98 loc) · 3.99 KB
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
;========================================================
;ÓÃÓÚ¼ÆËã²¢»³öGeopotential HeightµÄEOF·ÖÎö¼°Í¼Ïñ
;========================================================
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"
begin
filepath="G:/hgt.mon.mean.nc"
data=addfile(filepath,"r")
;===============ÉèÖÃ×ö·Ö½âµÄµØÇøÓëʱ¼ä¶Î=================
lonL=72.
lonR=136.
latS=17.
latN=55.
yrStrt=1990
yrLast=2003
TIME=data->time
iy=ut_calendar(TIME,-1)/100 ;½«×ÊÁÏʱ¼äתΪÊÀ½çʱ
t=ind(iy.ge.yrStrt .and. iy.le.yrLast);ѡȡËùÐèʱ¶ÎµÄÐòºÅ
neof = 3 ; number of EOFs
;====================¹ØÓÚEOFº¯ÊýµÄһЩÊôÐÔÉèÖÃ===========
optEOF = True
optEOF@jopt = 0
optETS = False
optAve=0
;=============¶ÁÈ¡×ÊÁϲ¢½«¸ñʽת»»³ÉÓëEOFº¯ÊýÏàÊÊÓ¦======
hgt=data->hgt(t,0,:,:)
hgt=lonFlip(hgt)
HGT=hgt({lat|latS:latN},{lon|lonL:lonR},time|:)
;=============½øÐÐEOF¼°Ïà¹ØÊ±¼äϵÊýµÄ´¦Àí================
eof=eofunc_Wrap(HGT,neof,optEOF)
eof_ts=eofunc_ts_Wrap (HGT,eof,optETS)
year = ut_calendar(eof_ts&time,4)
ave=runave_n_Wrap(eof_ts,7,optAve,1) ;¶Ôʱ¼äϵÊý×÷»¬¶¯Æ½¾ù(7 mons)
year_ave=ut_calendar(ave&time,4)
wks=gsn_open_wks("x11","EOF")
gsn_define_colormap(wks,"BlWhRe")
;=============EOFͼÏñµÄÊôÐÔÉèÖÃ==========================
res=True
res@gsnDraw=False
res@gsnFrame=False
res@gsnSpreadColors=True
res@gsnAddCyclic=False
res@mpMinLatF=latS
res@mpMaxLatF=latN
res@mpMinLonF=lonL
res@mpMaxLonF=lonR
res@mpDataSetName = "Earth..4"
res@mpDataBaseVersion = "MediumRes"
res@mpOutlineOn = True
res@mpOutlineSpecifiers = (/"China:states","Taiwan"/)
res@mpMaskAreaSpecifiers = (/"China:states","Taiwan"/)
res@mpPerimOn = True
res@mpGridMaskMode = "MaskLand"
res@mpOceanFillColor = 0
res@mpInlandWaterFillColor = 0
res@cnFillOn=True
res@cnLinesOn=False
res@cnFillDrawOrder="PreDraw"
res@lbLabelBarOn = False
;==========EOFʱ¼äϵÊýͼÏñµÄÊôÐÔÉèÖÃ=====================
rts = True
rts@gsnScale = True
rts@gsnDraw = False
rts@gsnFrame = False
rts@gsnYRefLine = 0. ;ÉèÖòο¼Ïß
rts@gsnXYBarChart = True ;Ñ¡Ôñ»µÄͼΪÖù״ͼ
rts@gsnAboveYRefLineColor = "white" ;²Î¿¼ÏßÉÏϲ¿Í¼ÏñÓë²Î¿¼Ïß
rts@gsnBelowYRefLineColor = "white" ;Χ³ÉͼÐεÄÑÕÉ«ÉèÖÃ
rts@vpWidthF = 0.70
rts@vpHeightF = 0.26
rts@tiYAxisString = ""
;=========»¬¶¯Æ½¾ùºóµÄʱ¼äϵÊýͼÏñµÄÊôÐÔÉèÖÃ=============
r_ave=True
r_ave@gsnScale = True
r_ave@gsnDraw = False
r_ave@gsnFrame = False
r_ave@xyLineThicknessF = 1.5 ;ÉèÖû¬¶¯ÇúÏߵĴÖϸ
r_ave@xyMarkLineMode = "MarkLines" ;ÉèÖû¬¶¯ÇúÏßµÄÐÎʽ
r_ave@xyMarker = 1 ;ÉèÖÃÃè»æµÄÊý¾ÝµãµÄ¸ñʽ
r_ave@xyMarkerSizeF = 0.03 ;ÉèÖÃÊý¾ÝµãµÄ´óС
;===============¿ØÖưåµÄÊôÐÔÉèÖÃ=========================
resP = True
resP@gsnPanelLabelBar = True
resP@lbOrientation = "Vertical"
resP@gsnPanelPerimOn = True
resP@lbLabelAutoStride = True
plot=new((/2,neof/),graphic)
do i=0,neof-1
res@gsnLeftString = "EOF"+(i+1)+" of Geopotential Height in China"
res@gsnRightString = sprintf("%5.1f", eof@pcvar(i)) +"%"
plot(0,i)=gsn_csm_contour_map(wks,eof(i,:,:),res)
plot(1,i)=gsn_csm_xy(wks,year,eof_ts(i,:),rts)
pl=gsn_csm_xy(wks,year_ave,ave(i,:),r_ave)
overlay(plot(1,i),pl)
gsn_panel(wks,plot(:,i),(/2,1/),resP)
end do
end