Makefile
3.46 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
all: conditions
D = $$0
S = $
O = $$1
T = $$2
R = $$3
conditions: adj_int_gt
sqlite3 database_modfire.db 'insert into wood_rewards (ug,presc,wood) select Id, Presc,sum(V_harv+V_thin) from action_internal group by Id,Presc;'
sqlite3 database_modfire.db 'insert into soilloss (ug,presc,soilloss) select Id, Presc,sum(Soilloss) from action_internal group by Id,Presc;'
sqlite3 database_modfire.db 'insert into perc_r0 (ug,presc,perc_r0_total) select Id, Presc, sum(Perc_r0 * area)/50 from action_internal group by Id,Presc;'
sqlite3 database_modfire.db 'insert into perc_r5 (ug,presc,perc_r5_total) select Id, Presc, sum(Perc_r5 * area)/50 from action_internal group by Id,Presc;'
sqlite3 database_modfire.db 'insert into perc_r10 (ug,presc,perc_r10_total) select Id, Presc, sum(Perc_r10 * area)/50 from action_internal group by Id,Presc;'
adj_int_gt: adj
sed -i '1s/^/UG1,UG2,BORDER\n/' ii.csv
python3 remove_adj_below.py 50
sed -i '1d' i.csv
cut -d, -f2,3,4 i.csv > iii.csv
sqlite3 database_modfire.db < imp/import_adj_int_gt50.sql
adj: area
cut -f1,2,3 input/Adjacencias_VS22.txt > i.csv
sed -i '1d' i.csv
sed -i '/-1/d' i.csv
awk '! a[$(D)]++' i.csv | sed "s/\t/,/g" > ii.csv
awk -F "," '$(O) != 1551' ii.csv | awk -F "," '$(O) != 1552' | awk -F "," '$(O) != 1553' | awk -F "," '$(O) != 1591' | awk -F "," '$(O) != 1592' | awk -F "," '$(O) != 1607' > iii.csv
awk -F "," '$(T) != 1551' iii.csv | awk -F "," '$(T) != 1552' | awk -F "," '$(T) != 1553' | awk -F "," '$(T) != 1591' | awk -F "," '$(T) != 1592' | awk -F "," '$(T) != 1607' > ii.csv
sqlite3 database_modfire.db < imp/import_adj_ext.sql
cut -d, -f1 ii.csv > i.csv
python3 convert_u.py > ids.csv
cut -d, -f2 ii.csv > i.csv
python3 convert_u.py > iii.csv
paste --delimiter='' ids.csv iii.csv > i.csv
cut -d, -f3 ii.csv > iii.csv
paste --delimiter='' i.csv iii.csv > ii.csv
sqlite3 database_modfire.db < imp/import_adj_int.sql
area: action_internal
cut -f1,5 input/Adjacencias_VS22.txt > i.csv
sed -i '1d' i.csv
sed -i '/-1/d' i.csv
awk '! a[$(D)]++' i.csv | sed "s/\t/,/g" > ii.csv
sed -i '/1551,4.23199781869/d' ii.csv
sed -i '/1552,14.5795859997/d' ii.csv
sed -i '/1553,11.3507636964/d' ii.csv
sed -i '/1591,0.372829596169/d' ii.csv
sed -i '/1592,2.11169189261/d' ii.csv
sed -i '/1607,17.4850819576/d' ii.csv
echo | cat missings >> ii.csv
sqlite3 database_modfire.db < imp/import_area_ext.sql
cut -d, -f1 ii.csv > i.csv
cut -d, -f2 ii.csv > iii.csv
python3 convert_u.py > ids.csv
paste --delimiter='' ids.csv iii.csv > ii.csv
sqlite3 database_modfire.db < imp/import_area_int.sql
action_internal: action_external
cut -f2,3,4,5,6,7,8,11,24,25,26,27,28,29,33,40 input/Prescricoes_VS22.txt | sed "s/\t/,/g" > ii.csv
sed -i '1d' ii.csv
cut -f1 input/Prescricoes_VS22.txt > i.csv
sed -i '1d' i.csv
python3 convert_u.py > ids.csv
paste --delimiter='' ids.csv ii.csv > iii.csv
sqlite3 database_modfire.db < imp/import_action_internal.sql
action_external: ug_ids
cut -f1,2,3,4,5,6,7,8,11,24,25,26,27,28,29,33,40 input/Prescricoes_VS22.txt | sed "s/\t/,/g" > i.csv
sed -i '1d' i.csv
sqlite3 database_modfire.db < imp/import_action_external.sql
ug_ids: create_tables
cut -f1 input/Prescricoes_VS22.txt > i.csv
sed -i '1d' i.csv
awk '!seen[$(D)]++' i.csv > ii.csv
sqlite3 database_modfire.db < imp/import_ug.sql
create_tables:
rm -rf *.db
rm -rf i.csv
rm -rf ii.csv
rm -rf iii.csv
rm -rf ids.csv
sqlite3 database_modfire.db < create.sql
clean:
rm -rf *.db
rm -rf i.csv
rm -rf ii.csv
rm -rf iii.csv