ecoscape-utilities 0.0.31__py3-none-any.whl → 0.0.33__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ecoscape-utilities might be problematic. Click here for more details.

@@ -486,42 +486,12 @@ A module for common functionality in the validaiton process using ebird data
486
486
  """
487
487
  class Validation(object):
488
488
 
489
- def __init__(self, obs_fn, geotiff_fn):
489
+ def __init__(self, obs_fn):
490
490
  """
491
491
  Generates a class for validation.
492
- It first tries to read the cached version of obs_fn for the specified geotiff_fn.
493
- If the cached version is not found, it is created.
494
- The cached version contains pre-translated coordinates to pixel values.
495
492
  :param obs_fn: Observations filename.
496
- :param geotiff_fn: name of a geotiff (habitat is preferred) used
497
- for translating coordinates to pixel coordinates.
498
493
  """
499
494
  self.obs_fn = obs_fn
500
- self.geotiff_fn = geotiff_fn
501
- h = hashlib.sha1(obs_fn.encode('utf-8'))
502
- h.update(geotiff_fn.encode('utf-8'))
503
- cached_fn = obs_fn + "." + h.hexdigest() + ".csv"
504
- if not os.path.exists(cached_fn):
505
- self._create_cached_observations(cached_fn)
506
- self.observations = pd.read_csv(cached_fn)
507
-
508
-
509
- def _create_cached_observations(self, cached_fn):
510
- """Creates a cached version of the observations that also contains
511
- pixel coordinates."""
512
- geotiff = GeoTiff.from_file(self.geotiff_fn)
513
- def f(row):
514
- square = row["Square"]
515
- if (isinstance(square, str)):
516
- coords = format_coords(square)
517
- else:
518
- coords = square
519
- lat, lng = coords
520
- pix_x, pix_y = transform_coords(geotiff, coords)
521
- return lat, lng, pix_x, pix_y
522
- df = pd.read_csv(self.obs_fn)
523
- df["lat"], df["lng"], df["pix_x"], df["pix_y"] = zip(*df.apply(f, axis=1))
524
- df.to_csv(cached_fn)
525
495
 
526
496
 
527
497
  def filter_CA_rectangle(self, observation_ratios, bigsquare=False):
@@ -602,9 +572,10 @@ class Validation(object):
602
572
  else:
603
573
  coords = square
604
574
  lat, lng = coords
605
- coords = transform_coords(repop_tif, coords)
606
- repop_tile = repop_tif.get_tile_from_coord(coords, tile_scale=tile_scale)
607
- hab_tile = hab.get_tile_from_coord(hab, coords, tile_scale=tile_scale)
575
+ repop_pix_coords = transform_coords(repop_tif, coords)
576
+ hab_pix_coords = transform_coords(hab, coords)
577
+ repop_tile = repop_tif.get_tile_from_coord(repop_pix_coords, tile_scale=tile_scale)
578
+ hab_tile = hab.get_tile_from_coord(hab_pix_coords, tile_scale=tile_scale)
608
579
  if repop_tile is None or hab_tile is None:
609
580
  continue
610
581
  x, y = repop_tif.get_pixel_from_coord(coords)
@@ -638,9 +609,15 @@ class Validation(object):
638
609
  """
639
610
  df = self.observations.copy()
640
611
  def f(row):
641
- coords = (row["pix_x"], row["pix_y"])
642
- repop_tile = repop_tif.get_tile_from_coord(coords, tile_scale=tile_scale)
643
- hab_tile = hab_tif.get_tile_from_coord(coords, tile_scale=tile_scale)
612
+ square = row["Square"]
613
+ if (isinstance(square, str)):
614
+ coords = format_coords(square)
615
+ else:
616
+ coords = square
617
+ repop_pix_coords = transform_coords(repop_tif, coords)
618
+ hab_pix_coords = transform_coords(hab_tif, coords)
619
+ repop_tile = repop_tif.get_tile_from_coord(repop_pix_coords, tile_scale=tile_scale)
620
+ hab_tile = hab_tif.get_tile_from_coord(hab_pix_coords, tile_scale=tile_scale)
644
621
  if repop_tile is None or hab_tile is None:
645
622
  return pd.NA, pd.NA, pd.NA, pd.NA
646
623
  avg_repop = np.average(repop_tile.m)
@@ -1,7 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ecoscape-utilities
3
- Version: 0.0.31
3
+ Version: 0.0.33
4
4
  Summary: A collection of EcoScape utilities.
5
+ Author-email: Luca de Alfaro <luca@ucsc.edu>, Coen Adler <ctadler@ucsc.edu>, Artie Nazarov <anazarov@ucsc.edu>, Natalia Ocampo-Peñuela <nocampop@ucsc.edu>, Jasmine Tai <cjtai@ucsc.edu>, Natalie Valett <nvalett@ucsc.edu>
6
+ Project-URL: Homepage, https://github.com/ecoscape-earth/ecoscape-utilities
7
+ Project-URL: Bug Tracker, https://github.com/ecoscape-earth/ecoscape-utilities/issues
5
8
  Classifier: Programming Language :: Python :: 3
6
9
  Classifier: License :: OSI Approved :: BSD License
7
10
  Classifier: Operating System :: OS Independent
@@ -22,3 +25,12 @@ These are not packages distributed with pip. To install on Colab, simply do:
22
25
 
23
26
  !pip install git+https://github.com/ecoscape-earth/ecoscape-utilities.git
24
27
 
28
+ ## Authors
29
+
30
+ * Luca de Alfaro (luca@ucsc.edu)
31
+ * Natalia Ocampo-Peñuela (nocampop@ucsc.edu)
32
+ * Coen Adler (ctadler@ucsc.edu)
33
+ * Artie Nazarov (anazarov@ucsc.edu)
34
+ * Natalie Valett (nvalett@ucsc.edu)
35
+ * Jasmine Tai (cjtai@ucsc.edu)
36
+
@@ -0,0 +1,8 @@
1
+ ecoscape_utilities/__init__.py,sha256=LXt1rL9JVsjnCmsNZwZ2aoElphIK-koaEDdW6ffZsMQ,50
2
+ ecoscape_utilities/bird_runs.py,sha256=v43PfH_4ojpkTE-EFOJxr0oOW3M9suNm_1zMjZ9P-eI,5409
3
+ ecoscape_utilities/ebird_db.py,sha256=qtnAjc4mid7bcwVTrg0h30UyuyydWbfh2Ogaei4_WuA,30062
4
+ ecoscape_utilities-0.0.33.dist-info/licenses/LICENSE.md,sha256=3vh2mpA_XIR3FJot6a5F9DqktAoq45sEGIRkYjvAEeU,1304
5
+ ecoscape_utilities-0.0.33.dist-info/METADATA,sha256=_IF2EBqPc-R9FvnaDnuR5SRut2JSi5J7d5PanptTz4E,1382
6
+ ecoscape_utilities-0.0.33.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
7
+ ecoscape_utilities-0.0.33.dist-info/top_level.txt,sha256=jLf7iMlySaJg0Vh8z4lbAaqOc5W5ruMgKFvp797CryQ,19
8
+ ecoscape_utilities-0.0.33.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
- Copyright 2023, Anonymous Authors.
1
+ Copyright 2023, The Regents of the University of California.
2
2
 
3
3
  Redistribution and use in source and binary forms, with or without modification,
4
4
  are permitted provided that the following conditions are met:
@@ -1,8 +0,0 @@
1
- ecoscape_utilities/__init__.py,sha256=LXt1rL9JVsjnCmsNZwZ2aoElphIK-koaEDdW6ffZsMQ,50
2
- ecoscape_utilities/bird_runs.py,sha256=v43PfH_4ojpkTE-EFOJxr0oOW3M9suNm_1zMjZ9P-eI,5409
3
- ecoscape_utilities/ebird_db.py,sha256=kAskQs-wMmEvw0il43FmiXFTdaVfB0ixSTdplM8LSxo,31113
4
- ecoscape_utilities-0.0.31.dist-info/licenses/LICENSE.md,sha256=k1X_-oX09VNJtOCwd34FfQCLUJvhCaV7OHk-3zzBYLs,1279
5
- ecoscape_utilities-0.0.31.dist-info/METADATA,sha256=iCqY5VIZiMfSw95lpkVJevOUpcY5VgNePuNEyRO8KoM,772
6
- ecoscape_utilities-0.0.31.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
7
- ecoscape_utilities-0.0.31.dist-info/top_level.txt,sha256=jLf7iMlySaJg0Vh8z4lbAaqOc5W5ruMgKFvp797CryQ,19
8
- ecoscape_utilities-0.0.31.dist-info/RECORD,,