Last active
October 11, 2015 20:17
-
-
Save marcellobenigno/3913340 to your computer and use it in GitHub Desktop.
Pré-processamento dos dados no GRASS - ghydroweb_location
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 - Configurar a conexão com o banco PostgreSQL/PostGIS “ghydroweb”: | |
db.connect driver=pg database="host=localhost,dbname=ghydroweb" | |
#db.connect database=host=localhost,dbname=ghydroweb schema=grass | |
db.login user=marcello pass=x | |
db.connect -p | |
db.tables -p | |
2 – Configurar a Region para o DEM: | |
g.region rast=dem res=30 -p | |
projection: 1 (UTM) | |
zone: -25 | |
datum: sam69 | |
ellipsoid: sam69 | |
north: 9206580 | |
south: 9180540 | |
west: 259380 | |
east: 300780 | |
nsres: 30 | |
ewres: 30 | |
rows: 868 | |
cols: 1380 | |
cells: 1197840 | |
3 – Tratar o DEM para que o mesmo se torne um MDE hidrológico consistente, retirando as possíveis áreas de sink: | |
r.fill.dir input=dem elevation=A_dem.filled direction=A_filled_direction | |
4 – Criar as superfícies de análises hidrológicas: | |
OBS: O thresold define o tamanho mínimo a ser considerado para uma área de contribuição. Para áreas de 500.000 m2 (0,5 km2) foi utilizado o valor 555 => 500.000/30x30 | |
(onde 30x30 é a resolução espacial do topodata). | |
r.watershed --o -fma elevation=A_dem.filled accumulation=A_accumulation drainage=A_drainage stream=A_streams convergence=5 threshold=555 | |
5 – Encontrar os limites da bacias, ignorando as subbacias: | |
r.stream.basins -l dir=A_drainage stream=A_streams basins=A_main_basins | |
6 – Extaindo a bacia do Gramame (deve-se clicar para ver o valor do pixel para essa bacia) | |
r.mapcalc 'watershed=if(A_main_basins==310,1,null())' | |
7 – A partir do limite da bacia do Gramame (watershed), recortar as camadas: | |
r.mapcalc 'A_dem.clip=A_dem.filled*watershed' | |
r.mapcalc 'A_accum.clip=A_accumulation*watershed' | |
8 – Extrair a rede de drenagem da bacia: | |
r.stream.extract --o elevation=A_dem.clip threshold=555 d8cut=infinity mexp=0 stream_rast=A_streams.clip direction=A_drain_dir.clip stream_vect=v_streams | |
9 – Obter a ordem da rede de drenagem da bacia: | |
r.stream.order stream=A_streams.clip dir=A_drain_dir.clip strahler=r_strahler hack=r_hack table=streams_order | |
OBS: Table streams_order created. You can join it to vector created with | |
r.stream.extract using v.db.connect | |
SELECT v.*, s.* | |
FROM v_streams v, streams_order s | |
WHERE v.cat = s.stream | |
10 – Extração dos atributos morfométricos: | |
r.basin map=dem prefix=out easting=300768.710391 northing=9199725.066264 threshold=555 | |
============================================================ | |
1 AS gid, s.hack, ST_Union(s.geom) AS geom | |
FROM streams s, basins b | |
WHERE ST_Intersects(s.geom, b.geom) | |
AND b.gid = 68 | |
GROUP by s.hack ORDER BY s.hack LIMIT 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment