-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapply_allometry.pro
71 lines (53 loc) · 1.69 KB
/
apply_allometry.pro
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
PRO apply_allometry, lorey_file, type_file, out_agb_file, out_bgb_file
openr, lorey_lun, lorey_file, /get_lun
openr, type_lun, type_file, /get_lun
openw, out_agb_lun, out_agb_file, /get_lun
openw, out_bgb_lun, out_bgb_file, /get_lun
infile_info = file_info(lorey_file)
infile_size = infile_info.size
tot_pix = infile_size/4
read_pix = tot_pix / 100
in_line = fltarr(read_pix)
in_type = bytarr(read_pix)
out_agb_line = intarr(read_pix)
out_bgb_line = intarr(read_pix)
for i=0, 99 do begin
print, i
readu, lorey_lun, in_line
readu, type_lun, in_type
out_agb_line[*] = fix(in_line)
out_bgb_line[*] = 0
index = where(in_line gt 0, count)
if (count gt 0) then begin
agb_temp = fltarr(count)
bgb_temp = fltarr(count)
lorey2biomass,in_line[index],in_type[index],agb_temp,bgb_temp
out_agb_line[index] = fix(agb_temp*10)
out_bgb_line[index] = fix(bgb_temp*10)
endif
writeu, out_agb_lun, out_agb_line
writeu, out_bgb_lun, out_bgb_line
endfor
remainder = tot_pix mod 100
if (remainder gt 0) then begin
in_line = fltarr(remainder)
in_type = bytarr(remainder)
out_agb_line = intarr(remainder)
out_bgb_line = intarr(remainder)
readu, lorey_lun, in_line
readu, type_lun, in_type
out_agb_line[*] = fix(in_line)
out_bgb_line[*] = 0
index = where(in_line gt 0, count)
if (count gt 0) then begin
agb_temp = fltarr(remainder)
bgb_temp = fltarr(remainder)
lorey2biomass,in_line[index],in_type[index],agb_temp,bgb_temp
out_agb_line[index] = fix(agb_temp*10)
out_bgb_line[index] = fix(bgb_temp*10)
endif
writeu, out_agb_lun, out_agb_line
writeu, out_bgb_lun, out_bgb_line
endif
free_lun, lorey_lun, type_lun, out_agb_lun, out_bgb_lun
END