/
pgh_hgm--2.2.4-tutorial.sql
164 lines (119 loc) · 6.67 KB
/
pgh_hgm--2.2.4-tutorial.sql
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
TRAVA
-- MOSTRA ALGUMAS COISAS
--SELECT * FROM pgh_hgm.pghft_hydro_intel;
--SELECT * FROM pgh_hgm.pghft_drn_elevationprofile;
--SELECT * FROM pgh_hgm.pghft_upn_elevationprofile;
-- TRUNCATE ELEVATION PROFILES
--SELECT pgh_hgm.pghfn_utils_tmp_elevprof_truncate('drn');
--SELECT pgh_hgm.pghfn_utils_tmp_elevprof_truncate('upn');
-- EXPORTA RESULTADOS PARA 'geoft_bho_hgm'
--SELECT pgh_hgm.pghfn_utils_export_output()
------------------------------------------------------------------
-- CONFIGURAR BANCO DE DADOS
-- 0. conectar banco com schema pghydro
-- 1. carregar extensao pgh_raster -> carregar pghrt_elevation
-- 2. carregar extensao pgh_hgm
------------------------------------------------------------------
------------------------------------------------------------------
-- INICIALIZA A TABELA DO PGH-HGM -> atualiza com dados do pghydro
-------------------------------------------------------------------
SELECT pgh_hgm.pghfn_tables_initialize();
------------------------------------------------------------
-- ESCALA LOCAL: TRECHO (DRN) E BACIA (DRA)
------------------------------------------------------------
-- pre-processamento
SELECT pgh_hgm.pghfn_prepro_calculate();
-- declividades dos trechos
SELECT pgh_hgm.pghfn_calculate_drn_slope_maxmin(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_drn_slope_pipf(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_drn_slope_s1585(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_drn_slope_z1585(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_drn_slope_linreg(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_drn_slope_weighted(55555, 5880);
--SELECT pgh_hgm.pghfn_calculate_drn_slope_harmonic(55555, 5880); -- nao recomendada
-- estatisticas do perfil de elevacao do trecho e elevation-drop
SELECT pgh_hgm.pghfn_calculate_drn_elevationprofile_stats(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_drn_elevationprofiledrop_from_slopes(55555, 5880);
-- atributos do trecho
SELECT pgh_hgm.pghfn_calculate_drn_sinuosity(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_drn_amhg_depth_width(55555, 5880); -- profundidade e largura
-- atributos de bacia
SELECT pgh_hgm.pghfn_calculate_dra_avglengthoverlandflow(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_dra_axislength(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_dra_circularity(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_dra_compacity(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_dra_drainagedensity(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_dra_formfactor(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_dra_hydrodensity(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_dra_perimeter(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_dra_shapefactor(55555, 5880);
-- estatisticas de MDE da bacia
SELECT pgh_hgm.pghfn_calculate_dra_elevations_stats(55555, 5880); -- a operacao mais pesada!
-- atributos com dependencia
SELECT pgh_hgm.pghfn_calculate_dra_reachgradient(55555, 5880); -- utiliza hig_drn_slope_maxmin
SELECT pgh_hgm.pghfn_calculate_dra_reliefratio(55555, 5880); -- utiliza hig_dra_elevationdrop_m
SELECT pgh_hgm.pghfn_calculate_dra_bonus_ring(55555, 5880); -- utiliza hig_dra_elevationdrop_m
SELECT pgh_hgm.pghfn_calculate_dra_bonus_river(55555, 5880); -- utiliza hig_dra_elevationdrop_m
SELECT pgh_hgm.pghfn_calculate_dra_bonus_schumm(55555, 5880); -- utiliza hig_dra_elevationdrop_m
--> Daqui pra baixo tambem ha dependencias
--> no geral, areas, declividades, larguras, profundidades, etc.
-- modelo de jobson
SELECT pgh_hgm.pghfn_calculate_drn_jobson_initialize(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_drn_jobson_traveltime(55555, 5880);
-- celeridades, velocidades, etc.
SELECT pgh_hgm.pghfn_calculate_drn_wavetravel(55555, 5880);
-- tempos de concentracao
SELECT pgh_hgm.pghfn_calculate_dra_timeofconcentration(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_dra_kirpicha(55555, 5880);
------------------------------------------------------------
-- ESCALA DE MONTANTE: TRECHO (UPN) E BACIA (UPA)
------------------------------------------------------------
-- pre-processamento
SELECT pgh_hgm.pghfn_prepro_calculate_upa(55555, 5880);
--- declividades do rio principal a montante
SELECT pgh_hgm.pghfn_calculate_upn_slope_maxmin(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_upn_slope_pipf(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_upn_slope_s1585(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_upn_slope_z1585(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_upn_slope_linreg(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_upn_slope_weighted(55555, 5880);
-- SELECT pgh_hgm.pghfn_calculate_upn_slope_harmonic(55555, 5880); -- nao recomendada
-- estatisticas do perfil de elevacao do rio a montante e elevation-drop
SELECT pgh_hgm.pghfn_calculate_upn_elevationprofile_stats(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_upn_elevationprofiledrop_from_slopes(55555, 5880); --utiliza hig_upn_slope_xxxx
-- atributos do rio principal a montante
SELECT pgh_hgm.pghfn_calculate_upn_sinuosity(55555, 5880);
-- atributos da bacia a montante
SELECT pgh_hgm.pghfn_calculate_upa_avglengthoverlandflow(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_upa_axislength(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_upa_circularity(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_upa_compacity(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_upa_drainagedensity(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_upa_formfactor(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_upa_hydrodensity(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_upa_perimeter(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_upa_shapefactor(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_upa_totaldrainagelength(55555, 5880);
-- estatisticas do MDE a montante
--SELECT pgh_hgm.pghfn_calculate_upa_elevations_stats(55555, 5880); -- a operacao mais pesada!
SELECT pgh_hgm.pghfn_calculate_upa_elevations_stats_agg(); -- pelo metodo da agregacao
-- atributos com dependencia
SELECT pgh_hgm.pghfn_calculate_upa_reachgradient(55555, 5880); -- utiiza de hig_upn_slope_maxmin
SELECT pgh_hgm.pghfn_calculate_upa_reliefratio(55555, 5880); -- utiliza hig_upa_elevationdrop_m
SELECT pgh_hgm.pghfn_calculate_upa_bonus_ring(55555, 5880); -- utiliza hig_upa_elevationdrop_m
SELECT pgh_hgm.pghfn_calculate_upa_bonus_river(55555, 5880); -- utiliza hig_upa_elevationdrop_m
SELECT pgh_hgm.pghfn_calculate_upa_bonus_schumm(55555, 5880); -- utiliza hig_upa_elevationdrop_m
--> Daqui pra baixo ha dependencias
SELECT pgh_hgm.pghfn_calculate_upa_timeofconcentration(55555, 5880);
SELECT pgh_hgm.pghfn_calculate_upa_kirpicha(55555, 5880);
--> Copia os atributos de cabeceiras para upn/upa
SELECT pgh_hgm.pghfn_postpro_updateheadwaters()
/*
SELECT
hig_upa_elevation_max,hig_upa_elevation_min,hig_upa_elevation_avg,hig_upa_elevationdrop_m,
hig_upa_reachgradient,
hig_upa_reliefratio_ring,
hig_upa_axislength_schumm,
hig_upa_tc_kirpich
FROM pgh_hgm.pghft_hydro_intel;
*/