forrest@1
|
1 |
;************************************************
|
forrest@1
|
2 |
; output: lat: N->S lon: -180W->180E
|
forrest@1
|
3 |
;************************************************
|
forrest@1
|
4 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
|
forrest@1
|
5 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
|
forrest@1
|
6 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
|
forrest@1
|
7 |
;************************************************
|
forrest@1
|
8 |
begin
|
forrest@1
|
9 |
|
forrest@1
|
10 |
; output
|
forrest@1
|
11 |
|
forrest@1
|
12 |
model_name = "i01.37cn_cont"
|
forrest@1
|
13 |
|
forrest@1
|
14 |
diro = "/lustre/wolf-ddn/scratch/hof/cases/i01.37cn_cont_out/"
|
forrest@1
|
15 |
filo = model_name + "_Fire_C_2976-3000_monthly.nc"
|
forrest@1
|
16 |
c = addfile(diro+filo,"c")
|
forrest@1
|
17 |
filedimdef(c,"year",-1,True)
|
forrest@1
|
18 |
|
forrest@1
|
19 |
; input data
|
forrest@1
|
20 |
|
forrest@1
|
21 |
nlat = 96
|
forrest@1
|
22 |
nlon = 144
|
forrest@1
|
23 |
|
forrest@1
|
24 |
year_start = 2976
|
forrest@1
|
25 |
year_end = 3000
|
forrest@1
|
26 |
|
forrest@1
|
27 |
nyear = year_end - year_start + 1
|
forrest@1
|
28 |
nmonth = 12
|
forrest@1
|
29 |
|
forrest@1
|
30 |
data1 = new((/nyear,nmonth,nlat,nlon/),float)
|
forrest@1
|
31 |
data2 = new((/nyear,nmonth,nlat,nlon/),float)
|
forrest@1
|
32 |
data3 = new((/nyear,nmonth,nlat,nlon/),float)
|
forrest@1
|
33 |
date = new((/nyear,nmonth/),integer)
|
forrest@1
|
34 |
|
forrest@1
|
35 |
; input dir
|
forrest@1
|
36 |
diri = "/lustre/wolf-ddn/scratch/hof/cases/"+model_name+"/"
|
forrest@1
|
37 |
|
forrest@1
|
38 |
do m = 0,nyear-1
|
forrest@1
|
39 |
year = year_start + m
|
forrest@1
|
40 |
do n = 0,nmonth-1
|
forrest@1
|
41 |
nn = n+1
|
forrest@1
|
42 |
date(m,n) = year*100 +nn
|
forrest@1
|
43 |
|
forrest@1
|
44 |
; input file
|
forrest@1
|
45 |
if (nn .ge. 10) then
|
forrest@1
|
46 |
fili = model_name+".clm2.h0."+year+"-"+nn+".nc"
|
forrest@1
|
47 |
else
|
forrest@1
|
48 |
fili = model_name+".clm2.h0."+year+"-0"+nn+".nc"
|
forrest@1
|
49 |
end if
|
forrest@1
|
50 |
|
forrest@1
|
51 |
; print (fili)
|
forrest@1
|
52 |
|
forrest@1
|
53 |
g = addfile (diri+fili,"r")
|
forrest@1
|
54 |
|
forrest@1
|
55 |
b1 = g->COL_FIRE_CLOSS
|
forrest@1
|
56 |
data1(m,n,:,:) = (/b1(0,:,:)/)
|
forrest@1
|
57 |
|
forrest@1
|
58 |
b2 = g->NPP
|
forrest@1
|
59 |
data2(m,n,:,:) = (/b2(0,:,:)/)
|
forrest@1
|
60 |
|
forrest@1
|
61 |
b3 = g->NEE
|
forrest@1
|
62 |
data3(m,n,:,:) = (/b3(0,:,:)/)
|
forrest@1
|
63 |
end do
|
forrest@1
|
64 |
end do
|
forrest@1
|
65 |
|
forrest@1
|
66 |
; name dimensions and assign coordinate variables
|
forrest@1
|
67 |
|
forrest@1
|
68 |
data1!0 ="year"
|
forrest@1
|
69 |
data1!1 ="month"
|
forrest@1
|
70 |
data1!2 = "lat"
|
forrest@1
|
71 |
data1!3 = "lon"
|
forrest@1
|
72 |
data1@long_name = b1@long_name
|
forrest@1
|
73 |
data1@units = b1@units
|
forrest@1
|
74 |
data1@_FillValue = b1@_FillValue
|
forrest@1
|
75 |
|
forrest@1
|
76 |
data2!0 ="year"
|
forrest@1
|
77 |
data2!1 ="month"
|
forrest@1
|
78 |
data2!2 = "lat"
|
forrest@1
|
79 |
data2!3 = "lon"
|
forrest@1
|
80 |
data2@long_name = b2@long_name
|
forrest@1
|
81 |
data2@units = b2@units
|
forrest@1
|
82 |
data2@_FillValue = b2@_FillValue
|
forrest@1
|
83 |
|
forrest@1
|
84 |
data3!0 ="year"
|
forrest@1
|
85 |
data3!1 ="month"
|
forrest@1
|
86 |
data3!2 = "lat"
|
forrest@1
|
87 |
data3!3 = "lon"
|
forrest@1
|
88 |
data3@long_name = b3@long_name
|
forrest@1
|
89 |
data3@units = b3@units
|
forrest@1
|
90 |
data3@_FillValue = b3@_FillValue
|
forrest@1
|
91 |
|
forrest@1
|
92 |
date!0 ="year"
|
forrest@1
|
93 |
date!1 ="month"
|
forrest@1
|
94 |
date@long_name = "date: yyyymm"
|
forrest@1
|
95 |
|
forrest@1
|
96 |
c->COL_FIRE_CLOSS = data1
|
forrest@1
|
97 |
c->NPP = data2
|
forrest@1
|
98 |
c->NEE = data3
|
forrest@1
|
99 |
c->date = date
|
forrest@1
|
100 |
c->area = g->area
|
forrest@1
|
101 |
|
forrest@1
|
102 |
print (date)
|
forrest@1
|
103 |
|
forrest@1
|
104 |
end
|