openeo-gfmap 0.4.3__py3-none-any.whl → 0.4.4__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.
@@ -57,7 +57,7 @@ def resample_reproject(
57
57
  CRS.from_epsg(int(epsg_code))
58
58
  except (CRSError, ValueError) as exc:
59
59
  raise ValueError(
60
- f"Specified target_crs: {epsg_code} is not a valid " "EPSG code."
60
+ f"Specified target_crs: {epsg_code} is not a valid EPSG code."
61
61
  ) from exc
62
62
  return datacube.resample_spatial(
63
63
  resolution=resolution, projection=epsg_code, method=method
@@ -132,49 +132,20 @@ def _load_collection(
132
132
  temporal_extent = [temporal_extent.start_date, temporal_extent.end_date]
133
133
 
134
134
  if fetch_type == FetchType.TILE:
135
- assert isinstance(
136
- spatial_extent, BoundingBoxExtent
137
- ), "Please provide only a bounding box for tile based fetching."
138
- spatial_extent = dict(spatial_extent)
139
- cube = load_collection_method(
140
- connection=connection,
141
- bands=bands,
142
- spatial_extent=spatial_extent,
143
- temporal_extent=temporal_extent,
144
- properties=load_collection_parameters,
145
- )
146
- elif fetch_type == FetchType.POINT:
147
- if isinstance(spatial_extent, GeoJSON):
148
- assert (
149
- spatial_extent["type"] == "FeatureCollection"
150
- ), "Please provide a FeatureCollection type of GeoJSON"
151
- elif isinstance(spatial_extent, str):
152
- assert spatial_extent.startswith("https://") or spatial_extent.startswith(
153
- "http://"
154
- ), "Please provide a valid URL or a path to a GeoJSON file."
155
- else:
135
+ if isinstance(spatial_extent, BoundingBoxExtent):
136
+ spatial_extent = dict(spatial_extent)
137
+ elif spatial_extent is not None:
156
138
  raise ValueError(
157
- "Please provide a valid URL to a GeoParquet or GeoJSON file."
139
+ "`spatial_extent` should be either None or an instance of BoundingBoxExtent for tile-based fetching."
158
140
  )
159
141
  cube = load_collection_method(
160
142
  connection=connection,
161
143
  bands=bands,
144
+ spatial_extent=spatial_extent,
162
145
  temporal_extent=temporal_extent,
163
146
  properties=load_collection_parameters,
164
147
  )
165
- elif fetch_type == FetchType.POLYGON:
166
- if isinstance(spatial_extent, GeoJSON):
167
- assert (
168
- spatial_extent["type"] == "FeatureCollection"
169
- ), "Please provide a FeatureCollection type of GeoJSON"
170
- elif isinstance(spatial_extent, str):
171
- assert spatial_extent.startswith("https://") or spatial_extent.startswith(
172
- "http://"
173
- ), "Please provide a valid URL or a path to a GeoJSON file."
174
- else:
175
- raise ValueError(
176
- "Please provide a valid URL to a GeoParquet or GeoJSON file."
177
- )
148
+ elif fetch_type == FetchType.POINT or fetch_type == FetchType.POLYGON:
178
149
  cube = load_collection_method(
179
150
  connection=connection,
180
151
  bands=bands,
@@ -190,7 +161,7 @@ def _load_collection(
190
161
  pre_mask = params.get("pre_mask", None)
191
162
  if pre_mask is not None:
192
163
  assert isinstance(pre_mask, openeo.DataCube), (
193
- f"The 'pre_mask' parameter must be an openeo datacube, " f"got {pre_mask}."
164
+ f"The 'pre_mask' parameter must be an openeo datacube, got {pre_mask}."
194
165
  )
195
166
  cube = cube.mask(pre_mask)
196
167
 
@@ -205,7 +176,7 @@ def _load_collection(
205
176
  pre_merge_cube = pre_merge_cube.mask(pre_mask)
206
177
  cube = cube.merge_cubes(pre_merge_cube)
207
178
 
208
- if fetch_type == FetchType.POLYGON:
179
+ if fetch_type == FetchType.POLYGON and spatial_extent is not None:
209
180
  if isinstance(spatial_extent, str):
210
181
  geometry = connection.load_url(
211
182
  spatial_extent,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openeo_gfmap
3
- Version: 0.4.3
3
+ Version: 0.4.4
4
4
  Summary: OpenEO General Framework for Mapping
5
5
  Project-URL: Homepage, https://github.com/Open-EO/openeo-gfmap
6
6
  Project-URL: Bug Tracker, https://github.com/Open-EO/openeo-gfmap/issues
@@ -6,7 +6,7 @@ openeo_gfmap/temporal.py,sha256=qhKCgSoOc0CrscPTru-d7acaxsCVhftyYrb_8UVU1S4,583
6
6
  openeo_gfmap/features/__init__.py,sha256=UtQUPnglF9uURn9FqtegnazuE4_CgQP6a2Cdx1TOuZ0,419
7
7
  openeo_gfmap/features/feature_extractor.py,sha256=ApTCCbD1-S4VOOSEZh9i-Gqxso87xwe_z7CN35fP15A,14719
8
8
  openeo_gfmap/fetching/__init__.py,sha256=KFDwqKTwXUDhFqPqeaIg5uCL2xp7lXmNzcbAph-EU1c,938
9
- openeo_gfmap/fetching/commons.py,sha256=uug-BfbySbCPfQAoeBOLjDFt6nOiV41Tmat8VDvGuBo,7871
9
+ openeo_gfmap/fetching/commons.py,sha256=S6w9I5zdksPJPFfadDgAblrX3s2D47V9saymhzGLmig,6668
10
10
  openeo_gfmap/fetching/fetching.py,sha256=dHeOMzN6OPgD8YFfZtcCzEOwQqo47IeBgIdS2mrx3MY,3674
11
11
  openeo_gfmap/fetching/generic.py,sha256=ojSO52cnLsWpC6FAnLRoXxfQmTiC839DzFH8MAok2B8,5851
12
12
  openeo_gfmap/fetching/s1.py,sha256=Ek9Ek-GExyKdb-9Ijja6I-izOmVvPY2C9w9gyyGGjII,6360
@@ -34,7 +34,7 @@ openeo_gfmap/utils/intervals.py,sha256=V6l3ofww50fN_pvWC4NuGQ2ZsyGdhAlTZTiRcC0fo
34
34
  openeo_gfmap/utils/netcdf.py,sha256=KkAAxnq-ZCMjDMd82638noYwxqNpMsnpiU04Q-qX26A,698
35
35
  openeo_gfmap/utils/split_stac.py,sha256=asjT0jx6ic8GJFqqAisaWxOvQ_suSRv4sxyFOyHFvpI,3895
36
36
  openeo_gfmap/utils/tile_processing.py,sha256=QZ9bi5tPmyTVyyNvFZgd26s5dSnMl1grTKq2veK1C90,2068
37
- openeo_gfmap-0.4.3.dist-info/METADATA,sha256=Lj7HiV-92WCJQTqlyZWZKyc8SNGvbFyzTDMyiWCK8FY,4374
38
- openeo_gfmap-0.4.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
39
- openeo_gfmap-0.4.3.dist-info/licenses/LICENSE,sha256=aUuGpjieWiscTNtyLcSaeVsJ4pb6J9c4wUq1bR0e4t4,11349
40
- openeo_gfmap-0.4.3.dist-info/RECORD,,
37
+ openeo_gfmap-0.4.4.dist-info/METADATA,sha256=pdw_BlCH9bg9dOg40eabef7l_jjjSpQv7YUr2QqoqLk,4374
38
+ openeo_gfmap-0.4.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
39
+ openeo_gfmap-0.4.4.dist-info/licenses/LICENSE,sha256=aUuGpjieWiscTNtyLcSaeVsJ4pb6J9c4wUq1bR0e4t4,11349
40
+ openeo_gfmap-0.4.4.dist-info/RECORD,,