Spaces:
Sleeping
Sleeping
updated
Browse files
app.py
CHANGED
@@ -124,7 +124,7 @@ def area_plot(df, column):
|
|
124 |
.encode(text = column + ":N")
|
125 |
)
|
126 |
plot = pie # pie + text
|
127 |
-
return plot.properties(width=
|
128 |
|
129 |
def pad_style(paint, alpha):
|
130 |
return {
|
@@ -316,14 +316,15 @@ with st.sidebar:
|
|
316 |
|
317 |
|
318 |
with st.expander("π¦ Biodiversity"):
|
319 |
-
|
|
|
320 |
m.add_tile_layer(url="https://data.source.coop/cboettig/mobi/tiles/red/species-richness-all/{z}/{x}/{y}.png",
|
321 |
name="MOBI Species Richness",
|
322 |
attribution="NatureServe",
|
323 |
opacity=0.9
|
324 |
)
|
325 |
-
|
326 |
-
if
|
327 |
m.add_tile_layer(url="https://data.source.coop/cboettig/mobi/tiles/green/range-size-rarity-all/{z}/{x}/{y}.png",
|
328 |
name="MOBI Range-Size Rarity",
|
329 |
attribution="NatureServe",
|
@@ -332,7 +333,8 @@ with st.sidebar:
|
|
332 |
#m.add_cog_layer("https://data.source.coop/cboettig/mobi/range-size-rarity-all/RSR_All.tif",
|
333 |
# palette="greens", name="Range-Size Rarity", transparent_bg=True, opacity = 0.9, fit_bounds=False)
|
334 |
with st.expander("β
Carbon & Climate"):
|
335 |
-
|
|
|
336 |
m.add_cog_layer("https://data.source.coop/vizzuality/lg-land-carbon-data/deforest_carbon_100m_cog.tif",
|
337 |
palette="reds", name="Carbon Lost (2002-2022)", transparent_bg=True, opacity = 0.8, fit_bounds=False)
|
338 |
|
@@ -345,12 +347,13 @@ with st.sidebar:
|
|
345 |
palette="greens", name="Manageable Carbon", transparent_bg=True, opacity = 0.8, fit_bounds=False)
|
346 |
|
347 |
with st.expander("π Human Impacts"):
|
348 |
-
|
349 |
-
if
|
350 |
hi="https://data.source.coop/vizzuality/hfp-100/hfp_2021_100m_v1-2_cog.tif"
|
351 |
m.add_cog_layer(hi, palette="purples", name="Human Impact", transparent_bg=True, opacity = 0.8, fit_bounds=False)
|
352 |
|
353 |
-
|
|
|
354 |
m.add_cog_layer("https://data.source.coop/vizzuality/lg-land-carbon-data/natcrop_expansion_100m_cog.tif",)
|
355 |
# palette="greens", name="cropland expansion", transparent_bg=True, opacity = 0.8, fit_bounds=False)
|
356 |
|
@@ -444,30 +447,27 @@ with main:
|
|
444 |
|
445 |
with stats_col:
|
446 |
with st.container():
|
447 |
-
|
448 |
-
|
449 |
-
f"{total_percent}% Continental US Covered"
|
450 |
-
st.altair_chart(area_plot(df, column), use_container_width=False)
|
451 |
|
452 |
-
|
|
|
453 |
"Species Richness"
|
454 |
st.altair_chart(richness_chart, use_container_width=True)
|
455 |
|
456 |
-
|
457 |
"Range-Size Rarity"
|
458 |
st.altair_chart(rsr_chart, use_container_width=True)
|
459 |
|
460 |
-
|
461 |
-
col1b, col2b, col3b = st.columns(3)
|
462 |
-
with col1b:
|
463 |
"Carbon Lost ('02-'22)"
|
464 |
st.altair_chart(carbon_lost, use_container_width=True)
|
465 |
|
466 |
-
|
467 |
"Crop expansion"
|
468 |
st.altair_chart(crop_expansion, use_container_width=True)
|
469 |
|
470 |
-
|
471 |
"Human Impact"
|
472 |
st.altair_chart(human_impact, use_container_width=True)
|
473 |
|
|
|
124 |
.encode(text = column + ":N")
|
125 |
)
|
126 |
plot = pie # pie + text
|
127 |
+
return plot.properties(width="container", height=300)
|
128 |
|
129 |
def pad_style(paint, alpha):
|
130 |
return {
|
|
|
316 |
|
317 |
|
318 |
with st.expander("π¦ Biodiversity"):
|
319 |
+
show_richness = st.toggle("Species Richness", False)
|
320 |
+
if show_richness:
|
321 |
m.add_tile_layer(url="https://data.source.coop/cboettig/mobi/tiles/red/species-richness-all/{z}/{x}/{y}.png",
|
322 |
name="MOBI Species Richness",
|
323 |
attribution="NatureServe",
|
324 |
opacity=0.9
|
325 |
)
|
326 |
+
show_rsr = st.toggle("Range-Size Rarity")
|
327 |
+
if show_rsr:
|
328 |
m.add_tile_layer(url="https://data.source.coop/cboettig/mobi/tiles/green/range-size-rarity-all/{z}/{x}/{y}.png",
|
329 |
name="MOBI Range-Size Rarity",
|
330 |
attribution="NatureServe",
|
|
|
333 |
#m.add_cog_layer("https://data.source.coop/cboettig/mobi/range-size-rarity-all/RSR_All.tif",
|
334 |
# palette="greens", name="Range-Size Rarity", transparent_bg=True, opacity = 0.9, fit_bounds=False)
|
335 |
with st.expander("β
Carbon & Climate"):
|
336 |
+
show_carbon_lost = st.toggle("Carbon Lost (2002-2022)")
|
337 |
+
if show_carbon_lost:
|
338 |
m.add_cog_layer("https://data.source.coop/vizzuality/lg-land-carbon-data/deforest_carbon_100m_cog.tif",
|
339 |
palette="reds", name="Carbon Lost (2002-2022)", transparent_bg=True, opacity = 0.8, fit_bounds=False)
|
340 |
|
|
|
347 |
palette="greens", name="Manageable Carbon", transparent_bg=True, opacity = 0.8, fit_bounds=False)
|
348 |
|
349 |
with st.expander("π Human Impacts"):
|
350 |
+
show_human_impact = st.toggle("Human Impact")
|
351 |
+
if show_human_impact:
|
352 |
hi="https://data.source.coop/vizzuality/hfp-100/hfp_2021_100m_v1-2_cog.tif"
|
353 |
m.add_cog_layer(hi, palette="purples", name="Human Impact", transparent_bg=True, opacity = 0.8, fit_bounds=False)
|
354 |
|
355 |
+
show_crop_expansion = st.toggle("cropland expansion")
|
356 |
+
if show_crop_expansion:
|
357 |
m.add_cog_layer("https://data.source.coop/vizzuality/lg-land-carbon-data/natcrop_expansion_100m_cog.tif",)
|
358 |
# palette="greens", name="cropland expansion", transparent_bg=True, opacity = 0.8, fit_bounds=False)
|
359 |
|
|
|
447 |
|
448 |
with stats_col:
|
449 |
with st.container():
|
450 |
+
f"{total_percent}% Continental US Covered"
|
451 |
+
st.altair_chart(area_plot(df, column), use_container_width=True)
|
|
|
|
|
452 |
|
453 |
+
with st.container():
|
454 |
+
if show_richness:
|
455 |
"Species Richness"
|
456 |
st.altair_chart(richness_chart, use_container_width=True)
|
457 |
|
458 |
+
if show_rsr:
|
459 |
"Range-Size Rarity"
|
460 |
st.altair_chart(rsr_chart, use_container_width=True)
|
461 |
|
462 |
+
if show_carbon_lost:
|
|
|
|
|
463 |
"Carbon Lost ('02-'22)"
|
464 |
st.altair_chart(carbon_lost, use_container_width=True)
|
465 |
|
466 |
+
if show_crop_expansion:
|
467 |
"Crop expansion"
|
468 |
st.altair_chart(crop_expansion, use_container_width=True)
|
469 |
|
470 |
+
if show_human_impact:
|
471 |
"Human Impact"
|
472 |
st.altair_chart(human_impact, use_container_width=True)
|
473 |
|