ecoscape-utilities 0.0.3__tar.gz
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.
- ecoscape-utilities-0.0.3/LICENSE.md +10 -0
- ecoscape-utilities-0.0.3/PKG-INFO +31 -0
- ecoscape-utilities-0.0.3/README.md +17 -0
- ecoscape-utilities-0.0.3/ecoscape_utilities/__init__.py +2 -0
- ecoscape-utilities-0.0.3/ecoscape_utilities/bird_runs.py +102 -0
- ecoscape-utilities-0.0.3/ecoscape_utilities.egg-info/PKG-INFO +31 -0
- ecoscape-utilities-0.0.3/ecoscape_utilities.egg-info/SOURCES.txt +10 -0
- ecoscape-utilities-0.0.3/ecoscape_utilities.egg-info/dependency_links.txt +1 -0
- ecoscape-utilities-0.0.3/ecoscape_utilities.egg-info/top_level.txt +1 -0
- ecoscape-utilities-0.0.3/pyproject.toml +35 -0
- ecoscape-utilities-0.0.3/requirements.txt +0 -0
- ecoscape-utilities-0.0.3/setup.cfg +4 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Copyright 2023, The Regents of the University of California.
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
4
|
+
are permitted provided that the following conditions are met:
|
|
5
|
+
|
|
6
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
7
|
+
|
|
8
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
9
|
+
|
|
10
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: ecoscape-utilities
|
|
3
|
+
Version: 0.0.3
|
|
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
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.7
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE.md
|
|
14
|
+
|
|
15
|
+
# EcoScape Utilities
|
|
16
|
+
|
|
17
|
+
This package is simply a collection of utilities that are useful for running
|
|
18
|
+
Colab notebooks and other code.
|
|
19
|
+
These are not packages distributed with pip. To install on Colab, simply do:
|
|
20
|
+
|
|
21
|
+
!pip install git+https://github.com/ecoscape-earth/ecoscape-utilities.git
|
|
22
|
+
|
|
23
|
+
## Authors
|
|
24
|
+
|
|
25
|
+
* Luca de Alfaro (luca@ucsc.edu)
|
|
26
|
+
* Natalia Ocampo-Peñuela (nocampop@ucsc.edu)
|
|
27
|
+
* Coen Adler (ctadler@ucsc.edu)
|
|
28
|
+
* Artie Nazarov (anazarov@ucsc.edu)
|
|
29
|
+
* Natalie Valett (nvalett@ucsc.edu)
|
|
30
|
+
* Jasmine Tai (cjtai@ucsc.edu)
|
|
31
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# EcoScape Utilities
|
|
2
|
+
|
|
3
|
+
This package is simply a collection of utilities that are useful for running
|
|
4
|
+
Colab notebooks and other code.
|
|
5
|
+
These are not packages distributed with pip. To install on Colab, simply do:
|
|
6
|
+
|
|
7
|
+
!pip install git+https://github.com/ecoscape-earth/ecoscape-utilities.git
|
|
8
|
+
|
|
9
|
+
## Authors
|
|
10
|
+
|
|
11
|
+
* Luca de Alfaro (luca@ucsc.edu)
|
|
12
|
+
* Natalia Ocampo-Peñuela (nocampop@ucsc.edu)
|
|
13
|
+
* Coen Adler (ctadler@ucsc.edu)
|
|
14
|
+
* Artie Nazarov (anazarov@ucsc.edu)
|
|
15
|
+
* Natalie Valett (nvalett@ucsc.edu)
|
|
16
|
+
* Jasmine Tai (cjtai@ucsc.edu)
|
|
17
|
+
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from collections import namedtuple
|
|
3
|
+
|
|
4
|
+
BirdRunDef = namedtuple('BirdRun', [
|
|
5
|
+
'nickname', # 6-letter ebird name.
|
|
6
|
+
'name', # official name.
|
|
7
|
+
'terrain_fn', # File for the terrain
|
|
8
|
+
'habitat_fn', # File for the habitat.
|
|
9
|
+
'transmission_fn', # Terrain transmission.
|
|
10
|
+
'resistance_original_fn', # Original terrain resistance, unrefined.
|
|
11
|
+
'terrain_histogram_json_fn', # File name for terrain histogram.
|
|
12
|
+
'terrain_histogram_csv_fn', # File name for terrain histogram.
|
|
13
|
+
'repopulation_fn', 'gradient_fn', 'log_fn',
|
|
14
|
+
'validation_fn',
|
|
15
|
+
'obs_path',
|
|
16
|
+
'obs_csv_path',
|
|
17
|
+
'do_gradient', 'do_validation',
|
|
18
|
+
'hop_distance', 'num_spreads', 'num_simulations'])
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class BirdRun(object):
|
|
22
|
+
|
|
23
|
+
def __init__(self, data_path):
|
|
24
|
+
"""Initializes a bird run, given a data path"""
|
|
25
|
+
self.files_path = data_path
|
|
26
|
+
|
|
27
|
+
def get_bird_run(self, nickname, bird_name, run_name=None, do_gradient=False, do_validation=False,
|
|
28
|
+
hop_distance=4, num_spreads=5, num_simulations=2, transmission_exponent=1):
|
|
29
|
+
"""Given a bird name in 6-letter ebird format, returns the BirdRun object for the bird."""
|
|
30
|
+
d = {"bird": nickname,
|
|
31
|
+
"run_name": run_name or "Standard",
|
|
32
|
+
"num_spreads": num_spreads,
|
|
33
|
+
"hop_distance": hop_distance,
|
|
34
|
+
"num_simulations": num_simulations,
|
|
35
|
+
"transmission_exponent": transmission_exponent}
|
|
36
|
+
self.createdir(os.path.join(self.files_path, "{bird}/Output/{run_name}".format(**d)))
|
|
37
|
+
return BirdRunDef(
|
|
38
|
+
nickname = nickname,
|
|
39
|
+
name = bird_name,
|
|
40
|
+
# Input ,
|
|
41
|
+
terrain_fn = os.path.join(self.files_path, "Terrain/iucn_habclass_lvl2_us_300_near_cropped.tif"),
|
|
42
|
+
habitat_fn = os.path.join(self.files_path, "{bird}/habitat.tif".format(**d)),
|
|
43
|
+
transmission_fn = os.path.join(self.files_path, "{bird}/transmission_refined_{transmission_exponent}.csv".format(**d)),
|
|
44
|
+
resistance_original_fn = os.path.join(self.files_path, "{bird}/resistance.csv".format(**d)),
|
|
45
|
+
terrain_histogram_json_fn = os.path.join(self.files_path, "{bird}/terrain_hist.json".format(**d)),
|
|
46
|
+
terrain_histogram_csv_fn = os.path.join(self.files_path, "{bird}/terrain_hist.csv".format(**d)),
|
|
47
|
+
# Validation files.
|
|
48
|
+
validation_fn = os.path.join(self.files_path, "{bird}/Ratios".format(**d)),
|
|
49
|
+
# Output files
|
|
50
|
+
repopulation_fn = os.path.join(self.files_path, "{bird}/Output/{run_name}/repopulation_spreads_{num_spreads}_hop_{hop_distance}_sims_{num_simulations}_texp_{transmission_exponent}.tif".format(**d)),
|
|
51
|
+
gradient_fn = os.path.join(self.files_path, "{bird}/Output/{run_name}/gradient_spreads_{num_spreads}_hop_{hop_distance}_sims_{num_simulations}_texp_{transmission_exponent}.tif".format(**d)),
|
|
52
|
+
log_fn = os.path.join(self.files_path, "{bird}/Output/{run_name}/log_spreads_{num_spreads}_hop_{hop_distance}_sims_{num_simulations}_texp_{transmission_exponent}.json".format(**d)),
|
|
53
|
+
obs_path = os.path.join(self.files_path, "{bird}/Observations".format(**d)),
|
|
54
|
+
obs_csv_path = os.path.join(self.files_path, "{bird}/Output/{run_name}/obs_{num_spreads}_hop_{hop_distance}_sims_{num_simulations}_texp_{transmission_exponent}.csv".format(**d)),
|
|
55
|
+
# Run parameters
|
|
56
|
+
do_gradient=do_gradient,
|
|
57
|
+
do_validation = do_validation,
|
|
58
|
+
hop_distance = hop_distance,
|
|
59
|
+
num_spreads = num_spreads,
|
|
60
|
+
num_simulations = num_simulations
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
def get_observations_fn(self, obs_path, bigsquare=False, **kwargs):
|
|
64
|
+
"""Completes the name of an observation ratio file, adding the information on minimum number of observations,
|
|
65
|
+
and maximum length walked.
|
|
66
|
+
"""
|
|
67
|
+
d = dict(**kwargs)
|
|
68
|
+
d["isbig"] = "_big" if bigsquare else ""
|
|
69
|
+
return os.path.join(obs_path, "CA_min_{min_checklists}_len_{max_distance}{isbig}.json".format(**d))
|
|
70
|
+
|
|
71
|
+
def get_observations_display_fn(self, obs_path, bigsquare=False, **kwargs):
|
|
72
|
+
"""Completes the name of an observation ratio tif file, adding the information on minimum number of observations,
|
|
73
|
+
and maximum length walked.
|
|
74
|
+
"""
|
|
75
|
+
d = dict(**kwargs)
|
|
76
|
+
d["isbig"] = "_big" if bigsquare else ""
|
|
77
|
+
return os.path.join(obs_path, "CA_min_{min_checklists}_len_{max_distance}{isbig}.tif".format(**d))
|
|
78
|
+
|
|
79
|
+
def get_observations_all_fn(self, obs_path, **kwargs):
|
|
80
|
+
"""Completes the name of an observation ratio file, adding the information on minimum number of observations,
|
|
81
|
+
and maximum length walked.
|
|
82
|
+
"""
|
|
83
|
+
d = dict(**kwargs)
|
|
84
|
+
return os.path.join(obs_path, "CA_all_len_{max_distance}_{date_range}_{num_squares}.csv".format(**d))
|
|
85
|
+
|
|
86
|
+
def get_observations_all_display_fn(self, obs_path, **kwargs):
|
|
87
|
+
"""Completes the name of an observation ratio tif file, adding the information on minimum number of observations,
|
|
88
|
+
and maximum length walked.
|
|
89
|
+
"""
|
|
90
|
+
d = dict(**kwargs)
|
|
91
|
+
return os.path.join(obs_path, "CA_all_len_{max_distance}_{date_range}_{num_squares}.tif".format(**d))
|
|
92
|
+
|
|
93
|
+
def createdir_for_file(self, fn):
|
|
94
|
+
"""Ensures that the path to a file exists."""
|
|
95
|
+
dirs, ffn = os.path.split(fn)
|
|
96
|
+
# print("Creating", dirs)
|
|
97
|
+
os.makedirs(dirs, exist_ok=True)
|
|
98
|
+
|
|
99
|
+
def createdir(self, dir_path):
|
|
100
|
+
"""Ensures that a folder exists."""
|
|
101
|
+
# print("Creating", dir_path)
|
|
102
|
+
os.makedirs(dir_path, exist_ok=True)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: ecoscape-utilities
|
|
3
|
+
Version: 0.0.3
|
|
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
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.7
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE.md
|
|
14
|
+
|
|
15
|
+
# EcoScape Utilities
|
|
16
|
+
|
|
17
|
+
This package is simply a collection of utilities that are useful for running
|
|
18
|
+
Colab notebooks and other code.
|
|
19
|
+
These are not packages distributed with pip. To install on Colab, simply do:
|
|
20
|
+
|
|
21
|
+
!pip install git+https://github.com/ecoscape-earth/ecoscape-utilities.git
|
|
22
|
+
|
|
23
|
+
## Authors
|
|
24
|
+
|
|
25
|
+
* Luca de Alfaro (luca@ucsc.edu)
|
|
26
|
+
* Natalia Ocampo-Peñuela (nocampop@ucsc.edu)
|
|
27
|
+
* Coen Adler (ctadler@ucsc.edu)
|
|
28
|
+
* Artie Nazarov (anazarov@ucsc.edu)
|
|
29
|
+
* Natalie Valett (nvalett@ucsc.edu)
|
|
30
|
+
* Jasmine Tai (cjtai@ucsc.edu)
|
|
31
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
LICENSE.md
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
requirements.txt
|
|
5
|
+
ecoscape_utilities/__init__.py
|
|
6
|
+
ecoscape_utilities/bird_runs.py
|
|
7
|
+
ecoscape_utilities.egg-info/PKG-INFO
|
|
8
|
+
ecoscape_utilities.egg-info/SOURCES.txt
|
|
9
|
+
ecoscape_utilities.egg-info/dependency_links.txt
|
|
10
|
+
ecoscape_utilities.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ecoscape_utilities
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ecoscape-utilities"
|
|
7
|
+
version = "0.0.3"
|
|
8
|
+
authors = [
|
|
9
|
+
{name="Luca de Alfaro", email="luca@ucsc.edu"},
|
|
10
|
+
{name="Coen Adler", email="ctadler@ucsc.edu"},
|
|
11
|
+
{name="Artie Nazarov", email="anazarov@ucsc.edu"},
|
|
12
|
+
{name="Natalia Ocampo-Peñuela", email="nocampop@ucsc.edu"},
|
|
13
|
+
{name="Jasmine Tai", email="cjtai@ucsc.edu"},
|
|
14
|
+
{name="Natalie Valett", email="nvalett@ucsc.edu"}
|
|
15
|
+
]
|
|
16
|
+
description = "A collection of EcoScape utilities."
|
|
17
|
+
readme = "README.md"
|
|
18
|
+
requires-python = ">=3.7"
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"License :: OSI Approved :: BSD License",
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
]
|
|
24
|
+
dynamic = ["dependencies"]
|
|
25
|
+
|
|
26
|
+
[tool.setuptools.dynamic]
|
|
27
|
+
dependencies = {file = ["requirements.txt"]}
|
|
28
|
+
|
|
29
|
+
[tool.setuptools]
|
|
30
|
+
packages = ["ecoscape_utilities"]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
"Homepage" = "https://github.com/ecoscape-earth/ecoscape-utilities"
|
|
35
|
+
"Bug Tracker" = "https://github.com/ecoscape-earth/ecoscape-utilities/issues"
|
|
File without changes
|