aeiche01 commited on
Commit
6555128
·
verified ·
1 Parent(s): 4420003

Update pages/_common.py

Browse files
Files changed (1) hide show
  1. pages/_common.py +12 -5
pages/_common.py CHANGED
@@ -80,6 +80,11 @@ NAME_COL = "scientific_name_clements"
80
  TYPE_COL = "species_type"
81
  SEASON_COL = "season"
82
 
 
 
 
 
 
83
  # species_type value -> UI group label
84
  TYPE_TO_GROUP = {"resident": "Resident", "migrant": "Migratory", "subspecies": "Subspecies"}
85
  GROUP_ORDER = ["Resident", "Migratory", "Subspecies"]
@@ -389,9 +394,10 @@ def get_iucn_fc(species: str) -> ee.FeatureCollection:
389
 
390
  def _occ_name(species: str) -> str:
391
  """
392
- Map a display name to the value used in final_occs.scientific_name_clements.
393
- final_occs carries trinomials for subspecies, so identity matching is correct
394
- for every taxon. Centralized here in case the occurrence keying ever changes.
 
395
  """
396
  return species
397
 
@@ -399,10 +405,11 @@ def _occ_name(species: str) -> str:
399
  def get_occurrences_fc(species: str) -> ee.FeatureCollection:
400
  """
401
  Occurrence points for the species (season-independent).
402
- Filters on 'scientific_name_clements' == display name (space format).
 
403
  """
404
  return (ee.FeatureCollection(ASSET_FINAL_OCCS)
405
- .filter(ee.Filter.eq("scientific_name_clements", _occ_name(species))))
406
 
407
 
408
  def query_occ_at_click(lat: float, lon: float, species: str,
 
80
  TYPE_COL = "species_type"
81
  SEASON_COL = "season"
82
 
83
+ # Column in final_occs used to match occurrences to a taxon. The original
84
+ # 'scientific_name_clements' lacked subspecies; 'scientific_name_clements_fix'
85
+ # carries both species and subspecies names.
86
+ OCC_NAME_COL = "scientific_name_clements_fix"
87
+
88
  # species_type value -> UI group label
89
  TYPE_TO_GROUP = {"resident": "Resident", "migrant": "Migratory", "subspecies": "Subspecies"}
90
  GROUP_ORDER = ["Resident", "Migratory", "Subspecies"]
 
394
 
395
  def _occ_name(species: str) -> str:
396
  """
397
+ Map a display name to the value used in final_occs[OCC_NAME_COL].
398
+ That column carries both species and subspecies names in 'Genus species'
399
+ (and trinomial) space format, matching the display name, so identity
400
+ matching is correct for every taxon.
401
  """
402
  return species
403
 
 
405
  def get_occurrences_fc(species: str) -> ee.FeatureCollection:
406
  """
407
  Occurrence points for the species (season-independent).
408
+ Filters on OCC_NAME_COL == display name (space format), which includes
409
+ subspecies.
410
  """
411
  return (ee.FeatureCollection(ASSET_FINAL_OCCS)
412
+ .filter(ee.Filter.eq(OCC_NAME_COL, _occ_name(species))))
413
 
414
 
415
  def query_occ_at_click(lat: float, lon: float, species: str,