Spaces:
Sleeping
Sleeping
Carl Boettiger
commited on
Commit
•
da9244d
1
Parent(s):
308c0d8
update app
Browse files- app.py +23 -15
- pad-stats.parquet +2 -2
- pad.duckdb +2 -2
app.py
CHANGED
@@ -41,6 +41,8 @@ st.set_page_config(layout="wide", page_title="Protected Areas Explorer", page_ic
|
|
41 |
|
42 |
#pad_pmtiles = "https://data.source.coop/cboettig/pad-us-3/pad-stats.pmtiles"
|
43 |
#parquet = "https://data.source.coop/cboettig/pad-us-3/pad-stats.parquet"
|
|
|
|
|
44 |
pad_pmtiles = "https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/pad-stats.pmtiles"
|
45 |
parquet = "https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/pad-stats.parquet"
|
46 |
|
@@ -53,8 +55,9 @@ custom_style = '''
|
|
53 |
|
54 |
|
55 |
sample_q = '''(
|
56 |
-
ibis.read_parquet(
|
57 |
-
group_by(_.
|
|
|
58 |
aggregate(percent_protected = 100 * _.area.sum() / us_lower_48_area_m2,
|
59 |
mean_richness = (_.richness * _.area).sum() / _.area.sum(),
|
60 |
mean_rsr = (_.rsr * _.area).sum() / _.area.sum()
|
@@ -71,17 +74,22 @@ def bar_chart(df, x, y):
|
|
71 |
).properties(width="container", height=300)
|
72 |
return chart
|
73 |
|
74 |
-
|
75 |
manager = {
|
76 |
-
'property': '
|
77 |
'type': 'categorical',
|
78 |
'stops': [
|
79 |
-
['
|
80 |
-
['
|
81 |
-
['
|
82 |
-
['
|
|
|
|
|
|
|
|
|
|
|
83 |
]
|
84 |
}
|
|
|
85 |
easement = {
|
86 |
'property': 'category',
|
87 |
'type': 'categorical',
|
@@ -107,10 +115,10 @@ gap = {
|
|
107 |
'property': 'gap_code',
|
108 |
'type': 'categorical',
|
109 |
'stops': [
|
110 |
-
[1, "#26633d"],
|
111 |
-
[2, "#879647"],
|
112 |
-
[3, "#BBBBBB"],
|
113 |
-
[4, "#F8F8F8"]
|
114 |
]
|
115 |
}
|
116 |
|
@@ -297,11 +305,11 @@ with st.sidebar:
|
|
297 |
select_column = {
|
298 |
"GAP Status Code": "gap_code",
|
299 |
"IUCN Status Code": "iucn_category",
|
300 |
-
"Manager Type": "
|
301 |
"Fee/Easement": "category",
|
302 |
"Public Access": "public_access",
|
303 |
-
"Mean Richness": "
|
304 |
-
"Mean RSR": "
|
305 |
"custom": "gap_code"}
|
306 |
column = select_column[style_choice]
|
307 |
|
|
|
41 |
|
42 |
#pad_pmtiles = "https://data.source.coop/cboettig/pad-us-3/pad-stats.pmtiles"
|
43 |
#parquet = "https://data.source.coop/cboettig/pad-us-3/pad-stats.parquet"
|
44 |
+
pad_pmtiles = "https://huggingface.co/spaces/boettiger-lab/pad-us/resolve/main/pad-stats.pmtiles"
|
45 |
+
parquet = "https://huggingface.co/spaces/boettiger-lab/pad-us/resolve/main/pad-stats.parquet"
|
46 |
pad_pmtiles = "https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/pad-stats.pmtiles"
|
47 |
parquet = "https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/pad-stats.parquet"
|
48 |
|
|
|
55 |
|
56 |
|
57 |
sample_q = '''(
|
58 |
+
ibis.read_parquet(parquet).
|
59 |
+
group_by(_.gap_code).
|
60 |
+
mutate(area = _.area_square_meters).
|
61 |
aggregate(percent_protected = 100 * _.area.sum() / us_lower_48_area_m2,
|
62 |
mean_richness = (_.richness * _.area).sum() / _.area.sum(),
|
63 |
mean_rsr = (_.rsr * _.area).sum() / _.area.sum()
|
|
|
74 |
).properties(width="container", height=300)
|
75 |
return chart
|
76 |
|
|
|
77 |
manager = {
|
78 |
+
'property': 'manager_type',
|
79 |
'type': 'categorical',
|
80 |
'stops': [
|
81 |
+
['Federal', "darkblue"],
|
82 |
+
['State', public_color],
|
83 |
+
['Local Government', "lightblue"],
|
84 |
+
['Regional Agency Special District', "darkgreen"],
|
85 |
+
['Unknown', "grey"],
|
86 |
+
['Joint', "green"],
|
87 |
+
['American Indian Lands', tribal_color],
|
88 |
+
['Private', "darkred"],
|
89 |
+
['Non-Governmental Organization', "orange"]
|
90 |
]
|
91 |
}
|
92 |
+
|
93 |
easement = {
|
94 |
'property': 'category',
|
95 |
'type': 'categorical',
|
|
|
115 |
'property': 'gap_code',
|
116 |
'type': 'categorical',
|
117 |
'stops': [
|
118 |
+
["1", "#26633d"],
|
119 |
+
["2", "#879647"],
|
120 |
+
["3", "#BBBBBB"],
|
121 |
+
["4", "#F8F8F8"]
|
122 |
]
|
123 |
}
|
124 |
|
|
|
305 |
select_column = {
|
306 |
"GAP Status Code": "gap_code",
|
307 |
"IUCN Status Code": "iucn_category",
|
308 |
+
"Manager Type": "manager_type",
|
309 |
"Fee/Easement": "category",
|
310 |
"Public Access": "public_access",
|
311 |
+
"Mean Richness": "gap_code",
|
312 |
+
"Mean RSR": "gap_code",
|
313 |
"custom": "gap_code"}
|
314 |
column = select_column[style_choice]
|
315 |
|
pad-stats.parquet
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7ac89736cc42bb2390853137b2793b9e9f1d4d11cefc34f307a1280043243ca1
|
3 |
+
size 894911787
|
pad.duckdb
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fd6f7206c3d03bdd00516f53e9fded8037bcbbf98ee3a8d9a90c1bc258cb47f7
|
3 |
+
size 1084502016
|