Skip to content

Commit

Permalink
manage chunks in odc
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasK committed Oct 31, 2023
1 parent ab6294c commit e98c410
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.0.1-rc5] 2023-10-31

## [0.0.1-rc5] 2023-11-02

### Added

Expand Down
2 changes: 1 addition & 1 deletion earthdaily/earthdatastore/cube_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _cube_odc(items_collection, assets=None, times=None, **kwargs):
if "resampling" in kwargs:
if isinstance(kwargs["resampling"], int):
kwargs["resampling"] = Resampling(kwargs["resampling"]).name
chunks = kwargs.get("chunks", dict(x="auto", y="auto", time="auto"))
chunks = kwargs.get("chunks", dict(x="256", y="256", time="auto"))
kwargs.pop("chunks", None)

ds = stac.load(
Expand Down
2 changes: 1 addition & 1 deletion examples/field_evolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
assets=["red", "green", "blue"],
mask_with="native", # same as scl
# mask_statistics=True, # as you ask `clear_cover`it will force computing mask_statistics
clear_cover=50,
clear_cover=50
)

pivot_cube.clear_percent.plot.scatter(x="time")
Expand Down
23 changes: 17 additions & 6 deletions tests/test_simple_datacube.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,26 @@ def test_venus(self):
"eo:cloud_cover": {"lt": max_cloud_cover},
}

items = self.eds.search(collection, query=query, max_items=2)
items = self.eds.search(collection, query=query, max_items=1)
crs = items[0].properties['proj:epsg']
gsd = items[0].properties['gsd']


datacube = self.eds.datacube(collection, search_kwargs=dict(query=query, max_items=2),resolution=5, crs=3857, rescale=True)
self.assertEqual(datacube.rio.width,12054)
self.assertEqual(datacube.rio.height,13178)
self.assertEqual(datacube.time.size,2)
datacube = self.eds.datacube(collection, assets=['image_file_SRE_B3'], search_kwargs=dict(query=query, max_items=1),resolution=gsd,crs=crs)

self.assertEqual(datacube.rio.width,9374)
self.assertEqual(datacube.rio.height,10161)
self.assertEqual(datacube.time.size,1)
blue = datacube['image_file_SRE_B3'].isel(x=5000,y=5000,time=0).data.compute()
self.assertEqual(blue,0.134)
self.assertEqual(blue,0.028999999999999998)


def test_sentinel1(self):
# TODO : implement s1
collection = "sentinel-1-rtc"

# datacube = self.eds.datacube(collection, bbox=bbox)


if __name__ == "__main__":
unittest.main()

0 comments on commit e98c410

Please sign in to comment.