Skip to content

Commit

Permalink
all notebooks checked
Browse files Browse the repository at this point in the history
  • Loading branch information
konstntokas committed Jan 10, 2025
1 parent 28f8276 commit 9160bb6
Show file tree
Hide file tree
Showing 10 changed files with 1,273 additions and 1,746 deletions.
1,522 changes: 1,073 additions & 449 deletions examples/notebooks/cdse_senitnel_2.ipynb

Large diffs are not rendered by default.

1,040 changes: 0 additions & 1,040 deletions examples/notebooks/earth_search_sentinel2_l2a_stack_mode.ipynb

This file was deleted.

84 changes: 42 additions & 42 deletions examples/notebooks/geotiff_nonsearchable_catalog.ipynb

Large diffs are not rendered by default.

106 changes: 53 additions & 53 deletions examples/notebooks/geotiff_searchable_catalog.ipynb

Large diffs are not rendered by default.

56 changes: 28 additions & 28 deletions examples/notebooks/netcdf_searchable_catalog.ipynb

Large diffs are not rendered by default.

50 changes: 0 additions & 50 deletions examples/notebooks/speedup_stacking.py

This file was deleted.

142 changes: 71 additions & 71 deletions examples/notebooks/xcube_server_stac_s3.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions test/test_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,8 +690,8 @@ def test_open_data_stack_mode_no_items_found(self):
self.assertEqual(1, len(cm.output))
msg = (
"WARNING:xcube.stac:No items found in collection 'sentinel-2-l2a' "
"for the parameters bbox (29.386823964661588, 53.16221925990893, "
"29.38937206246819, 53.16375064927322), time_range ['2023-11-01', "
"for the parameters bbox (29.386939787289162, 53.1622888685164, "
"29.389256239840616, 53.16368104066575), time_range ['2023-11-01', "
"'2023-11-10'] and query {'constellation': {'eq': 'sentinel-3'}}."
)
self.assertEqual(msg, str(cm.output[-1]))
Expand Down
9 changes: 2 additions & 7 deletions test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def test_reproject_bbox(self):
bbox_wgs84 = [2, 50, 3, 51]
crs_wgs84 = "EPSG:4326"
crs_3035 = "EPSG:3035"
bbox_3035 = [3744586.1438261, 3005532.9146112, 3834561.9451489, 3135332.471277]
bbox_3035 = [3748675.9529771, 3011432.8944597, 3830472.1359979, 3129432.4914285]
self.assertEqual(bbox_wgs84, reproject_bbox(bbox_wgs84, crs_wgs84, crs_wgs84))
self.assertEqual(bbox_3035, reproject_bbox(bbox_3035, crs_3035, crs_3035))
np.testing.assert_almost_equal(
Expand Down Expand Up @@ -313,12 +313,7 @@ def test_reproject_bbox(self):
]
np.testing.assert_almost_equal(
reproject_bbox(bbox_utm, crs_utm, crs_wgs84),
[
178.71151799665725,
49.8432508769065,
-178.80285969813704,
52.15606403940051,
],
[178.8245008, 49.9483787, -178.9158425, 52.0509362],
)

def test_normalize_crs(self):
Expand Down
6 changes: 2 additions & 4 deletions xcube_stac/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def reproject_bbox(
source_bbox: list[FloatInt, FloatInt, FloatInt, FloatInt],
source_crs: Union[pyproj.CRS, str],
target_crs: Union[pyproj.CRS, str],
buffer: float = 0.05,
buffer: float = 0.0,
):
source_crs = normalize_crs(source_crs)
target_crs = normalize_crs(target_crs)
Expand Down Expand Up @@ -583,9 +583,7 @@ def wrapper_clip_dataset_by_geometry(ds: xr.Dataset, **open_params) -> xr.Datase
crs_asset = ds.spatial_ref.attrs["crs_wkt"]
if crs_asset and "bbox" in open_params and "crs" in open_params:
bbox = reproject_bbox(
open_params["bbox"],
open_params["crs"],
crs_asset,
open_params["bbox"], open_params["crs"], crs_asset, buffer=0.05
)
ds = clip_dataset_by_geometry(ds, geometry=bbox)
return ds
Expand Down

0 comments on commit 9160bb6

Please sign in to comment.