Skip to content

Commit

Permalink
added updated validation notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
dankovacek committed Oct 10, 2024
1 parent ac0d403 commit efefa51
Show file tree
Hide file tree
Showing 74 changed files with 7,904 additions and 8,529 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
processed_data/merged_basin_groups/region_polygons.zip filter=lfs diff=lfs merge=lfs -text
input_data/adjusted_region_polygons.zip filter=lfs diff=lfs merge=lfs -text
20 changes: 15 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@ references/
input_data/*.vrt
input_data/DEM/
input_data/AK_*/
processed_dem/
input_data/NHN_INDEX*/
input_data/DAYMET/
input_data/region_polygons/
input_data/region_bounds/
input_data/BasinATLAS/
optimization/
validation/tmp/

input_data/adjusted_region_polygons/
input_data/NHN_data/*
input_data/HYSETS_data/*
input_data/NALCMS/*
input_data/GLHYMPS/*
input_data/*.geojson

optimization/
validation/tmp/
validation/data/
validation/ss/
processed_dem/

processed_data/basin_attributes/
processed_data/DAYMET/
processed_data/BCUB_files/
Expand All @@ -24,9 +32,11 @@ processed_data/derived_basins/
processed_data/processed_dem/
processed_data/*.vrt
processed_data/*.py
processed_data/*.geojson
results/
superseded/
*.qgz
upload_dataverse_files.py

__pycache__/
.ipynb_checkpoints/
.ipynb_checkpoints/
54 changes: 54 additions & 0 deletions get_hysets_attributes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import pandas as pd
import numpy as np
import geopandas as gpd
import psycopg2

columns = [
'official_id', 'watershed_id', 'name', 'centroid_lat_deg_n', 'centroid_lon_deg_e',
'drainage_area_km2', 'drainage_area_gsim_km2', 'flag_gsim_boundaries', 'flag_artificial_boundaries',
'elevation_m', 'slope_deg', 'gravelius', 'perimeter', 'flag_shape_extraction', 'aspect_deg', 'flag_terrain_extraction',
'land_use_forest_frac_2010', 'land_use_grass_frac_2010', 'land_use_wetland_frac_2010',
'land_use_water_frac_2010', 'land_use_urban_frac_2010', 'land_use_shrubs_frac_2010',
'land_use_crops_frac_2010', 'land_use_snow_ice_frac_2010', 'flag_land_use_extraction',
'logk_ice_x100', 'porosity_x100', 'flag_subsoil_extraction', 'year_from', 'year_to',
'record_length', 'agency', 'status', 'updated_official_basin', 'in_bcub',
'prcp', 'srad', 'swe', 'tmax', 'tmin', 'vp',
'high_prcp_freq', 'high_prcp_duration', 'low_prcp_freq', 'low_prcp_duration'
]

def get_hysets_attributes(columns, conn):
"""
Get hysets attributes by hysets_id
:param hysets_id: int
:param conn: psycopg2 connection
:return: pd.DataFrame
"""
# Get hysets attributes
if columns is None:
query = f"""
SELECT * FROM basins_schema.hysets_basins
WHERE in_bcub = True
LIMIT 10;
"""
hysets_attributes = gpd.read_postgis(query, conn, geom_col='centroid')
else:
column_string = ', '.join(columns)
query = f"""
SELECT {column_string} FROM basins_schema.hysets_basins
WHERE in_bcub = True
ORDER BY official_id;
"""
hysets_attributes = pd.read_sql_query(query, conn)
return hysets_attributes

conn_info = {
'dbname': 'basins',
'user': 'postgres',
'password': 'pgpass',
'host': 'localhost',
'port': '5432'
}
conn = psycopg2.connect(**conn_info)

df = get_hysets_attributes(columns, conn)
df.to_csv('BCUB_HYSETS_properties_with_climate.csv', index=False)
Binary file added img/VCI_forest_cover_change.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/edge_deviation_fig.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/lake_confluence_filter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/land_cover_change_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/low_precip_duration_fig.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/region_assembly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/region_bound_alignment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions img/region_edge_detail.pgw
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
102.93548597422287116
0
0
-102.93548597422287116
1158699.56954298727214336
1110379.6146800983697176
Binary file added img/region_edge_detail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/region_edge_view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/region_edge_view_detail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/trimmed_dem.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 0 additions & 20 deletions index.html

This file was deleted.

24 changes: 0 additions & 24 deletions input_data/BCUB_regions.geojson

This file was deleted.

Binary file added input_data/BCUB_study_region_R0.zip
Binary file not shown.
Loading

0 comments on commit efefa51

Please sign in to comment.