forrest@0
|
1 |
;********************************************************
|
forrest@0
|
2 |
;using model biome vlass
|
forrest@0
|
3 |
;
|
forrest@0
|
4 |
; required command line input parameters:
|
forrest@0
|
5 |
; ncl 'model_name="10cn" model_grid="T42" dirm="/.../ film="..."' 01.npp.ncl
|
forrest@0
|
6 |
;
|
forrest@0
|
7 |
; histogram normalized by rain and compute correleration
|
forrest@0
|
8 |
;**************************************************************
|
forrest@0
|
9 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
|
forrest@0
|
10 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
|
forrest@0
|
11 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
|
forrest@0
|
12 |
;**************************************************************
|
forrest@0
|
13 |
procedure set_line(lines:string,nline:integer,newlines:string)
|
forrest@0
|
14 |
begin
|
forrest@0
|
15 |
; add line to ascci/html file
|
forrest@0
|
16 |
|
forrest@0
|
17 |
nnewlines = dimsizes(newlines)
|
forrest@0
|
18 |
if(nline+nnewlines-1.ge.dimsizes(lines))
|
forrest@0
|
19 |
print("set_line: bad index, not setting anything.")
|
forrest@0
|
20 |
return
|
forrest@0
|
21 |
end if
|
forrest@0
|
22 |
lines(nline:nline+nnewlines-1) = newlines
|
forrest@0
|
23 |
; print ("lines = " + lines(nline:nline+nnewlines-1))
|
forrest@0
|
24 |
nline = nline + nnewlines
|
forrest@0
|
25 |
return
|
forrest@0
|
26 |
end
|
forrest@0
|
27 |
;**************************************************************
|
forrest@0
|
28 |
; Main code.
|
forrest@0
|
29 |
begin
|
forrest@0
|
30 |
|
forrest@0
|
31 |
plot_type = "ps"
|
forrest@0
|
32 |
plot_type_new = "png"
|
forrest@0
|
33 |
|
forrest@0
|
34 |
;************************************************
|
forrest@0
|
35 |
; model name and grid
|
forrest@0
|
36 |
;************************************************
|
forrest@0
|
37 |
|
forrest@0
|
38 |
model_grid = "T42"
|
forrest@0
|
39 |
|
forrest@0
|
40 |
model_name = "cn"
|
forrest@0
|
41 |
model_name1 = "i01.06cn"
|
forrest@0
|
42 |
model_name2 = "i01.10cn"
|
forrest@0
|
43 |
|
forrest@0
|
44 |
;---------------------------------------------------
|
forrest@0
|
45 |
; get biome data: model
|
forrest@0
|
46 |
|
forrest@0
|
47 |
biome_name_mod = "Model PFT Class"
|
forrest@0
|
48 |
|
forrest@0
|
49 |
dirm = "/fis/cgd/cseg/people/jeff/clamp_data/model/"
|
forrest@0
|
50 |
film = "class_pft_"+model_grid+".nc"
|
forrest@0
|
51 |
|
forrest@0
|
52 |
fm = addfile(dirm+film,"r")
|
forrest@0
|
53 |
|
forrest@0
|
54 |
classmod = fm->CLASS_PFT
|
forrest@0
|
55 |
|
forrest@0
|
56 |
delete (fm)
|
forrest@0
|
57 |
|
forrest@0
|
58 |
; model data has 17 land-type classes
|
forrest@0
|
59 |
|
forrest@0
|
60 |
nclass_mod = 17
|
forrest@0
|
61 |
|
forrest@0
|
62 |
;--------------------------------------------------
|
forrest@0
|
63 |
; get model data: landfrac and area
|
forrest@0
|
64 |
|
forrest@0
|
65 |
dirm_l= "/fis/cgd/cseg/people/jeff/surface_data/"
|
forrest@0
|
66 |
film_l = "lnd_T42.nc"
|
forrest@0
|
67 |
fm_l = addfile (dirm_l+film_l,"r")
|
forrest@0
|
68 |
|
forrest@0
|
69 |
landfrac = fm_l->landfrac
|
forrest@0
|
70 |
area = fm_l->area
|
forrest@0
|
71 |
|
forrest@0
|
72 |
; change area from km**2 to m**2
|
forrest@0
|
73 |
area = area * 1.e6
|
forrest@0
|
74 |
;---------------------------------------------------
|
forrest@0
|
75 |
; read data: model, group 1
|
forrest@0
|
76 |
|
forrest@0
|
77 |
dirm = "/fis/cgd/cseg/people/jeff/clamp_data/model/"
|
forrest@0
|
78 |
film = model_name1 + "_1980-2004_ANN_climo.nc"
|
forrest@0
|
79 |
fm = addfile (dirm+film,"r")
|
forrest@0
|
80 |
|
forrest@0
|
81 |
NPP1 = fm->NPP
|
forrest@0
|
82 |
|
forrest@0
|
83 |
leafc = fm->LEAFC
|
forrest@0
|
84 |
woodc = fm->WOODC
|
forrest@0
|
85 |
frootc = fm->FROOTC
|
forrest@0
|
86 |
VegC = leafc
|
forrest@0
|
87 |
VegC = leafc + woodc + frootc
|
forrest@0
|
88 |
|
forrest@0
|
89 |
litterc = fm->LITTERC
|
forrest@0
|
90 |
cwdc = fm->CWDC
|
forrest@0
|
91 |
LiCwC = litterc
|
forrest@0
|
92 |
LiCwC = litterc + cwdc
|
forrest@0
|
93 |
|
forrest@0
|
94 |
SoilC = fm->SOILC
|
forrest@0
|
95 |
|
forrest@0
|
96 |
delete (fm)
|
forrest@0
|
97 |
;---------------------------------------------------
|
forrest@0
|
98 |
; read data: model, group 2
|
forrest@0
|
99 |
|
forrest@0
|
100 |
dirm = "/fis/cgd/cseg/people/jeff/clamp_data/model/"
|
forrest@0
|
101 |
film = model_name2 + "_1990-2004_ANN_climo.nc"
|
forrest@0
|
102 |
fm = addfile (dirm+film,"r")
|
forrest@0
|
103 |
|
forrest@0
|
104 |
NPP2 = fm->NPP
|
forrest@0
|
105 |
NEE2 = fm->NEE
|
forrest@0
|
106 |
|
forrest@0
|
107 |
;---------------------------------------------------
|
forrest@0
|
108 |
; Units for these variables are:
|
forrest@0
|
109 |
|
forrest@0
|
110 |
;NPP1: g C/m^2/s
|
forrest@0
|
111 |
;NPP2: g C/m^2/s
|
forrest@0
|
112 |
;NEE2: g C/m^2/s
|
forrest@0
|
113 |
|
forrest@0
|
114 |
;VegC: g C/m^2
|
forrest@0
|
115 |
;LiCwC: g C/m^2
|
forrest@0
|
116 |
;SoilC: g C/m^2
|
forrest@0
|
117 |
|
forrest@0
|
118 |
nsec_per_year = 60*60*24*365
|
forrest@0
|
119 |
|
forrest@0
|
120 |
; change unit to g C/m^2/year
|
forrest@0
|
121 |
|
forrest@0
|
122 |
NPP1 = NPP1 * nsec_per_year
|
forrest@0
|
123 |
NPP2 = NPP2 * nsec_per_year
|
forrest@0
|
124 |
NEE2 = NEE2 * nsec_per_year
|
forrest@0
|
125 |
|
forrest@0
|
126 |
;---------------------------------------------------
|
forrest@0
|
127 |
; take into account landfrac
|
forrest@0
|
128 |
|
forrest@0
|
129 |
area(:,:) = area(:,:) * landfrac(:,:)
|
forrest@0
|
130 |
NPP1(0,:,:) = NPP1(0,:,:) * landfrac(:,:)
|
forrest@0
|
131 |
VegC(0,:,:) = VegC(0,:,:) * landfrac(:,:)
|
forrest@0
|
132 |
LiCwC(0,:,:) = LiCwC(0,:,:) * landfrac(:,:)
|
forrest@0
|
133 |
SoilC(0,:,:) = SoilC(0,:,:) * landfrac(:,:)
|
forrest@0
|
134 |
NPP2(0,:,:) = NPP2(0,:,:) * landfrac(:,:)
|
forrest@0
|
135 |
NEE2(0,:,:) = NEE2(0,:,:) * landfrac(:,:)
|
forrest@0
|
136 |
|
forrest@0
|
137 |
data_n = 7
|
forrest@0
|
138 |
|
forrest@0
|
139 |
;*******************************************************************
|
forrest@0
|
140 |
; Calculate "nice" bins for binning the data in equally spaced ranges
|
forrest@0
|
141 |
;********************************************************************
|
forrest@0
|
142 |
|
forrest@0
|
143 |
; using model biome class
|
forrest@0
|
144 |
nclass = nclass_mod
|
forrest@0
|
145 |
|
forrest@0
|
146 |
range = fspan(0,nclass,nclass+1)
|
forrest@0
|
147 |
|
forrest@0
|
148 |
; print (range)
|
forrest@0
|
149 |
; Use this range information to grab all the values in a
|
forrest@0
|
150 |
; particular range, and then take an average.
|
forrest@0
|
151 |
|
forrest@0
|
152 |
nx = dimsizes(range) - 1
|
forrest@0
|
153 |
|
forrest@0
|
154 |
;==============================
|
forrest@0
|
155 |
; put data into bins
|
forrest@0
|
156 |
;==============================
|
forrest@0
|
157 |
|
forrest@0
|
158 |
; using observed biome class
|
forrest@0
|
159 |
; base = ndtooned(classob)
|
forrest@0
|
160 |
; using model biome class
|
forrest@0
|
161 |
base = ndtooned(classmod)
|
forrest@0
|
162 |
|
forrest@0
|
163 |
; output
|
forrest@0
|
164 |
|
forrest@0
|
165 |
yvalues = new((/data_n,nx/),float)
|
forrest@0
|
166 |
count = new((/data_n,nx/),float)
|
forrest@0
|
167 |
|
forrest@0
|
168 |
do n = 0,data_n-1
|
forrest@0
|
169 |
|
forrest@0
|
170 |
if(n.eq.0) then
|
forrest@0
|
171 |
data = ndtooned(area)
|
forrest@0
|
172 |
end if
|
forrest@0
|
173 |
|
forrest@0
|
174 |
if(n.eq.1) then
|
forrest@0
|
175 |
data = ndtooned(NPP1)
|
forrest@0
|
176 |
end if
|
forrest@0
|
177 |
|
forrest@0
|
178 |
if(n.eq.2) then
|
forrest@0
|
179 |
data = ndtooned(VegC)
|
forrest@0
|
180 |
end if
|
forrest@0
|
181 |
|
forrest@0
|
182 |
if(n.eq.3) then
|
forrest@0
|
183 |
data = ndtooned(LiCwC)
|
forrest@0
|
184 |
end if
|
forrest@0
|
185 |
|
forrest@0
|
186 |
if(n.eq.4) then
|
forrest@0
|
187 |
data = ndtooned(SoilC)
|
forrest@0
|
188 |
end if
|
forrest@0
|
189 |
|
forrest@0
|
190 |
if(n.eq.5) then
|
forrest@0
|
191 |
data = ndtooned(NPP2)
|
forrest@0
|
192 |
end if
|
forrest@0
|
193 |
|
forrest@0
|
194 |
if(n.eq.6) then
|
forrest@0
|
195 |
data = ndtooned(NEE2)
|
forrest@0
|
196 |
end if
|
forrest@0
|
197 |
|
forrest@0
|
198 |
; Loop through each range, using base.
|
forrest@0
|
199 |
|
forrest@0
|
200 |
do i=0,nx-1
|
forrest@0
|
201 |
if (i.ne.(nx-1)) then
|
forrest@0
|
202 |
; print("")
|
forrest@0
|
203 |
; print("In range ["+range(i)+","+range(i+1)+")")
|
forrest@0
|
204 |
idx = ind((base.ge.range(i)).and.(base.lt.range(i+1)))
|
forrest@0
|
205 |
else
|
forrest@0
|
206 |
; print("")
|
forrest@0
|
207 |
; print("In range ["+range(i)+",)")
|
forrest@0
|
208 |
idx = ind(base.ge.range(i))
|
forrest@0
|
209 |
end if
|
forrest@0
|
210 |
|
forrest@0
|
211 |
; Calculate average
|
forrest@0
|
212 |
|
forrest@0
|
213 |
if(.not.any(ismissing(idx))) then
|
forrest@0
|
214 |
if (n.eq.0) then
|
forrest@0
|
215 |
yvalues(n,i) = sum(data(idx))
|
forrest@0
|
216 |
else
|
forrest@0
|
217 |
yvalues(n,i) = avg(data(idx))
|
forrest@0
|
218 |
end if
|
forrest@0
|
219 |
|
forrest@0
|
220 |
count(n,i) = dimsizes(idx)
|
forrest@0
|
221 |
else
|
forrest@0
|
222 |
yvalues(n,i) = yvalues@_FillValue
|
forrest@0
|
223 |
count(n,i) = 0
|
forrest@0
|
224 |
end if
|
forrest@0
|
225 |
|
forrest@0
|
226 |
;#############################################################
|
forrest@0
|
227 |
; using model biome class:
|
forrest@0
|
228 |
; set the following 4 classes to _FillValue:
|
forrest@0
|
229 |
; (3)Needleleaf Deciduous Boreal Tree,
|
forrest@0
|
230 |
; (8)Broadleaf Deciduous Boreal Tree,
|
forrest@0
|
231 |
; (9)Broadleaf Evergreen Shrub,
|
forrest@0
|
232 |
; (16)Wheat
|
forrest@0
|
233 |
|
forrest@0
|
234 |
if (i.eq.3 .or. i.eq.8 .or. i.eq.9 .or. i.eq.16) then
|
forrest@0
|
235 |
yvalues(n,i) = yvalues@_FillValue
|
forrest@0
|
236 |
count(n,i) = 0
|
forrest@0
|
237 |
end if
|
forrest@0
|
238 |
;#############################################################
|
forrest@0
|
239 |
|
forrest@0
|
240 |
; print(n + ": " + count + " points, avg = " + yvalues(n,i))
|
forrest@0
|
241 |
|
forrest@0
|
242 |
delete(idx)
|
forrest@0
|
243 |
end do
|
forrest@0
|
244 |
|
forrest@0
|
245 |
delete(data)
|
forrest@0
|
246 |
end do
|
forrest@0
|
247 |
|
forrest@0
|
248 |
delete (base)
|
forrest@0
|
249 |
delete (area)
|
forrest@0
|
250 |
delete (NPP1)
|
forrest@0
|
251 |
delete (VegC)
|
forrest@0
|
252 |
delete (LiCwC)
|
forrest@0
|
253 |
delete (SoilC)
|
forrest@0
|
254 |
delete (NPP2)
|
forrest@0
|
255 |
delete (NEE2)
|
forrest@0
|
256 |
|
forrest@0
|
257 |
;----------------------------------------------------------------
|
forrest@0
|
258 |
; data for table1
|
forrest@0
|
259 |
|
forrest@0
|
260 |
good = ind(.not.ismissing(yvalues(5,:)) .and. .not.ismissing(yvalues(1,:)))
|
forrest@0
|
261 |
;print (good)
|
forrest@0
|
262 |
|
forrest@0
|
263 |
w = yvalues(0,:)
|
forrest@0
|
264 |
area_g = w(good)
|
forrest@0
|
265 |
|
forrest@0
|
266 |
w = yvalues(1,:)
|
forrest@0
|
267 |
NPP1_g = w(good)
|
forrest@0
|
268 |
|
forrest@0
|
269 |
w = yvalues(2,:)
|
forrest@0
|
270 |
VegC_g = w(good)
|
forrest@0
|
271 |
|
forrest@0
|
272 |
w = yvalues(3,:)
|
forrest@0
|
273 |
LiCwC_g = w(good)
|
forrest@0
|
274 |
|
forrest@0
|
275 |
w = yvalues(4,:)
|
forrest@0
|
276 |
SoilC_g = w(good)
|
forrest@0
|
277 |
|
forrest@0
|
278 |
w = yvalues(5,:)
|
forrest@0
|
279 |
NPP2_g = w(good)
|
forrest@0
|
280 |
|
forrest@0
|
281 |
w = yvalues(6,:)
|
forrest@0
|
282 |
NEE2_g = w(good)
|
forrest@0
|
283 |
|
forrest@0
|
284 |
n_biome = dimsizes(NPP1_g)
|
forrest@0
|
285 |
|
forrest@0
|
286 |
NPP1_t = new((/n_biome/),float)
|
forrest@0
|
287 |
VegC_t = new((/n_biome/),float)
|
forrest@0
|
288 |
LiCwC_t = new((/n_biome/),float)
|
forrest@0
|
289 |
SoilC_t = new((/n_biome/),float)
|
forrest@0
|
290 |
NEE2_t = new((/n_biome/),float)
|
forrest@0
|
291 |
NPP_ratio = new((/n_biome/),float)
|
forrest@0
|
292 |
|
forrest@0
|
293 |
NPP_ratio = NPP2_g/NPP1_g
|
forrest@0
|
294 |
|
forrest@0
|
295 |
;-----------------------------------------------------------------
|
forrest@0
|
296 |
; data for table2
|
forrest@0
|
297 |
|
forrest@0
|
298 |
; change unit from g to Pg (Peta gram)
|
forrest@0
|
299 |
factor_unit = 1.e-15
|
forrest@0
|
300 |
|
forrest@0
|
301 |
NPP1_t = NPP1_g * area_g * factor_unit
|
forrest@0
|
302 |
VegC_t = VegC_g * area_g * factor_unit
|
forrest@0
|
303 |
LiCwC_t = LiCwC_g * area_g * factor_unit
|
forrest@0
|
304 |
SoilC_t = SoilC_g * area_g * factor_unit
|
forrest@0
|
305 |
NEE2_t = NEE2_g * area_g * factor_unit
|
forrest@0
|
306 |
|
forrest@0
|
307 |
print (NPP1_t)
|
forrest@0
|
308 |
|
forrest@0
|
309 |
;-------------------------------------------------------------
|
forrest@0
|
310 |
; html table1 data
|
forrest@0
|
311 |
|
forrest@0
|
312 |
; column (not including header column)
|
forrest@0
|
313 |
|
forrest@0
|
314 |
col_head = (/"Area (1.e12m2)" \
|
forrest@0
|
315 |
,"NPP (gC/m2/yr)" \
|
forrest@0
|
316 |
,"VegC (gC/m2)" \
|
forrest@0
|
317 |
,"Litter+CWD (gC/m2)" \
|
forrest@0
|
318 |
,"SoilC (gC/m2)" \
|
forrest@0
|
319 |
,"NPP ratio" \
|
forrest@0
|
320 |
,"NEE (gC/m2/yr)" \
|
forrest@0
|
321 |
/)
|
forrest@0
|
322 |
|
forrest@0
|
323 |
ncol = dimsizes(col_head)
|
forrest@0
|
324 |
|
forrest@0
|
325 |
; row (not including header row)
|
forrest@0
|
326 |
|
forrest@0
|
327 |
; using model biome class:
|
forrest@0
|
328 |
row_head = (/"Not Vegetated" \
|
forrest@0
|
329 |
,"Needleleaf Evergreen Temperate Tree" \
|
forrest@0
|
330 |
,"Needleleaf Evergreen Boreal Tree" \
|
forrest@0
|
331 |
; ,"Needleleaf Deciduous Boreal Tree" \
|
forrest@0
|
332 |
,"Broadleaf Evergreen Tropical Tree" \
|
forrest@0
|
333 |
,"Broadleaf Evergreen Temperate Tree" \
|
forrest@0
|
334 |
,"Broadleaf Deciduous Tropical Tree" \
|
forrest@0
|
335 |
,"Broadleaf Deciduous Temperate Tree" \
|
forrest@0
|
336 |
; ,"Broadleaf Deciduous Boreal Tree" \
|
forrest@0
|
337 |
; ,"Broadleaf Evergreen Shrub" \
|
forrest@0
|
338 |
,"Broadleaf Deciduous Temperate Shrub" \
|
forrest@0
|
339 |
,"Broadleaf Deciduous Boreal Shrub" \
|
forrest@0
|
340 |
,"C3 Arctic Grass" \
|
forrest@0
|
341 |
,"C3 Non-Arctic Grass" \
|
forrest@0
|
342 |
,"C4 Grass" \
|
forrest@0
|
343 |
,"Corn" \
|
forrest@0
|
344 |
; ,"Wheat" \
|
forrest@0
|
345 |
,"All Biome" \
|
forrest@0
|
346 |
/)
|
forrest@0
|
347 |
nrow = dimsizes(row_head)
|
forrest@0
|
348 |
|
forrest@0
|
349 |
; arrays to be passed to table.
|
forrest@0
|
350 |
text4 = new ((/nrow, ncol/),string )
|
forrest@0
|
351 |
|
forrest@0
|
352 |
do i=0,nrow-2
|
forrest@0
|
353 |
text4(i,0) = sprintf("%.1f",area_g(i)*1.e-12)
|
forrest@0
|
354 |
text4(i,1) = sprintf("%.1f",NPP1_g(i))
|
forrest@0
|
355 |
text4(i,2) = sprintf("%.1f",VegC_g(i))
|
forrest@0
|
356 |
text4(i,3) = sprintf("%.1f",LiCwC_g(i))
|
forrest@0
|
357 |
text4(i,4) = sprintf("%.1f",SoilC_g(i))
|
forrest@0
|
358 |
text4(i,5) = sprintf("%.1f",NPP_ratio(i))
|
forrest@0
|
359 |
text4(i,6) = sprintf("%.1f",NEE2_g(i))
|
forrest@0
|
360 |
end do
|
forrest@0
|
361 |
text4(nrow-1,0) = "-"
|
forrest@0
|
362 |
text4(nrow-1,1) = "-"
|
forrest@0
|
363 |
text4(nrow-1,2) = "-"
|
forrest@0
|
364 |
|
forrest@0
|
365 |
;-------------------------------------------------------
|
forrest@0
|
366 |
; create html table1
|
forrest@0
|
367 |
|
forrest@0
|
368 |
header_text = "<H1>NEE and Carbon Stocks and Fluxes: Model "+model_name+"</H1>"
|
forrest@0
|
369 |
|
forrest@0
|
370 |
header = (/"<HTML>" \
|
forrest@0
|
371 |
,"<HEAD>" \
|
forrest@0
|
372 |
,"<TITLE>CLAMP metrics</TITLE>" \
|
forrest@0
|
373 |
,"</HEAD>" \
|
forrest@0
|
374 |
,header_text \
|
forrest@0
|
375 |
/)
|
forrest@0
|
376 |
footer = "</HTML>"
|
forrest@0
|
377 |
|
forrest@0
|
378 |
table_header = (/ \
|
forrest@0
|
379 |
"<table border=1 cellspacing=0 cellpadding=3 width=60%>" \
|
forrest@0
|
380 |
,"<tr>" \
|
forrest@0
|
381 |
," <th bgcolor=DDDDDD >Biome Type</th>" \
|
forrest@0
|
382 |
," <th bgcolor=DDDDDD >"+col_head(0)+"</th>" \
|
forrest@0
|
383 |
," <th bgcolor=DDDDDD >"+col_head(1)+"</th>" \
|
forrest@0
|
384 |
," <th bgcolor=DDDDDD >"+col_head(2)+"</th>" \
|
forrest@0
|
385 |
," <th bgcolor=DDDDDD >"+col_head(3)+"</th>" \
|
forrest@0
|
386 |
," <th bgcolor=DDDDDD >"+col_head(4)+"</th>" \
|
forrest@0
|
387 |
," <th bgcolor=DDDDDD >"+col_head(5)+"</th>" \
|
forrest@0
|
388 |
," <th bgcolor=DDDDDD >"+col_head(6)+"</th>" \
|
forrest@0
|
389 |
,"</tr>" \
|
forrest@0
|
390 |
/)
|
forrest@0
|
391 |
table_footer = "</table>"
|
forrest@0
|
392 |
row_header = "<tr>"
|
forrest@0
|
393 |
row_footer = "</tr>"
|
forrest@0
|
394 |
|
forrest@0
|
395 |
lines = new(50000,string)
|
forrest@0
|
396 |
nline = 0
|
forrest@0
|
397 |
|
forrest@0
|
398 |
set_line(lines,nline,header)
|
forrest@0
|
399 |
set_line(lines,nline,table_header)
|
forrest@0
|
400 |
|
forrest@0
|
401 |
;----------------------------
|
forrest@0
|
402 |
;row of table
|
forrest@0
|
403 |
|
forrest@0
|
404 |
do n = 0,nrow-2
|
forrest@0
|
405 |
set_line(lines,nline,row_header)
|
forrest@0
|
406 |
|
forrest@0
|
407 |
txt0 = row_head(n)
|
forrest@0
|
408 |
txt1 = text4(n,0)
|
forrest@0
|
409 |
txt2 = text4(n,1)
|
forrest@0
|
410 |
txt3 = text4(n,2)
|
forrest@0
|
411 |
txt4 = text4(n,3)
|
forrest@0
|
412 |
txt5 = text4(n,4)
|
forrest@0
|
413 |
txt6 = text4(n,5)
|
forrest@0
|
414 |
txt7 = text4(n,6)
|
forrest@0
|
415 |
|
forrest@0
|
416 |
set_line(lines,nline,"<th>"+txt0+"</th>")
|
forrest@0
|
417 |
set_line(lines,nline,"<th>"+txt1+"</th>")
|
forrest@0
|
418 |
set_line(lines,nline,"<th>"+txt2+"</th>")
|
forrest@0
|
419 |
set_line(lines,nline,"<th>"+txt3+"</th>")
|
forrest@0
|
420 |
set_line(lines,nline,"<th>"+txt4+"</th>")
|
forrest@0
|
421 |
set_line(lines,nline,"<th>"+txt5+"</th>")
|
forrest@0
|
422 |
set_line(lines,nline,"<th>"+txt6+"</th>")
|
forrest@0
|
423 |
set_line(lines,nline,"<th>"+txt7+"</th>")
|
forrest@0
|
424 |
|
forrest@0
|
425 |
set_line(lines,nline,row_footer)
|
forrest@0
|
426 |
end do
|
forrest@0
|
427 |
;----------------------------
|
forrest@0
|
428 |
set_line(lines,nline,table_footer)
|
forrest@0
|
429 |
set_line(lines,nline,footer)
|
forrest@0
|
430 |
|
forrest@0
|
431 |
; Now write to an HTML file.
|
forrest@0
|
432 |
|
forrest@0
|
433 |
output_html = "table_carbon_sink1.html"
|
forrest@0
|
434 |
|
forrest@0
|
435 |
idx = ind(.not.ismissing(lines))
|
forrest@0
|
436 |
if(.not.any(ismissing(idx))) then
|
forrest@0
|
437 |
asciiwrite(output_html,lines(idx))
|
forrest@0
|
438 |
else
|
forrest@0
|
439 |
print ("error?")
|
forrest@0
|
440 |
end if
|
forrest@0
|
441 |
|
forrest@0
|
442 |
delete (col_head)
|
forrest@0
|
443 |
delete (row_head)
|
forrest@0
|
444 |
delete (text4)
|
forrest@0
|
445 |
|
forrest@0
|
446 |
end
|
forrest@0
|
447 |
|