cassiebuhler commited on
Commit
3fac395
·
1 Parent(s): bac75f3

wip - app with new data, need to fix pmtiles

Browse files
Files changed (5) hide show
  1. app/app.py +25 -92
  2. app/footer.md +3 -7
  3. app/system_prompt.txt +19 -24
  4. app/utils.py +18 -13
  5. app/variables.py +93 -12
app/app.py CHANGED
@@ -40,10 +40,8 @@ ca = con.table("mydata")
40
 
41
  for key in [
42
  'richness', 'rsr', 'irrecoverable_carbon', 'manageable_carbon',
43
- 'percent_fire_10yr', 'percent_rxburn_10yr', 'percent_disadvantaged',
44
- 'svi', 'svi_socioeconomic_status', 'svi_household_char',
45
- 'svi_racial_ethnic_minority', 'svi_housing_transit',
46
- 'deforest_carbon', 'human_impact'
47
  ]:
48
  if key not in st.session_state:
49
  st.session_state[key] = False
@@ -85,7 +83,7 @@ st.markdown(
85
  }
86
  .block-container {
87
  padding-top: 0.5rem;
88
- padding-bottom: 0rem;
89
  padding-left: 5rem;
90
  padding-right: 5rem;
91
  }
@@ -108,6 +106,7 @@ st.markdown(
108
  unsafe_allow_html=True,
109
  )
110
 
 
111
  st.markdown(
112
  """
113
  <style>
@@ -229,10 +228,8 @@ def summary_table_sql(ca, column, colors, ids): # get df for charts + df_tab for
229
 
230
  chatbot_toggles = {key: False for key in [
231
  'richness', 'rsr', 'irrecoverable_carbon', 'manageable_carbon',
232
- 'percent_fire_10yr', 'percent_rxburn_10yr', 'percent_disadvantaged',
233
- 'svi', 'svi_socioeconomic_status', 'svi_household_char',
234
- 'svi_racial_ethnic_minority', 'svi_housing_transit',
235
- 'deforest_carbon', 'human_impact'
236
  ]}
237
 
238
 
@@ -303,7 +300,6 @@ with st.container():
303
  st.stop()
304
 
305
 
306
-
307
  #### Data layers
308
  with st.sidebar:
309
  st.markdown('<p class = "medium-font-sidebar"> Data Layers:</p>', help = "Select data layers to visualize on the map. Summary charts will update based on the displayed layers.", unsafe_allow_html= True)
@@ -335,7 +331,7 @@ with st.sidebar:
335
  # Justice40 Section
336
  with st.expander("🌱 Climate & Economic Justice"):
337
  a_justice = st.slider("transparency", 0.0, 1.0, 0.07, key = "social justice")
338
- show_justice40 = st.toggle("Disadvantaged Communities (Justice40)", key = "percent_disadvantaged", value=chatbot_toggles['percent_disadvantaged'])
339
 
340
  if show_justice40:
341
  m.add_pmtiles(url_justice40, style=justice40_style, name="Justice40", opacity=a_justice, tooltip=False, fit_bounds = False)
@@ -344,58 +340,30 @@ with st.sidebar:
344
  with st.expander("🏡 Social Vulnerability"):
345
  a_svi = st.slider("transparency", 0.0, 1.0, 0.1, key = "SVI")
346
  show_sv = st.toggle("Social Vulnerability Index (SVI)", key = "svi", value=chatbot_toggles['svi'])
347
- show_sv_socio = st.toggle("Socioeconomic Status", key = "svi_socioeconomic_status", value=chatbot_toggles['svi_socioeconomic_status'])
348
- show_sv_household = st.toggle("Household Characteristics", key = "svi_household_char", value=chatbot_toggles['svi_household_char'])
349
- show_sv_minority = st.toggle("Racial & Ethnic Minority Status", key = "svi_racial_ethnic_minority", value=chatbot_toggles['svi_racial_ethnic_minority'])
350
- show_sv_housing = st.toggle("Housing Type & Transportation", key = "svi_housing_transit", value=chatbot_toggles['svi_housing_transit'])
351
-
352
  if show_sv:
353
  m.add_pmtiles(url_svi, style = get_sv_style("RPL_THEMES"), opacity=a_svi, tooltip=False, fit_bounds = False)
354
 
355
- if show_sv_socio:
356
- m.add_pmtiles(url_svi, style = get_sv_style("RPL_THEME1"), opacity=a_svi, tooltip=False, fit_bounds = False)
357
-
358
- if show_sv_household:
359
- m.add_pmtiles(url_svi, style = get_sv_style("RPL_THEME2"), opacity=a_svi, tooltip=False, fit_bounds = False)
360
-
361
- if show_sv_minority:
362
- m.add_pmtiles(url_svi, style = get_sv_style("RPL_THEME3"), opacity=a_svi, tooltip=False, fit_bounds = False)
363
-
364
- if show_sv_housing:
365
- m.add_pmtiles(url_svi, style = get_sv_style("RPL_THEME4"), opacity=a_svi, tooltip=False, fit_bounds = False)
366
-
367
  # Fire Section
368
  with st.expander("🔥 Fire"):
369
- a_fire = st.slider("transparency", 0.0, 1.0, 0.15, key = "fire")
370
- show_fire_10 = st.toggle("Fires (2013-2022)", key = "percent_fire_10yr", value=chatbot_toggles['percent_fire_10yr'])
371
 
372
- show_rx_10 = st.toggle("Prescribed Burns (2013-2022)", key = "percent_rxburn_10yr", value=chatbot_toggles['percent_rxburn_10yr'])
373
 
374
 
375
  if show_fire_10:
376
- m.add_pmtiles(url_calfire, style=fire_style("layer2"), name="CALFIRE Fire Polygons (2013-2022)", opacity=a_fire, tooltip=False, fit_bounds = True)
377
 
378
  if show_rx_10:
379
- m.add_pmtiles(url_rxburn, style=rx_style("layer2"), name="CAL FIRE Prescribed Burns (2013-2022)", opacity=a_fire, tooltip=False, fit_bounds = True)
380
 
381
 
382
- # HI Section
383
- with st.expander("🚜 Human Impacts"):
384
- a_hi = st.slider("transparency", 0.0, 1.0, 0.1, key = "hi")
385
- show_carbon_lost = st.toggle("Deforested Carbon", key = "deforest_carbon", value=chatbot_toggles['deforest_carbon'])
386
- show_human_impact = st.toggle("Human Footprint", key = "human_impact", value=chatbot_toggles['human_impact'])
387
-
388
- if show_carbon_lost:
389
- m.add_tile_layer(url_loss_carbon, name="Deforested Carbon (2002-2022)", opacity = a_hi)
390
-
391
- if show_human_impact:
392
- m.add_cog_layer(url_hi, name="Human Footprint (2017-2021)", opacity = a_hi, fit_bounds=False)
393
-
394
  st.divider()
395
  st.markdown('<p class = "medium-font-sidebar"> Filters:</p>', help = "Apply filters to adjust what data is shown on the map.", unsafe_allow_html= True)
396
  for label in style_options: # get selected filters (based on the buttons selected)
397
  with st.expander(label):
398
- if label == "GAP Status Code": # gap code 1 and 2 are on by default
399
  opts = getButtons(style_options, label, default_gap)
400
  else: # other buttons are not on by default.
401
  opts = getButtons(style_options, label)
@@ -408,13 +376,14 @@ with st.sidebar:
408
  else:
409
  filter_cols = []
410
  filter_vals = []
411
-
412
  st.divider()
413
  st.markdown("""
414
  <p class="medium-font-sidebar">
415
  <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' class='bi bi-github ' style='height:1em;width:1em;fill:currentColor;vertical-align:-0.125em;margin-right:4px;' aria-hidden='true' role='img'><path d='M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8z'></path></svg>Source Code: </p> <a href='https://github.com/boettiger-lab/ca-30x30' target='_blank'>https://github.com/boettiger-lab/ca-30x30</a>
416
  """, unsafe_allow_html=True)# adding github logo
417
 
 
418
  # Display CA 30x30 Data
419
  if 'out' not in locals():
420
  style = get_pmtiles_style(style_options[color_choice], alpha, filter_cols, filter_vals)
@@ -428,7 +397,9 @@ column = select_column[color_choice]
428
 
429
  select_colors = {
430
  "Year": year["stops"],
431
- "GAP Status Code": gap["stops"],
 
 
432
  "Manager Type": manager["stops"],
433
  "Easement": easement["stops"],
434
  "Access Type": access["stops"],
@@ -440,6 +411,7 @@ colors = (
440
  .to_pandas()
441
  )
442
 
 
443
  # get summary tables used for charts + printed table
444
  # df - charts; df_tab - printed table (omits colors)
445
  if 'out' not in locals():
@@ -455,16 +427,10 @@ richness_chart = bar_chart(df, column, 'mean_richness', "Species Richness")
455
  rsr_chart = bar_chart(df, column, 'mean_rsr', "Range-Size Rarity")
456
  irr_carbon_chart = bar_chart(df, column, 'mean_irrecoverable_carbon', "Irrecoverable Carbon")
457
  man_carbon_chart = bar_chart(df, column, 'mean_manageable_carbon', "Manageable Carbon")
458
- fire_10_chart = bar_chart(df, column, 'mean_percent_fire_10yr', "Fires (2013-2022)")
459
- rx_10_chart = bar_chart(df, column, 'mean_percent_rxburn_10yr',"Prescribed Burns (2013-2022)")
460
- justice40_chart = bar_chart(df, column, 'mean_percent_disadvantaged', "Disadvantaged Communities (Justice40)")
461
- svi_chart = bar_chart(df, column, 'mean_svi', "Social Vulnerability Index")
462
- svi_socio_chart = bar_chart(df, column, 'mean_svi_socioeconomic_status', "SVI - Socioeconomic Status")
463
- svi_house_chart = bar_chart(df, column, 'mean_svi_household_char', "SVI - Household Characteristics")
464
- svi_minority_chart = bar_chart(df, column, 'mean_svi_racial_ethnic_minority', "SVI - Racial and Ethnic Minority")
465
- svi_transit_chart = bar_chart(df, column, 'mean_svi_housing_transit', "SVI - Housing Type and Transit")
466
- carbon_loss_chart = bar_chart(df, column, 'mean_carbon_lost', "Deforested Carbon (2002-2022)")
467
- hi_chart = bar_chart(df, column, 'mean_human_impact', "Human Footprint (2017-2021)")
468
 
469
 
470
  main = st.container()
@@ -486,63 +452,30 @@ with main:
486
  st.altair_chart(area_plot(df, column), use_container_width=True)
487
 
488
  if show_richness:
489
- # "Species Richness"
490
  st.altair_chart(richness_chart, use_container_width=True)
491
 
492
  if show_rsr:
493
- # "Range-Size Rarity"
494
  st.altair_chart(rsr_chart, use_container_width=True)
495
 
496
  if show_irrecoverable_carbon:
497
- # "Irrecoverable Carbon"
498
  st.altair_chart(irr_carbon_chart, use_container_width=True)
499
 
500
  if show_manageable_carbon:
501
- # "Manageable Carbon"
502
  st.altair_chart(man_carbon_chart, use_container_width=True)
503
 
504
  if show_fire_10:
505
- # "Fires (2013-2022)"
506
  st.altair_chart(fire_10_chart, use_container_width=True)
507
 
508
  if show_rx_10:
509
- # "Prescribed Burns (2013-2022)"
510
  st.altair_chart(rx_10_chart, use_container_width=True)
511
 
512
  if show_justice40:
513
- # "Disadvantaged Communities (Justice40)"
514
  st.altair_chart(justice40_chart, use_container_width=True)
515
 
516
  if show_sv:
517
- # "Social Vulnerability Index"
518
  st.altair_chart(svi_chart, use_container_width=True)
519
 
520
- if show_sv_socio:
521
- # "SVI - Socioeconomic Status"
522
- st.altair_chart(svi_socio_chart, use_container_width=True)
523
-
524
- if show_sv_household:
525
- # "SVI - Household Characteristics"
526
- st.altair_chart(svi_house_chart, use_container_width=True)
527
-
528
- if show_sv_minority:
529
- # "SVI - Racial and Ethnic Minority"
530
- st.altair_chart(svi_minority_chart, use_container_width=True)
531
-
532
- if show_sv_housing:
533
- # "SVI - Housing Type and Transit"
534
- st.altair_chart(svi_transit_chart, use_container_width=True)
535
-
536
- if show_carbon_lost:
537
- # "Deforested Carbon (2002-2022)"
538
- st.altair_chart(carbon_loss_chart, use_container_width=True)
539
-
540
- if show_human_impact:
541
- # "Human Footprint (2017-2021)"
542
- st.altair_chart(hi_chart, use_container_width=True)
543
-
544
-
545
-
546
 
547
 
548
  st.caption("***The label 'established' is inferred from the California Protected Areas Database, which may introduce artifacts. For details on our methodology, please refer to our code: https://github.com/boettiger-lab/ca-30x30.")
 
40
 
41
  for key in [
42
  'richness', 'rsr', 'irrecoverable_carbon', 'manageable_carbon',
43
+ 'fire', 'rxburn', 'disadvantaged_communities',
44
+ 'svi'
 
 
45
  ]:
46
  if key not in st.session_state:
47
  st.session_state[key] = False
 
83
  }
84
  .block-container {
85
  padding-top: 0.5rem;
86
+ padding-bottom: 2rem;
87
  padding-left: 5rem;
88
  padding-right: 5rem;
89
  }
 
106
  unsafe_allow_html=True,
107
  )
108
 
109
+
110
  st.markdown(
111
  """
112
  <style>
 
228
 
229
  chatbot_toggles = {key: False for key in [
230
  'richness', 'rsr', 'irrecoverable_carbon', 'manageable_carbon',
231
+ 'fire', 'rxburn', 'disadvantaged_communities',
232
+ 'svi'
 
 
233
  ]}
234
 
235
 
 
300
  st.stop()
301
 
302
 
 
303
  #### Data layers
304
  with st.sidebar:
305
  st.markdown('<p class = "medium-font-sidebar"> Data Layers:</p>', help = "Select data layers to visualize on the map. Summary charts will update based on the displayed layers.", unsafe_allow_html= True)
 
331
  # Justice40 Section
332
  with st.expander("🌱 Climate & Economic Justice"):
333
  a_justice = st.slider("transparency", 0.0, 1.0, 0.07, key = "social justice")
334
+ show_justice40 = st.toggle("Disadvantaged Communities (Justice40)", key = "disadvantaged_communities", value=chatbot_toggles['disadvantaged_communities'])
335
 
336
  if show_justice40:
337
  m.add_pmtiles(url_justice40, style=justice40_style, name="Justice40", opacity=a_justice, tooltip=False, fit_bounds = False)
 
340
  with st.expander("🏡 Social Vulnerability"):
341
  a_svi = st.slider("transparency", 0.0, 1.0, 0.1, key = "SVI")
342
  show_sv = st.toggle("Social Vulnerability Index (SVI)", key = "svi", value=chatbot_toggles['svi'])
343
+
 
 
 
 
344
  if show_sv:
345
  m.add_pmtiles(url_svi, style = get_sv_style("RPL_THEMES"), opacity=a_svi, tooltip=False, fit_bounds = False)
346
 
 
 
 
 
 
 
 
 
 
 
 
 
347
  # Fire Section
348
  with st.expander("🔥 Fire"):
349
+ a_fire = st.slider("transparency", 0.0, 1.0, 0.15, key = "calfire")
350
+ show_fire_10 = st.toggle("Fires (2013-2023)", key = "fire", value=chatbot_toggles['fire'])
351
 
352
+ show_rx_10 = st.toggle("Prescribed Burns (2013-2023)", key = "rxburn", value=chatbot_toggles['rxburn'])
353
 
354
 
355
  if show_fire_10:
356
+ m.add_pmtiles(url_calfire, style=fire_style("layer2"), name="CALFIRE Fire Polygons (2013-2023)", opacity=a_fire, tooltip=False, fit_bounds = True)
357
 
358
  if show_rx_10:
359
+ m.add_pmtiles(url_rxburn, style=rx_style("layer2"), name="CAL FIRE Prescribed Burns (2013-2023)", opacity=a_fire, tooltip=False, fit_bounds = True)
360
 
361
 
 
 
 
 
 
 
 
 
 
 
 
 
362
  st.divider()
363
  st.markdown('<p class = "medium-font-sidebar"> Filters:</p>', help = "Apply filters to adjust what data is shown on the map.", unsafe_allow_html= True)
364
  for label in style_options: # get selected filters (based on the buttons selected)
365
  with st.expander(label):
366
+ if label == "GAP Code": # gap code 1 and 2 are on by default
367
  opts = getButtons(style_options, label, default_gap)
368
  else: # other buttons are not on by default.
369
  opts = getButtons(style_options, label)
 
376
  else:
377
  filter_cols = []
378
  filter_vals = []
379
+
380
  st.divider()
381
  st.markdown("""
382
  <p class="medium-font-sidebar">
383
  <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' class='bi bi-github ' style='height:1em;width:1em;fill:currentColor;vertical-align:-0.125em;margin-right:4px;' aria-hidden='true' role='img'><path d='M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8z'></path></svg>Source Code: </p> <a href='https://github.com/boettiger-lab/ca-30x30' target='_blank'>https://github.com/boettiger-lab/ca-30x30</a>
384
  """, unsafe_allow_html=True)# adding github logo
385
 
386
+
387
  # Display CA 30x30 Data
388
  if 'out' not in locals():
389
  style = get_pmtiles_style(style_options[color_choice], alpha, filter_cols, filter_vals)
 
397
 
398
  select_colors = {
399
  "Year": year["stops"],
400
+ "GAP Code": gap["stops"],
401
+ "Status": status["stops"],
402
+ "Ecoregion": ecoregion["stops"],
403
  "Manager Type": manager["stops"],
404
  "Easement": easement["stops"],
405
  "Access Type": access["stops"],
 
411
  .to_pandas()
412
  )
413
 
414
+
415
  # get summary tables used for charts + printed table
416
  # df - charts; df_tab - printed table (omits colors)
417
  if 'out' not in locals():
 
427
  rsr_chart = bar_chart(df, column, 'mean_rsr', "Range-Size Rarity")
428
  irr_carbon_chart = bar_chart(df, column, 'mean_irrecoverable_carbon', "Irrecoverable Carbon")
429
  man_carbon_chart = bar_chart(df, column, 'mean_manageable_carbon', "Manageable Carbon")
430
+ fire_10_chart = bar_chart(df, column, 'mean_fire', "Fires (2013-2023)")
431
+ rx_10_chart = bar_chart(df, column, 'mean_rxburn',"Prescribed Burns (2013-2023)")
432
+ justice40_chart = bar_chart(df, column, 'mean_disadvantaged_communities', "Disadvantaged Communities (Justice40) ")
433
+ svi_chart = bar_chart(df, column, 'mean_svi', "Social Vulnerability Index (2023)")
 
 
 
 
 
 
434
 
435
 
436
  main = st.container()
 
452
  st.altair_chart(area_plot(df, column), use_container_width=True)
453
 
454
  if show_richness:
 
455
  st.altair_chart(richness_chart, use_container_width=True)
456
 
457
  if show_rsr:
 
458
  st.altair_chart(rsr_chart, use_container_width=True)
459
 
460
  if show_irrecoverable_carbon:
 
461
  st.altair_chart(irr_carbon_chart, use_container_width=True)
462
 
463
  if show_manageable_carbon:
 
464
  st.altair_chart(man_carbon_chart, use_container_width=True)
465
 
466
  if show_fire_10:
 
467
  st.altair_chart(fire_10_chart, use_container_width=True)
468
 
469
  if show_rx_10:
 
470
  st.altair_chart(rx_10_chart, use_container_width=True)
471
 
472
  if show_justice40:
 
473
  st.altair_chart(justice40_chart, use_container_width=True)
474
 
475
  if show_sv:
 
476
  st.altair_chart(svi_chart, use_container_width=True)
477
 
478
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
479
 
480
 
481
  st.caption("***The label 'established' is inferred from the California Protected Areas Database, which may introduce artifacts. For details on our methodology, please refer to our code: https://github.com/boettiger-lab/ca-30x30.")
app/footer.md CHANGED
@@ -11,12 +11,8 @@ Data: https://huggingface.co/datasets/boettiger-lab/ca-30x30
11
 
12
  - Irrecoverable Carbon from Conservation International, reprocessed to COG on https://beta.source.coop/cboettig/carbon, citation: https://doi.org/10.1038/s41893-021-00803-6, License: CC-BY-NC
13
 
14
- - Fire polygons by CAL FIRE (2022), reprocessed to PMTiles on https://beta.source.coop/cboettig/fire/. License: Public Domain
15
 
16
- - Climate and Economic Justice Screening Tool, US Council on Environmental Quality, Justice40. Description: https://screeningtool.geoplatform.gov/en/methodology#3/33.47/-97.5. Data: https://beta.source.coop/repositories/cboettig/justice40/description/, License: Public Domain
17
 
18
- - CDC 2020 Social Vulnerability Index by US Census Tract. Description: https://www.atsdr.cdc.gov/place-health/php/svi/index.html. Data: https://source.coop/repositories/cboettig/social-vulnerability/description. License: Public Domain
19
-
20
- - Carbon-loss by Vizzuality, on https://beta.source.coop/repositories/vizzuality/lg-land-carbon-data. Citation: https://doi.org/10.1101/2023.11.01.565036, License: CC-BY
21
-
22
- - Human Footprint by Vizzuality, on https://beta.source.coop/repositories/vizzuality/hfp-100. Citation: https://doi.org/10.3389/frsen.2023.1130896, License: Public Domain
 
11
 
12
  - Irrecoverable Carbon from Conservation International, reprocessed to COG on https://beta.source.coop/cboettig/carbon, citation: https://doi.org/10.1038/s41893-021-00803-6, License: CC-BY-NC
13
 
14
+ - Fire polygons by CAL FIRE (2023), reprocessed to PMTiles on https://beta.source.coop/cboettig/fire/. License: Public Domain
15
 
16
+ - Climate and Economic Justice Screening Tool, US Council on Environmental Quality, Justice40. Data: https://beta.source.coop/repositories/cboettig/justice40/description/, License: Public Domain
17
 
18
+ - CDC 2022 Social Vulnerability Index by US Census Tract. Description: https://www.atsdr.cdc.gov/place-health/php/svi/index.html. Data: https://source.coop/repositories/cboettig/social-vulnerability/description. License: Public Domain
 
 
 
 
app/system_prompt.txt CHANGED
@@ -36,12 +36,12 @@ example_assistant: {{"sql_query":
36
  ## Example:
37
  example_user: "Which gap code has been impacted the most by fire?"
38
  example_assistant: {{"sql_query":
39
- SELECT "reGAP", SUM("percent_fire_10yr") AS temp
40
  FROM mydata
41
  GROUP BY "reGAP"
42
  ORDER BY temp ASC
43
  LIMIT 1;
44
- "explanation":"I used the `percent_fire_10yr` column, which shows the percentage of each area burned over the past 10 years (2013–2022), summing it for each GAP code to find the one with the highest total fire impact."
45
  }}
46
 
47
  ## Example:
@@ -70,13 +70,13 @@ example_assistant: {{"sql_query":
70
  ## Example:
71
  example_user: "Show me the 50 most biodiverse areas found in disadvantaged communities."
72
  example_assistant: {{"sql_query":
73
- SELECT "id", "geom", "name", "acres", "richness", "percent_disadvantaged" FROM mydata
74
- WHERE "percent_disadvantaged" > 0
75
  ORDER BY "richness" DESC
76
  LIMIT 50;
77
- "explanation": "I used the `richness` column to measure biodiversity and the `percent_disadvantaged` column to identify areas located in disadvantaged communities. The `percent_disadvantaged` value is derived from the Justice40 initiative, which identifies communities burdened by systemic inequities and vulnerabilities across multiple domains, including climate resilience, energy access, health disparities, housing affordability, pollution exposure, transportation infrastructure, water quality, and workforce opportunities.
78
 
79
- The results are sorted in descending order by biodiversity richness (highest biodiversity first), and only areas with a `percent_disadvantaged` value greater than 0 (indicating some portion of the area overlaps with a disadvantaged community) are included."
80
  }}
81
 
82
 
@@ -90,7 +90,7 @@ sql_query:
90
  SELECT "id", "geom", "name", "acres","richness", "reGAP"
91
  FROM mydata
92
  WHERE "reGAP" = 3
93
- AND "percent_fire_10yr" >= 0.5
94
  and "manager_type" = "Federal"
95
  AND "richness" > (SELECT temp FROM temp_tab);
96
 
@@ -105,12 +105,11 @@ sql_query:
105
 
106
  # Detailed Explanation of the Columns in the California Dataset
107
  - "established": The time range which the land was acquired, either "2024" or "pre-2024".
108
- - "reGAP": The GAP status code; corresponds to the level of protection the area has. There are 4 gap codes and are defined as the following.
109
- Status 1: Permanently protected to maintain a natural state, allowing natural disturbances or mimicking them through management.
110
- Status 2: Permanently protected but may allow some uses or management practices that degrade natural communities or suppress natural disturbances.
111
- Status 3: Permanently protected from major land cover conversion but allows some extractive uses (e.g., logging, mining) and protects federally listed species.
112
- Status 4: No protection mandates; land may be converted to unnatural habitat types or its management intent is unknown.
113
-
114
  - "name": The name of a protected area. The user may use a shortened name and/or not capitalize it. For example, "redwoods" may refer to "Redwood National Park", or "klamath" refers to "Klamath National Forest". Another example, "san diego wildlife refuge" could refer to multiple areas, so you would use "WHERE LOWER("name") LIKE '%san diego%' AND LOWER("name") LIKE '%wildlife%' AND LOWER("name") LIKE '%refuge%';" in your SQL query, to ensure that it is case-insensitive and matches any record that includes our phrases, because we don't want to overlook a match. If the name isn't capitalized, you MUST ensure the search is case-insensitive by converting "name" to lowercase.
115
  The names of the largest parks are {names}.
116
  - "access_type": Level of access to the land: "Unknown Access","Restricted Access","No Public Access" and "Open Access".
@@ -122,17 +121,13 @@ The names of the largest parks are {names}.
122
  - "type": Physical type of area, either "Land" or "Water".
123
  - "richness": Species richness; higher values indicate better biodiversity.
124
  - "rsr": Range-size rarity; higher values indicate better rarity metrics.
125
- - "svi": Social Vulnerability Index based on 4 themes: socioeconomic status, household characteristics, racial & ethnic minority status, and housing & transportation. Higher values indicate greater vulnerability.
126
- - Themes:
127
- - "svi_socioeconomic_status": Poverty, unemployment, housing cost burden, education, and health insurance.
128
- - "svi_household_char": Age, disability, single-parent households, and language proficiency.
129
- - "svi_racial_ethnic_minority": Race and ethnicity variables.
130
- - "svi_housing_transit": Housing type, crowding, vehicles, and group quarters.
131
- - "percent_disadvantaged": Justice40-defined disadvantaged communities overburdened by climate, energy, health, housing, pollution, transportation, water, and workforce factors. Higher values indicate more disadvantage. Range is between 0 and 1.
132
- - "deforest_carbon": Carbon emissions due to deforestation.
133
- - "human_impact": A score representing the human footprint: cumulative anthropogenic impacts such as land cover change, population density, and infrastructure.
134
- - "percent_fire_10yr": The percentage of the area burned by fires from (2013-2022). Range is between 0 and 1.
135
- - "percent_rxburn_10yr": The percentage of the area affected by prescribed burns from (2013-2022). Range is between 0 and 1.
136
 
137
  Only use the following tables:
138
  {table_info}.
 
36
  ## Example:
37
  example_user: "Which gap code has been impacted the most by fire?"
38
  example_assistant: {{"sql_query":
39
+ SELECT "reGAP", SUM("fire") AS temp
40
  FROM mydata
41
  GROUP BY "reGAP"
42
  ORDER BY temp ASC
43
  LIMIT 1;
44
+ "explanation":"I used the `fire` column, which shows the percentage of each area burned over the past 10 years (2013–2022), summing it for each GAP code to find the one with the highest total fire impact."
45
  }}
46
 
47
  ## Example:
 
70
  ## Example:
71
  example_user: "Show me the 50 most biodiverse areas found in disadvantaged communities."
72
  example_assistant: {{"sql_query":
73
+ SELECT "id", "geom", "name", "acres", "richness", "disadvantaged_communities" FROM mydata
74
+ WHERE "disadvantaged_communities" > 0
75
  ORDER BY "richness" DESC
76
  LIMIT 50;
77
+ "explanation": "I used the `richness` column to measure biodiversity and the `disadvantaged_communities` column to identify areas located in disadvantaged communities. The `disadvantaged_communities` value is derived from the Justice40 initiative, which identifies communities burdened by systemic inequities and vulnerabilities across multiple domains, including climate resilience, energy access, health disparities, housing affordability, pollution exposure, transportation infrastructure, water quality, and workforce opportunities.
78
 
79
+ The results are sorted in descending order by biodiversity richness (highest biodiversity first), and only areas with a `disadvantaged_communities` value greater than 0 (indicating some portion of the area overlaps with a disadvantaged community) are included."
80
  }}
81
 
82
 
 
90
  SELECT "id", "geom", "name", "acres","richness", "reGAP"
91
  FROM mydata
92
  WHERE "reGAP" = 3
93
+ AND "fire" >= 0.5
94
  and "manager_type" = "Federal"
95
  AND "richness" > (SELECT temp FROM temp_tab);
96
 
 
105
 
106
  # Detailed Explanation of the Columns in the California Dataset
107
  - "established": The time range which the land was acquired, either "2024" or "pre-2024".
108
+ - "reGAP": The GAP code; corresponds to the level of protection the area has. There are 4 gap codes and are defined as the following.
109
+ GAP 1: Permanently protected to maintain a natural state, allowing natural disturbances or mimicking them through management.
110
+ GAP 2: Permanently protected but may allow some uses or management practices that degrade natural communities or suppress natural disturbances.
111
+ GAP 3: Permanently protected from major land cover conversion but allows some extractive uses (e.g., logging, mining) and protects federally listed species.
112
+ GAP 4: No protection mandates; land may be converted to unnatural habitat types or its management intent is unknown.
 
113
  - "name": The name of a protected area. The user may use a shortened name and/or not capitalize it. For example, "redwoods" may refer to "Redwood National Park", or "klamath" refers to "Klamath National Forest". Another example, "san diego wildlife refuge" could refer to multiple areas, so you would use "WHERE LOWER("name") LIKE '%san diego%' AND LOWER("name") LIKE '%wildlife%' AND LOWER("name") LIKE '%refuge%';" in your SQL query, to ensure that it is case-insensitive and matches any record that includes our phrases, because we don't want to overlook a match. If the name isn't capitalized, you MUST ensure the search is case-insensitive by converting "name" to lowercase.
114
  The names of the largest parks are {names}.
115
  - "access_type": Level of access to the land: "Unknown Access","Restricted Access","No Public Access" and "Open Access".
 
121
  - "type": Physical type of area, either "Land" or "Water".
122
  - "richness": Species richness; higher values indicate better biodiversity.
123
  - "rsr": Range-size rarity; higher values indicate better rarity metrics.
124
+ - "svi": Social Vulnerability Index based on 4 themes: 1) socioeconomic status (e.g. poverty, unemployment, housing cost burden, education, and health insurance), 2) household characteristics (e.g. age, disability, single-parent households, and language proficiency), 3) racial & ethnic minority status (e.g. race and ethnicity variables), and 4) housing & transportation (housing type, crowding, vehicles, and group quarters.). Higher values indicate greater vulnerability.
125
+ - "disadvantaged_communities": Justice40-defined disadvantaged communities overburdened by climate, energy, health, housing, pollution, transportation, water, and workforce factors. Higher values indicate more disadvantage. Range is between 0 and 1.
126
+ - "fire": The percentage of the area burned by fires from (2013-2022). Areas can burn more than once, thus the percentage can be above 1
127
+ - "rxburn": The percentage of the area affected by prescribed burns from (2013-2022). Areas can be burned more than once.
128
+ - "status": The conservation status. GAP 1 and 2 count towards 30x30, thus are "30x30-conserved", GAP 3 and 4 land are grouped into "other-conserved", and areas outside of GAP are designed "non-conserved".
129
+ - "ecoregion": Ecoregions are areas with similar ecosystems and environmental resources. The ecoregions in California are: 'Sierra Nevada Foothills','Southern Cascades','Southeastern Great Basin','Southern CA Mountains and Valleys','Sonoran Desert', 'Northwestern Basin','Colorado Desert','Central Valley Coast Ranges', 'Great Valley (South)', 'Sierra Nevada','Northern CA Coast Ranges', 'Northern CA Interior Coast Ranges','Mojave Desert', 'Mono', 'Southern CA Coast', 'Modoc Plateau', 'Klamath Mountains','Northern CA Coast','Great Valley (North)', 'Central CA Coast', and 'None'.
130
+
 
 
 
 
131
 
132
  Only use the following tables:
133
  {table_info}.
app/utils.py CHANGED
@@ -26,16 +26,10 @@ def get_summary(ca, combined_filter, column, colors=None): #summary stats, based
26
  mean_rsr = (_.rsr * _.acres).sum() / _.acres.sum(),
27
  mean_irrecoverable_carbon = (_.irrecoverable_carbon * _.acres).sum() / _.acres.sum(),
28
  mean_manageable_carbon = (_.manageable_carbon * _.acres).sum() / _.acres.sum(),
29
- mean_percent_fire_10yr = (_.percent_fire_10yr *_.acres).sum()/_.acres.sum(),
30
- mean_percent_rxburn_10yr = (_.percent_rxburn_10yr *_.acres).sum()/_.acres.sum(),
31
- mean_percent_disadvantaged = (_.percent_disadvantaged * _.acres).sum() / _.acres.sum(),
32
  mean_svi = (_.svi * _.acres).sum() / _.acres.sum(),
33
- mean_svi_socioeconomic_status = (_.svi_socioeconomic_status * _.acres).sum() / _.acres.sum(),
34
- mean_svi_household_char = (_.svi_household_char * _.acres).sum() / _.acres.sum(),
35
- mean_svi_racial_ethnic_minority = (_.svi_racial_ethnic_minority * _.acres).sum() / _.acres.sum(),
36
- mean_svi_housing_transit = (_.svi_housing_transit * _.acres).sum() / _.acres.sum(),
37
- mean_carbon_lost = (_.deforest_carbon * _.acres).sum() / _.acres.sum(),
38
- mean_human_impact = (_.human_impact * _.acres).sum() / _.acres.sum(),
39
  )
40
  .mutate(percent_protected=_.percent_protected.round(1))
41
  )
@@ -58,6 +52,11 @@ def summary_table(ca, column, colors, filter_cols, filter_vals,colorby_vals): #
58
  filter_cols.append(column)
59
  filters.append(getattr(_, column).isin(colorby_vals[column]))
60
  combined_filter = reduce(lambda x, y: x & y, filters) #combining all the filters into ibis filter expression
 
 
 
 
 
61
  df = get_summary(ca, combined_filter, [column], colors) # df used for charts
62
  df_tab = get_summary(ca, combined_filter, filter_cols, colors = None) #df used for printed table
63
  return df, df_tab
@@ -84,9 +83,12 @@ def area_plot(df, column): #percent protected pie chart
84
  def bar_chart(df, x, y, title): #display summary stats for color_by column
85
 
86
  #axis label angles / chart size
87
- if x == "manager_type": #labels are too long, making vertical
88
  angle = 270
89
  height = 373
 
 
 
90
  else: #other labels are horizontal
91
  angle = 0
92
  height = 310
@@ -106,7 +108,7 @@ def bar_chart(df, x, y, title): #display summary stats for color_by column
106
  access_label=f"replace(datum.{x}, ' Access', '')" #omit access from access_type labels so it fits in frame
107
  ).encode(
108
  x=alt.X("access_label:N",
109
- axis=alt.Axis(labelAngle=angle, title=x_title),
110
  sort=sort),
111
  y=alt.Y(y, axis=alt.Axis()),
112
  color=alt.Color('color').scale(None)
@@ -219,6 +221,9 @@ def get_pmtiles_style(paint, alpha, filter_cols, filter_vals):
219
  for col, val in zip(filter_cols, filter_vals):
220
  filters.append(["match", ["get", col], val, True, False])
221
  combined_filters = ["all"] + filters
 
 
 
222
  style = {
223
  "version": 8,
224
  "sources": {
@@ -231,7 +236,7 @@ def get_pmtiles_style(paint, alpha, filter_cols, filter_vals):
231
  {
232
  "id": "ca30x30",
233
  "source": "ca",
234
- "source-layer": "layer",
235
  "type": "fill",
236
  "filter": combined_filters,
237
  "paint": {
@@ -257,7 +262,7 @@ def get_pmtiles_style_llm(paint, ids):
257
  {
258
  "id": "ca30x30",
259
  "source": "ca",
260
- "source-layer": "layer",
261
  "type": "fill",
262
  "filter": combined_filters,
263
  "paint": {
 
26
  mean_rsr = (_.rsr * _.acres).sum() / _.acres.sum(),
27
  mean_irrecoverable_carbon = (_.irrecoverable_carbon * _.acres).sum() / _.acres.sum(),
28
  mean_manageable_carbon = (_.manageable_carbon * _.acres).sum() / _.acres.sum(),
29
+ mean_fire = (_.fire *_.acres).sum()/_.acres.sum(),
30
+ mean_rxburn = (_.rxburn *_.acres).sum()/_.acres.sum(),
31
+ mean_disadvantaged_communities = (_.disadvantaged_communities * _.acres).sum() / _.acres.sum(),
32
  mean_svi = (_.svi * _.acres).sum() / _.acres.sum(),
 
 
 
 
 
 
33
  )
34
  .mutate(percent_protected=_.percent_protected.round(1))
35
  )
 
52
  filter_cols.append(column)
53
  filters.append(getattr(_, column).isin(colorby_vals[column]))
54
  combined_filter = reduce(lambda x, y: x & y, filters) #combining all the filters into ibis filter expression
55
+ print(column)
56
+ print(combined_filter)
57
+ if column == "status":
58
+ combined_filter = (combined_filter) | (_.status.isin(['30x30-conserved','other-conserved','non-conserved']))
59
+ print(combined_filter)
60
  df = get_summary(ca, combined_filter, [column], colors) # df used for charts
61
  df_tab = get_summary(ca, combined_filter, filter_cols, colors = None) #df used for printed table
62
  return df, df_tab
 
83
  def bar_chart(df, x, y, title): #display summary stats for color_by column
84
 
85
  #axis label angles / chart size
86
+ if x in ["manager_type", 'ecoregion','status']: #labels are too long, making vertical
87
  angle = 270
88
  height = 373
89
+ if x == 'ecoregion':
90
+ height = 430
91
+
92
  else: #other labels are horizontal
93
  angle = 0
94
  height = 310
 
108
  access_label=f"replace(datum.{x}, ' Access', '')" #omit access from access_type labels so it fits in frame
109
  ).encode(
110
  x=alt.X("access_label:N",
111
+ axis=alt.Axis(labelAngle=angle, title=x_title, labelLimit = 200),
112
  sort=sort),
113
  y=alt.Y(y, axis=alt.Axis()),
114
  color=alt.Color('color').scale(None)
 
221
  for col, val in zip(filter_cols, filter_vals):
222
  filters.append(["match", ["get", col], val, True, False])
223
  combined_filters = ["all"] + filters
224
+ if paint['property'] == "status": #show non-conserved and other-conserved areas
225
+ conserved = ['match', ['get', 'status'], ['30x30-conserved', 'other-conserved', 'non-conserved'], True, False]
226
+ combined_filters = ['any']+ [combined_filters] + [conserved]
227
  style = {
228
  "version": 8,
229
  "sources": {
 
236
  {
237
  "id": "ca30x30",
238
  "source": "ca",
239
+ "source-layer": "ca_30x30_stats",
240
  "type": "fill",
241
  "filter": combined_filters,
242
  "paint": {
 
262
  {
263
  "id": "ca30x30",
264
  "source": "ca",
265
+ "source-layer": "ca_30x30_stats",
266
  "type": "fill",
267
  "filter": combined_filters,
268
  "paint": {
app/variables.py CHANGED
@@ -1,6 +1,9 @@
1
  # urls for main layer
2
- ca_pmtiles = "https://huggingface.co/datasets/boettiger-lab/ca-30x30/resolve/main/cpad-stats.pmtiles"
3
- ca_parquet = "https://huggingface.co/datasets/boettiger-lab/ca-30x30/resolve/main/cpad-stats.parquet"
 
 
 
4
 
5
  ca_area_acres = 1.014e8 #acres
6
  style_choice = "GAP Status Code"
@@ -13,8 +16,6 @@ url_irr_carbon = "https://huggingface.co/datasets/boettiger-lab/ca-30x30/resolve
13
  url_man_carbon = "https://huggingface.co/datasets/boettiger-lab/ca-30x30/resolve/main/ca_manageable_c_2018_cog.tif"
14
  url_svi = "https://data.source.coop/cboettig/social-vulnerability/svi2020_us_county.pmtiles"
15
  url_justice40 = "https://data.source.coop/cboettig/justice40/disadvantaged-communities.pmtiles"
16
- url_loss_carbon = "https://huggingface.co/datasets/boettiger-lab/ca-30x30/resolve/main/deforest-carbon-ca/{z}/{x}/{y}.png"
17
- url_hi = "https://huggingface.co/datasets/boettiger-lab/ca-30x30/resolve/main/ca_human_impact_cog.tif"
18
  url_calfire = "https://huggingface.co/datasets/boettiger-lab/ca-30x30/resolve/main/cal_fire_2022.pmtiles"
19
  url_rxburn = "https://huggingface.co/datasets/boettiger-lab/ca-30x30/resolve/main/cal_rxburn_2022.pmtiles"
20
 
@@ -41,6 +42,7 @@ white = "#FFFFFF"
41
 
42
  # gap codes 3 and 4 are off by default.
43
  default_gap = {
 
44
  3: False,
45
  4: False,
46
  }
@@ -60,7 +62,8 @@ manager = {
60
  ['Joint', joint_color],
61
  ['Tribal', tribal_color],
62
  ['Private', private_color],
63
- ['HOA', hoa_color]
 
64
  ]
65
  }
66
 
@@ -69,7 +72,8 @@ easement = {
69
  'type': 'categorical',
70
  'stops': [
71
  ['True', private_access_color],
72
- ['False', public_access_color]
 
73
  ]
74
  }
75
 
@@ -78,7 +82,8 @@ year = {
78
  'type': 'categorical',
79
  'stops': [
80
  ['pre-2024', year2023_color],
81
- ['2024', year2024_color]
 
82
  ]
83
  }
84
 
@@ -89,12 +94,14 @@ access = {
89
  ['Open Access', public_access_color],
90
  ['No Public Access', private_access_color],
91
  ['Unknown Access', "#bbbbbb"],
92
- ['Restricted Access', tribal_color]
 
 
93
  ]
94
  }
95
 
96
  gap = {
97
- 'property': 'reGAP',
98
  'type': 'categorical',
99
  'stops': [
100
  [1, "#26633d"],
@@ -104,9 +111,80 @@ gap = {
104
  ]
105
  }
106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  style_options = {
108
  "Year": year,
109
- "GAP Status Code": gap,
 
 
110
  "Manager Type": manager,
111
  "Easement": easement,
112
  "Access Type": access,
@@ -146,9 +224,12 @@ justice40_style = {
146
 
147
  select_column = {
148
  "Year": "established",
149
- "GAP Status Code": "reGAP",
 
 
150
  "Manager Type": "manager_type",
151
  "Easement": "easement",
152
- "Access Type": "access_type",
 
153
  }
154
 
 
1
  # urls for main layer
2
+ # ca_pmtiles = "https://huggingface.co/datasets/boettiger-lab/ca-30x30/resolve/main/cpad-stats.pmtiles"
3
+ # ca_parquet = "https://huggingface.co/datasets/boettiger-lab/ca-30x30/resolve/main/cpad-stats.parquet"
4
+
5
+ ca_pmtiles = "https://huggingface.co/datasets/boettiger-lab/ca-30x30/resolve/main/ca_30x30_stats.pmtiles"
6
+ ca_parquet = "https://huggingface.co/datasets/boettiger-lab/ca-30x30/resolve/main/ca_30x30_stats.parquet"
7
 
8
  ca_area_acres = 1.014e8 #acres
9
  style_choice = "GAP Status Code"
 
16
  url_man_carbon = "https://huggingface.co/datasets/boettiger-lab/ca-30x30/resolve/main/ca_manageable_c_2018_cog.tif"
17
  url_svi = "https://data.source.coop/cboettig/social-vulnerability/svi2020_us_county.pmtiles"
18
  url_justice40 = "https://data.source.coop/cboettig/justice40/disadvantaged-communities.pmtiles"
 
 
19
  url_calfire = "https://huggingface.co/datasets/boettiger-lab/ca-30x30/resolve/main/cal_fire_2022.pmtiles"
20
  url_rxburn = "https://huggingface.co/datasets/boettiger-lab/ca-30x30/resolve/main/cal_rxburn_2022.pmtiles"
21
 
 
42
 
43
  # gap codes 3 and 4 are off by default.
44
  default_gap = {
45
+ 0: False,
46
  3: False,
47
  4: False,
48
  }
 
62
  ['Joint', joint_color],
63
  ['Tribal', tribal_color],
64
  ['Private', private_color],
65
+ ['HOA', hoa_color],
66
+ # ['None',white]
67
  ]
68
  }
69
 
 
72
  'type': 'categorical',
73
  'stops': [
74
  ['True', private_access_color],
75
+ ['False', public_access_color],
76
+ # ['None', white]
77
  ]
78
  }
79
 
 
82
  'type': 'categorical',
83
  'stops': [
84
  ['pre-2024', year2023_color],
85
+ ['2024', year2024_color],
86
+ # ['None',white]
87
  ]
88
  }
89
 
 
94
  ['Open Access', public_access_color],
95
  ['No Public Access', private_access_color],
96
  ['Unknown Access', "#bbbbbb"],
97
+ ['Restricted Access', tribal_color],
98
+ # ['None', white]
99
+
100
  ]
101
  }
102
 
103
  gap = {
104
+ 'property': 'gap_code',
105
  'type': 'categorical',
106
  'stops': [
107
  [1, "#26633d"],
 
111
  ]
112
  }
113
 
114
+ status = {
115
+ 'property': 'status',
116
+ 'type': 'categorical',
117
+ 'stops': [
118
+ ['30x30-conserved', "#26633d"],
119
+ ['other-conserved', "#879647"],
120
+ ['non-conserved', "#A9A9A9"]
121
+ ]
122
+ }
123
+
124
+
125
+ # ecoregion = {
126
+ # 'property': 'ecoregion',
127
+ # 'type': 'categorical',
128
+ # 'stops': [
129
+ # ['Sierra Nevada Foothills', "#1f77b4"],
130
+ # ['Southern Cascades', "#ff7f0e"],
131
+ # ['Southeastern Great Basin', "#2ca02c"],
132
+ # ['Southern California Mountains and Valleys', "#d62728"],
133
+ # ['Sonoran Desert', "#9467bd"],
134
+ # ['Northwestern Basin', "#8c564b"],
135
+ # ['Colorado Desert', "#e377c2"],
136
+ # ['Central Valley Coast Ranges', "#7f7f7f"],
137
+ # ['Great Valley (South)', "#bcbd22"],
138
+ # ['Sierra Nevada', "#17becf"],
139
+ # ['Northern California Coast Ranges', "#aec7e8"],
140
+ # ['Northern California Interior Coast Ranges', "#ffbb78"],
141
+ # ['Mojave Desert', "#98df8a"],
142
+ # ['Mono', "#ff9896"],
143
+ # ['Southern California Coast', "#c5b0d5"],
144
+ # ['Modoc Plateau', "#c49c94"],
145
+ # ['Klamath Mountains', "#f7b6d2"],
146
+ # ['Northern California Coast', "#c7c7c7"],
147
+ # ['Great Valley (North)', "#dbdb8d"],
148
+ # ['Central California Coast', "#9edae5"],
149
+ # ['None', "#A9A9A9"]
150
+ # ]
151
+ # }
152
+
153
+ ecoregion = {
154
+ 'property': 'ecoregion',
155
+ 'type': 'categorical',
156
+ 'stops': [
157
+ ['Sierra Nevada Foothills', "#1f77b4"],
158
+ ['Southern Cascades', "#ff7f0e"],
159
+ ['Southeastern Great Basin', "#2ca02c"],
160
+ ['Southern CA Mountains and Valleys', "#d62728"],
161
+ ['Sonoran Desert', "#9467bd"],
162
+ ['Northwestern Basin', "#8c564b"],
163
+ ['Colorado Desert', "#e377c2"],
164
+ ['Central Valley Coast Ranges', "#7f7f7f"],
165
+ ['Great Valley (South)', "#bcbd22"],
166
+ ['Sierra Nevada', "#17becf"],
167
+ ['Northern CA Coast Ranges', "#aec7e8"],
168
+ ['Northern CA Interior Coast Ranges', "#ffbb78"],
169
+ ['Mojave Desert', "#98df8a"],
170
+ ['Mono', "#ff9896"],
171
+ ['Southern CA Coast', "#c5b0d5"],
172
+ ['Modoc Plateau', "#c49c94"],
173
+ ['Klamath Mountains', "#f7b6d2"],
174
+ ['Northern CA Coast', "#c7c7c7"],
175
+ ['Great Valley (North)', "#dbdb8d"],
176
+ ['Central CA Coast', "#9edae5"],
177
+ ['None', "#A9A9A9"]
178
+ ]
179
+ }
180
+
181
+
182
+
183
  style_options = {
184
  "Year": year,
185
+ "GAP Code": gap,
186
+ "Status": status,
187
+ "Ecoregion": ecoregion,
188
  "Manager Type": manager,
189
  "Easement": easement,
190
  "Access Type": access,
 
224
 
225
  select_column = {
226
  "Year": "established",
227
+ "GAP Code": "gap_code",
228
+ "Status": "status",
229
+ "Ecoregion": "ecoregion",
230
  "Manager Type": "manager_type",
231
  "Easement": "easement",
232
+ "Access Type": "access_type"
233
+
234
  }
235