diff --git a/.cruft.json b/.cruft.json index bab7b17b..f5959b11 100644 --- a/.cruft.json +++ b/.cruft.json @@ -11,7 +11,7 @@ "project_slug": "xhydro", "project_short_description": "Hydrological analysis library built with xarray.", "pypi_username": "TC-FF", - "version": "0.4.0", + "version": "0.4.1-dev.0", "use_pytest": "y", "use_black": "y", "use_conda": "y", diff --git a/docs/notebooks/gis.ipynb b/docs/notebooks/gis.ipynb index fd30df75..86b0bf5e 100644 --- a/docs/notebooks/gis.ipynb +++ b/docs/notebooks/gis.ipynb @@ -849,6 +849,13 @@ ")" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We can also extract the surface properties for the same `gpd.GeoDataFrame` : " + ] + }, { "cell_type": "code", "execution_count": 10, @@ -972,6 +979,13 @@ "xhgis.surface_properties(gdf)" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Again, for convenience, we can output the results in `xarray.Dataset` format : " + ] + }, { "cell_type": "code", "execution_count": 11, diff --git a/docs/notebooks/hydrological_modelling.ipynb b/docs/notebooks/hydrological_modelling.ipynb index f4391773..4a039bde 100644 --- a/docs/notebooks/hydrological_modelling.ipynb +++ b/docs/notebooks/hydrological_modelling.ipynb @@ -31,6 +31,8 @@ "metadata": {}, "outputs": [], "source": [ + "import planetary_computer\n", + "\n", "import xhydro as xh\n", "import xhydro.modelling as xhm\n", "\n", @@ -52,7 +54,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "3", "metadata": { "editable": true, @@ -135,7 +137,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "id": "7", "metadata": {}, "outputs": [], diff --git a/pyproject.toml b/pyproject.toml index c7145947..8f7512ba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -123,7 +123,7 @@ target-version = [ ] [tool.bumpversion] -current_version = "0.4.0" +current_version = "0.4.1-dev.0" commit = true commit_args = "--no-verify" tag = false diff --git a/src/xhydro/__init__.py b/src/xhydro/__init__.py index e93ae0db..6afa8c9f 100644 --- a/src/xhydro/__init__.py +++ b/src/xhydro/__init__.py @@ -25,4 +25,4 @@ __author__ = """Thomas-Charles Fortier Filion""" __email__ = "tcff_hydro@outlook.com" -__version__ = "0.4.0" +__version__ = "0.4.1-dev.0" diff --git a/src/xhydro/gis.py b/src/xhydro/gis.py index e8b2c857..dc0901e7 100644 --- a/src/xhydro/gis.py +++ b/src/xhydro/gis.py @@ -15,6 +15,7 @@ import matplotlib.pyplot as plt import numpy as np import pandas as pd +import planetary_computer import pystac_client import rasterio import rasterio.features @@ -270,11 +271,9 @@ def _recursive_upstream_lookup( def _flatten(x, dim="time"): - # FIXME: assert statements should only be found in test code - assert isinstance(x, xr.DataArray) # noqa: S101 - if len(x[dim].values) > len(set(x[dim].values)): - x = x.groupby(dim).map(stackstac.mosaic) - + if isinstance(x, xr.DataArray): + if len(x[dim].values) > len(set(x[dim].values)): + x = x.groupby(dim).map(stackstac.mosaic) return x @@ -324,6 +323,7 @@ def surface_properties( catalog = pystac_client.Client.open( "https://planetarycomputer.microsoft.com/api/stac/v1", + modifier=planetary_computer.sign_inplace, ) search = catalog.search( @@ -489,6 +489,7 @@ def land_use_classification( """ catalog = pystac_client.Client.open( "https://planetarycomputer.microsoft.com/api/stac/v1", + modifier=planetary_computer.sign_inplace, ) collection = catalog.get_collection(collection) ia = ItemAssetsExtension.ext(collection) @@ -552,6 +553,7 @@ def land_use_plot( """ catalog = pystac_client.Client.open( "https://planetarycomputer.microsoft.com/api/stac/v1", + modifier=planetary_computer.sign_inplace, ) collection = catalog.get_collection(collection) diff --git a/tests/test_xhydro.py b/tests/test_xhydro.py index 0900bfaa..26dff640 100644 --- a/tests/test_xhydro.py +++ b/tests/test_xhydro.py @@ -35,4 +35,4 @@ def test_package_metadata(): contents = f.read() assert """Thomas-Charles Fortier Filion""" in contents assert '__email__ = "tcff_hydro@outlook.com"' in contents - assert '__version__ = "0.4.0"' in contents + assert '__version__ = "0.4.1-dev.0"' in contents