From 9b7f394d45fe95d2d173c883860c6fed7079a0c7 Mon Sep 17 00:00:00 2001 From: roeldegoede <83765910+roeldegoede@users.noreply.github.com> Date: Mon, 18 Mar 2024 15:49:11 +0100 Subject: [PATCH] =?UTF-8?q?fix=20mesh=5F2d=5Ffrom=5Frasterdataset=20for=20?= =?UTF-8?q?rasterdatasets=20with=20multidimension=E2=80=A6=20(#843)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/changelog.rst | 1 + hydromt/workflows/mesh.py | 3 ++- pixi.toml | 2 +- pyproject.toml | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index db57a3c72..65a332863 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -16,6 +16,7 @@ Changed Fixed ----- - Bug in `raster.transform` with lazy coordinates. (#801) +- Bug in `workflows.mesh.mesh2d_from_rasterdataset` with multi-dimensional coordinates. (#843) v0.9.4 (2024-02-26) diff --git a/hydromt/workflows/mesh.py b/hydromt/workflows/mesh.py index dd67c559f..0b52ee210 100644 --- a/hydromt/workflows/mesh.py +++ b/hydromt/workflows/mesh.py @@ -1,4 +1,5 @@ """Implementation for mesh based workflows.""" + import logging from typing import Dict, List, Optional, Union @@ -261,7 +262,7 @@ def mesh2d_from_rasterdataset( # Get one variable name in ds to simplify to da var = [v for v in ds.data_vars][0] uda = xu.UgridDataArray.from_structured( - ds[var].rename({ds.raster.x_dim: "x", ds.raster.y_dim: "y"}) + ds[var], x=ds.raster.xcoords.name, y=ds.raster.ycoords.name ) uda.ugrid.set_crs(ds.raster.crs) diff --git a/pixi.toml b/pixi.toml index 572b1eb40..1b8292e62 100644 --- a/pixi.toml +++ b/pixi.toml @@ -185,7 +185,7 @@ s3fs = "*" [feature.extra.dependencies] matplotlib = "*" pyet = "*" -xugrid = ">=0.6.5" +xugrid = ">=0.9.0" [feature.dev.dependencies] black = "*" diff --git a/pyproject.toml b/pyproject.toml index b254d315d..ed03f8a87 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,7 @@ io = [ extra = [ "matplotlib", # plotting; required for slippy tiles "pyet", # calc evapotraspiration, quite well used, used in all wflow models but domain specific - "xugrid>=0.6.5", # xarray wrapper for mesh processing + "xugrid>=0.9.0", # xarray wrapper for mesh processing ] dev = [ "black", # linting