Skip to content

Commit

Permalink
fix: set chunk dict. closes #940 (#941)
Browse files Browse the repository at this point in the history
  • Loading branch information
dfguerrerom authored Sep 12, 2024
1 parent 342f002 commit 338d0cf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ def lint(session):
session.run("pre-commit", "run", "--all-files", *session.posargs)


@nox.session(reuse_venv=True)
@nox.session(reuse_venv=False)
def test(session):
"""Run all the test using the environment variable of the running machine."""
session.install(".[test]")
session.run("pip", "list")

# if we are in the sepal-venv, force earthengine api fork
if "sepal-user" in session.virtualenv.location:
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ dependencies = [
# read local data
"rioxarray",
"dask", # used by rioxarray in the inspector
"geopandas",
'geopandas==0.13.2; python_version == "3.8"',
'geopandas>=0.14.0; python_version > "3.8"',
"matplotlib",
"jupyter-server-proxy", # required for localtileserver
"planet",
Expand Down
2 changes: 1 addition & 1 deletion sepal_ui/mapping/inspector_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def _from_raster(self, raster: Union[str, Path], coords: Sequence[float]) -> dic

# open the image and unproject it
da = rioxarray.open_rasterio(raster, masked=True)
da = da.chunk((1000, 1000))
da = da.chunk({"x": 1000, "y": 1000})
if da.rio.crs != CRS.from_string("EPSG:4326"):
da = da.rio.reproject("EPSG:4326")

Expand Down
4 changes: 3 additions & 1 deletion sepal_ui/mapping/sepal_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,9 @@ def add_raster(
color_list = [mpc.rgb2hex(cmap(i)) for i in range(cmap.N)]

da = rioxarray.open_rasterio(image, masked=True)
da = da.chunk((1000, 1000))
# print
print(da)
da = da.chunk({"x": 1000, "y": 1000})

multi_band = False
if len(da.band) > 1 and not isinstance(bands, int):
Expand Down

0 comments on commit 338d0cf

Please sign in to comment.