forrest@0
|
1 |
;************************************************
|
forrest@0
|
2 |
; read from /ptmp/
|
forrest@0
|
3 |
; output NPP, NEE
|
forrest@0
|
4 |
;************************************************
|
forrest@0
|
5 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
|
forrest@0
|
6 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
|
forrest@0
|
7 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
|
forrest@0
|
8 |
;************************************************
|
forrest@0
|
9 |
begin
|
forrest@0
|
10 |
|
forrest@0
|
11 |
; input data
|
forrest@0
|
12 |
|
forrest@0
|
13 |
model_name = "i01.10casa"
|
forrest@0
|
14 |
|
forrest@0
|
15 |
nlat = 64
|
forrest@0
|
16 |
nlon = 128
|
forrest@0
|
17 |
|
forrest@0
|
18 |
year_start = 1991
|
forrest@0
|
19 |
year_end = 2004
|
forrest@0
|
20 |
|
forrest@0
|
21 |
diri = "/ptmp/jeff/"+model_name+"/"
|
forrest@0
|
22 |
|
forrest@0
|
23 |
system("mkdir "+diri)
|
forrest@0
|
24 |
|
forrest@0
|
25 |
; output
|
forrest@0
|
26 |
|
forrest@0
|
27 |
diro = "/ptmp/jeff/"
|
forrest@0
|
28 |
filo = model_name + "_Fire_C_"+year_start+"-"+year_end+"_monthly.nc"
|
forrest@0
|
29 |
c = addfile(diro+filo,"c")
|
forrest@0
|
30 |
filedimdef(c,"year",-1,True)
|
forrest@0
|
31 |
|
forrest@0
|
32 |
|
forrest@0
|
33 |
nyear = year_end - year_start + 1
|
forrest@0
|
34 |
nmonth = 12
|
forrest@0
|
35 |
|
forrest@0
|
36 |
; data1 = new((/nyear,nmonth,nlat,nlon/),float)
|
forrest@0
|
37 |
data2 = new((/nyear,nmonth,nlat,nlon/),float)
|
forrest@0
|
38 |
data3 = new((/nyear,nmonth,nlat,nlon/),float)
|
forrest@0
|
39 |
date = new((/nyear,nmonth/),integer)
|
forrest@0
|
40 |
|
forrest@0
|
41 |
; input from /ptmp/
|
forrest@0
|
42 |
|
forrest@0
|
43 |
|
forrest@0
|
44 |
do m = 0,nyear-1
|
forrest@0
|
45 |
year = year_start + m
|
forrest@0
|
46 |
|
forrest@0
|
47 |
; text = "mss:/FORREST/CCSM/results/"+model_name+"/lnd/hist/*"+year+"* "
|
forrest@0
|
48 |
; print (text)
|
forrest@0
|
49 |
|
forrest@0
|
50 |
; system("msrcp "+text+diri)
|
forrest@0
|
51 |
; system("dcswait")
|
forrest@0
|
52 |
print (year)
|
forrest@0
|
53 |
|
forrest@0
|
54 |
do n = 0,nmonth-1
|
forrest@0
|
55 |
nn = n+1
|
forrest@0
|
56 |
date(m,n) = year*100 +nn
|
forrest@0
|
57 |
|
forrest@0
|
58 |
; input file
|
forrest@0
|
59 |
if (nn .ge. 10) then
|
forrest@0
|
60 |
fili = model_name+".clm2.h0."+year+"-"+nn+".nc"
|
forrest@0
|
61 |
else
|
forrest@0
|
62 |
fili = model_name+".clm2.h0."+year+"-0"+nn+".nc"
|
forrest@0
|
63 |
end if
|
forrest@0
|
64 |
|
forrest@0
|
65 |
; print (fili)
|
forrest@0
|
66 |
|
forrest@0
|
67 |
g = addfile (diri+fili,"r")
|
forrest@0
|
68 |
|
forrest@0
|
69 |
; b1 = g->COL_FIRE_CLOSS
|
forrest@0
|
70 |
; data1(m,n,:,:) = (/b1(0,:,:)/)
|
forrest@0
|
71 |
|
forrest@0
|
72 |
b2 = g->NPP
|
forrest@0
|
73 |
data2(m,n,:,:) = (/b2(0,:,:)/)
|
forrest@0
|
74 |
|
forrest@0
|
75 |
b3 = g->NEE
|
forrest@0
|
76 |
data3(m,n,:,:) = (/b3(0,:,:)/)
|
forrest@0
|
77 |
|
forrest@0
|
78 |
end do
|
forrest@0
|
79 |
|
forrest@0
|
80 |
; system("rm "+diri+"*")
|
forrest@0
|
81 |
|
forrest@0
|
82 |
end do
|
forrest@0
|
83 |
|
forrest@0
|
84 |
; name dimensions and assign coordinate variables
|
forrest@0
|
85 |
|
forrest@0
|
86 |
; data1!0 ="year"
|
forrest@0
|
87 |
; data1!1 ="month"
|
forrest@0
|
88 |
; data1!2 = "lat"
|
forrest@0
|
89 |
; data1!3 = "lon"
|
forrest@0
|
90 |
; data1@long_name = b1@long_name
|
forrest@0
|
91 |
; data1@units = b1@units
|
forrest@0
|
92 |
; data1@_FillValue = b1@_FillValue
|
forrest@0
|
93 |
|
forrest@0
|
94 |
data2!0 ="year"
|
forrest@0
|
95 |
data2!1 ="month"
|
forrest@0
|
96 |
data2!2 = "lat"
|
forrest@0
|
97 |
data2!3 = "lon"
|
forrest@0
|
98 |
data2@long_name = b2@long_name
|
forrest@0
|
99 |
data2@units = b2@units
|
forrest@0
|
100 |
data2@_FillValue = b2@_FillValue
|
forrest@0
|
101 |
|
forrest@0
|
102 |
data3!0 ="year"
|
forrest@0
|
103 |
data3!1 ="month"
|
forrest@0
|
104 |
data3!2 = "lat"
|
forrest@0
|
105 |
data3!3 = "lon"
|
forrest@0
|
106 |
data3@long_name = b3@long_name
|
forrest@0
|
107 |
data3@units = b3@units
|
forrest@0
|
108 |
data3@_FillValue = b3@_FillValue
|
forrest@0
|
109 |
|
forrest@0
|
110 |
date!0 ="year"
|
forrest@0
|
111 |
date!1 ="month"
|
forrest@0
|
112 |
date@long_name = "date: yyyymm"
|
forrest@0
|
113 |
|
forrest@0
|
114 |
; c->COL_FIRE_CLOSS = data1
|
forrest@0
|
115 |
c->NPP = data2
|
forrest@0
|
116 |
c->NEE = data3
|
forrest@0
|
117 |
c->date = date
|
forrest@0
|
118 |
c->area = g->area
|
forrest@0
|
119 |
|
forrest@0
|
120 |
print (date)
|
forrest@0
|
121 |
|
forrest@0
|
122 |
end
|