geebeam 0.2.1__tar.gz → 0.2.2__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.
- {geebeam-0.2.1 → geebeam-0.2.2}/PKG-INFO +1 -1
- {geebeam-0.2.1 → geebeam-0.2.2}/_version.py +2 -2
- {geebeam-0.2.1 → geebeam-0.2.2}/src/geebeam/pipeline.py +25 -9
- {geebeam-0.2.1 → geebeam-0.2.2}/.gitignore +0 -0
- {geebeam-0.2.1 → geebeam-0.2.2}/LICENSE +0 -0
- {geebeam-0.2.1 → geebeam-0.2.2}/README.md +0 -0
- {geebeam-0.2.1 → geebeam-0.2.2}/pyproject.toml +0 -0
- {geebeam-0.2.1 → geebeam-0.2.2}/src/geebeam/__init__.py +0 -0
- {geebeam-0.2.1 → geebeam-0.2.2}/src/geebeam/climate_indices.py +0 -0
- {geebeam-0.2.1 → geebeam-0.2.2}/src/geebeam/ee_utils.py +0 -0
- {geebeam-0.2.1 → geebeam-0.2.2}/src/geebeam/sampler.py +0 -0
- {geebeam-0.2.1 → geebeam-0.2.2}/src/geebeam/transforms.py +0 -0
- {geebeam-0.2.1 → geebeam-0.2.2}/tests/test_climate_indices.py +0 -0
- {geebeam-0.2.1 → geebeam-0.2.2}/tests/test_ee_utils.py +0 -0
- {geebeam-0.2.1 → geebeam-0.2.2}/tests/test_pipeline.py +0 -0
- {geebeam-0.2.1 → geebeam-0.2.2}/tests/test_sampler.py +0 -0
- {geebeam-0.2.1 → geebeam-0.2.2}/tests/test_transforms.py +0 -0
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '0.2.
|
|
22
|
-
__version_tuple__ = version_tuple = (0, 2,
|
|
21
|
+
__version__ = version = '0.2.2'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 2, 2)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""Prepare and run Beam pipeline to download image 'chips' from Earth Engine"""
|
|
2
2
|
|
|
3
|
+
import warnings
|
|
3
4
|
import ee
|
|
4
5
|
import geopandas as gpd
|
|
5
6
|
import pandas as pd
|
|
@@ -14,9 +15,9 @@ from google.protobuf.json_format import MessageToJson
|
|
|
14
15
|
from geebeam import ee_utils, sampler, transforms
|
|
15
16
|
|
|
16
17
|
|
|
17
|
-
def _check_if_localrunner(
|
|
18
|
+
def _check_if_localrunner(pipeline_options):
|
|
18
19
|
"""Fixes gRPC timeout issue for local runners."""
|
|
19
|
-
runner =
|
|
20
|
+
runner = pipeline_options.get_all_options()['runner']
|
|
20
21
|
if runner is None or runner in ['DirectRunner', 'PrismRunner']:
|
|
21
22
|
return True
|
|
22
23
|
else:
|
|
@@ -48,7 +49,7 @@ def run_pipeline(
|
|
|
48
49
|
random_seed: int = None,
|
|
49
50
|
split_processing: bool = False,
|
|
50
51
|
extra_metadata: dict = {},
|
|
51
|
-
|
|
52
|
+
beam_options: dict[str] | list[str] | None = None
|
|
52
53
|
) -> None:
|
|
53
54
|
"""Run a Beam pipeline to download image chips from Earth Engine.
|
|
54
55
|
|
|
@@ -85,10 +86,25 @@ def run_pipeline(
|
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
# Parses from command line and/or retrieves from dict. Note that dict takes precedent.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
if isinstance(beam_options, dict):
|
|
90
|
+
pipeline_options = PipelineOptions(
|
|
91
|
+
**beam_options,
|
|
92
|
+
project=config['project_id'],
|
|
93
|
+
save_main_session=True,
|
|
94
|
+
)
|
|
95
|
+
elif isinstance(beam_options, list):
|
|
96
|
+
warnings.warn('Creating PipelineOptions from beam_options list.'
|
|
97
|
+
' Ignores command-line beam options.')
|
|
98
|
+
pipeline_options = PipelineOptions(
|
|
99
|
+
beam_options,
|
|
100
|
+
project=config['project_id'],
|
|
101
|
+
save_main_session=True,
|
|
102
|
+
)
|
|
103
|
+
else:
|
|
104
|
+
pipeline_options = PipelineOptions(
|
|
105
|
+
project=config['project_id'],
|
|
106
|
+
save_main_session=True,
|
|
107
|
+
)
|
|
92
108
|
|
|
93
109
|
# Get sample points
|
|
94
110
|
if sampling_points is not None:
|
|
@@ -108,7 +124,7 @@ def run_pipeline(
|
|
|
108
124
|
# Set up pipeline
|
|
109
125
|
|
|
110
126
|
# Check if a local runner
|
|
111
|
-
is_local = _check_if_localrunner(
|
|
127
|
+
is_local = _check_if_localrunner(pipeline_options)
|
|
112
128
|
|
|
113
129
|
# Prepare and serialize inputs
|
|
114
130
|
# band_groups is a list of lists containing bands to export
|
|
@@ -118,7 +134,7 @@ def run_pipeline(
|
|
|
118
134
|
serialized_image = ee_utils.serialize(prepped_image)
|
|
119
135
|
|
|
120
136
|
# Execute pipeline
|
|
121
|
-
with beam.Pipeline(options=
|
|
137
|
+
with beam.Pipeline(options=pipeline_options) as pipeline:
|
|
122
138
|
|
|
123
139
|
points = pipeline | 'Create points' >> beam.Create(input_records)
|
|
124
140
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|