Skip to content

Commit ee77fc4

Browse files
committed
include backup file, update readme
1 parent 34138b0 commit ee77fc4

File tree

5 files changed

+13
-63
lines changed

5 files changed

+13
-63
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
src/config.ini
1414
src/cmd.txt
1515
src/auth.json
16-
src/utils/hide_copyright_info.ipynb
16+
src/query/hide_copyright_info.ipynb
17+
data/for_arcgis_dashboard/*
1718

1819
## VS CODE
1920
.vscode

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
33
**Perceptual model** is defined as:
44
> An expert summary of the watershed and its runoff processes often supported by field observations. Perceptual models are often presented as a schematic figure, although such a figure will necessarily simplify the hydrologist's complex mental model (McMillan et al., 2022)
55
6-
This repo contains a released version of the perceptual data model database from https://doi.org/10.1002/hyp.14845. Currently our database holds **400 models** in both text (269) and figure (131) format collected from hydrologic literature.
6+
This repo contains a released version of the perceptual data model database, used for the manuscript under review **"Global patterns in observed hydrologic processes (McMillan et al.)"**. Currently our database holds **400 models** in the form of both text (269) and figure (131, including 63 identified in [McMillan et al., 2022](https://doi.org/10.1002/hyp.14845)) collected from hydrologic literature.
77

88
Visit **[the perceptual model interactive map](http://www.mcmillanhydrology.org/PerceptualModelDashboard.html)** for the visualization :world_map:
99

1010
## Installation/Getting Started
11+
If you are only interested in the pre-built database and not the building process, you can download the database backup (SQLdump) from ```data/backup/*.backup```. Alternatively, check csv files under ```data``` directory.
12+
13+
The following explains the code used to build the Postgres database and webmap.
14+
1115
**1. Create your environment**
1216
Use Conda to create an environment
1317
```
@@ -21,17 +25,18 @@ Run the following code in order:
2125
- `0-debug_excelsheets.ipynb`
2226
- `1-build_database.ipynb`
2327

28+
### Query database
29+
`src/query` contains example scripts that can be used to query the database:
30+
- `calc_stats.sql` holds query scripts to calculate statistics used in [the paper McMillan et al., 2022](https://doi.org/10.1002/hyp.14845)
31+
- Note that analysis for the manuscript "Global patterns in observed hydrologic processes (McMillan et al.)" was implemented using ArcGIS software
32+
- Use `debug_built_database.sql` to debug the database if the SQL database or code (`1-build_database.ipynb`) are not working as expected
33+
2434
### Create webmap
2535
`src/webmap` contains example scripts that are used to create [the ArcGIS interactive webmap](http://www.mcmillanhydrology.org/PerceptualModelDashboard.html).
2636
To initiate the webmap after building the SQL database:
2737
- Run `init_create_webmap.ipynb` to initiate a webmap
2838
- Or, run `update_webmap.ipynb` to update an existing webmap
2939

30-
### Other utilities
31-
`src/utils` contains other utilities:
32-
- `calc_stats.sql` holds query scripts to calculate statistics used in [the paper](https://doi.org/10.1002/hyp.14845)
33-
- Use `debug_built_database.sql` to debug the database if the SQL database or code (`1-build_database.ipynb`) are not working as expected
34-
3540
## Resources
3641
- [The database design (ER diagram)](https://dbdiagram.io/d/63f6895b296d97641d830705)
3742
- [The hydrologic process taxonomy used in the analysis](http://mcmillanhydrology.org/ProcessTaxonomy/ProcessTaxonomyDiagram.html)

data/backup/20240717.backup

204 KB
Binary file not shown.

src/utils/calc_stats.sql renamed to src/query/calc_stats.sql

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,6 @@ FROM perceptual_model
2727
GROUP BY num_spatial_zones
2828
ORDER BY num_spatial_zones;
2929

30-
/*
31-
num_spatial_zones | count
32-
-------------------+-------
33-
1 | 51
34-
2 | 7
35-
4 | 2
36-
6 | 2
37-
7 | 1
38-
*/
39-
4030
-- count by temporal zones
4131
SELECT id, num_temporal_zones
4232
FROM perceptual_model
@@ -47,16 +37,6 @@ FROM perceptual_model
4737
GROUP BY num_temporal_zones
4838
ORDER BY num_temporal_zones;
4939

50-
/*
51-
num_temporal_zones | count
52-
--------------------+-------
53-
1 | 35
54-
2 | 11
55-
3 | 8
56-
4 | 8
57-
5 | 1
58-
*/
59-
6040
-- count by flux
6141

6242
WITH flux_count AS
@@ -100,21 +80,6 @@ FROM flux_count
10080
GROUP BY num_flux_per_model
10181
ORDER BY num_flux_per_model;
10282

103-
/*
104-
num_flux_per_model | num_models
105-
--------------------+------------
106-
1 | 1
107-
2 | 5
108-
3 | 9
109-
4 | 17
110-
5 | 10
111-
6 | 7
112-
7 | 7
113-
8 | 4
114-
9 | 1
115-
*/
116-
117-
11883
-- count by stores
11984
WITH store_count AS
12085
(SELECT perceptual_model.id, COUNT(perceptual_model.id) AS num_store_per_model
@@ -154,19 +119,6 @@ SELECT num_store_per_model, COUNT(num_store_per_model) AS num_models
154119
FROM store_count
155120
GROUP BY num_store_per_model
156121
ORDER BY num_store_per_model;
157-
/*
158-
num_store_per_model | num_models
159-
---------------------+------------
160-
1 | 2
161-
2 | 2
162-
3 | 11
163-
4 | 20
164-
5 | 8
165-
6 | 6
166-
7 | 4
167-
8 | 2
168-
9 | 3
169-
*/
170122

171123
-- 2. Count by process
172124

@@ -338,11 +290,3 @@ FROM process_table
338290
COUNT(identifier)
339291
FROM process_table
340292
GROUP BY CHAR_LENGTH(identifier) - CHAR_LENGTH(REPLACE(identifier, '.', ''));
341-
342-
/*
343-
process_level | count
344-
---------------+-------
345-
3 | 177
346-
2 | 292
347-
1 | 85
348-
*/
File renamed without changes.

0 commit comments

Comments
 (0)