Spaces:
Sleeping
Sleeping
:see_no_evil:
Browse files
app.py
CHANGED
@@ -74,9 +74,9 @@ with st.form("my_form"):
|
|
74 |
with col4:
|
75 |
st.markdown('''
|
76 |
#### π Set spatial resolution
|
77 |
-
See [H3 cell size by zoom](https://h3geo.org/docs/core-library/restable/#cell-areas)
|
78 |
''')
|
79 |
-
zoom = st.slider("H3
|
80 |
v_scale = st.number_input("vertical scale", min_value = 0.0, value = default["vertical"])
|
81 |
|
82 |
submitted = st.form_submit_button("Go")
|
@@ -131,7 +131,7 @@ def bar_chart(gdf_name, rank, taxa, zoom, distinct_taxa = ""):
|
|
131 |
|
132 |
sel = sel.group_by(_.city, _.grade)
|
133 |
|
134 |
-
if distinct_taxa
|
135 |
sel = sel.agg(n = _[distinct_taxa].nunique(), area = _.area.sum())
|
136 |
else:
|
137 |
sel = sel.agg(n = _.count(), area = _.area.sum())
|
@@ -163,6 +163,9 @@ count = "occurrences"
|
|
163 |
if nunique:
|
164 |
count = "unique " + distinct_taxa
|
165 |
|
|
|
|
|
|
|
166 |
mapcol, chartcol = st.columns([4,1])
|
167 |
|
168 |
if submitted:
|
@@ -182,5 +185,5 @@ if submitted:
|
|
182 |
m.to_streamlit()
|
183 |
with chartcol:
|
184 |
st.markdown("Mean number of " + count + " by redline grade")
|
185 |
-
bar_chart(gdf_name, rank, taxa, zoom, distinct_taxa =
|
186 |
|
|
|
74 |
with col4:
|
75 |
st.markdown('''
|
76 |
#### π Set spatial resolution
|
77 |
+
See [H3 cell size by zoom level](https://h3geo.org/docs/core-library/restable/#cell-areas)
|
78 |
''')
|
79 |
+
zoom = st.slider("H3 zoom", min_value=1, max_value=11, value = default["zoom"])
|
80 |
v_scale = st.number_input("vertical scale", min_value = 0.0, value = default["vertical"])
|
81 |
|
82 |
submitted = st.form_submit_button("Go")
|
|
|
131 |
|
132 |
sel = sel.group_by(_.city, _.grade)
|
133 |
|
134 |
+
if distinct_taxa: # count n unique taxa
|
135 |
sel = sel.agg(n = _[distinct_taxa].nunique(), area = _.area.sum())
|
136 |
else:
|
137 |
sel = sel.agg(n = _.count(), area = _.area.sum())
|
|
|
163 |
if nunique:
|
164 |
count = "unique " + distinct_taxa
|
165 |
|
166 |
+
|
167 |
+
st.write(distinct_taxa)
|
168 |
+
|
169 |
mapcol, chartcol = st.columns([4,1])
|
170 |
|
171 |
if submitted:
|
|
|
185 |
m.to_streamlit()
|
186 |
with chartcol:
|
187 |
st.markdown("Mean number of " + count + " by redline grade")
|
188 |
+
bar_chart(gdf_name, rank, taxa, zoom, distinct_taxa = distinct_taxa)
|
189 |
|