Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions xee/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@
'EarthEngineStore',
'EarthEngineBackendArray',
]

18 changes: 13 additions & 5 deletions xee/micro_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,31 @@


def init_ee_for_tests():

ee.Initialize(opt_url='https://earthengine-highvolume.googleapis.com')


_GRID_PARAMS = {
'crs': 'EPSG:4326',
'crs_transform': (0.25, 0, -180.0, 0, -0.25, 90.0),
'shape_2d': (1440, 720),
}


def open_dataset() -> None:
_ = xarray.open_dataset(
'NASA/GPM_L3/IMERG_V06', engine=xee.EarthEngineBackendEntrypoint
'NASA/GPM_L3/IMERG_V06',
engine=xee.EarthEngineBackendEntrypoint,
**_GRID_PARAMS,
)


def open_and_chunk() -> None:
ds = xarray.open_dataset(
'NASA/GPM_L3/IMERG_V06',
crs='EPSG:4326',
scale=0.25,
chunks={'index': 24, 'width': 512, 'height': 512},
engine=xee.EarthEngineBackendEntrypoint,
**_GRID_PARAMS,
)
ds.chunk()

Expand All @@ -61,10 +70,9 @@ def open_and_write() -> None:
with tempfile.TemporaryDirectory() as tmpdir:
ds = xarray.open_dataset(
'NASA/GPM_L3/IMERG_V06',
crs='EPSG:4326',
scale=0.25,
chunks={'time': 24, 'lon': 1440, 'lat': 720},
engine=xee.EarthEngineBackendEntrypoint,
**_GRID_PARAMS,
)
ds = ds.isel(time=slice(0, 24))
ds.to_zarr(os.path.join(tmpdir, 'imerg.zarr'))
Expand Down