From 2f207b7cb9ff485da57089bc53ab1767ba9b8406 Mon Sep 17 00:00:00 2001 From: Benjamin Rodenberg Date: Mon, 8 Dec 2025 14:07:16 +0100 Subject: [PATCH 1/5] Comment out grid assignment from IN['h'] Comment out the line that assigns grid['z'] from IN['h'] --- src/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.py b/src/main.py index 08fa979e..5ad75b17 100644 --- a/src/main.py +++ b/src/main.py @@ -297,7 +297,7 @@ def main(): logger.debug("Received the following data from Elmer/Ice:", data_from_elmer) IN["h"] = data_from_elmer["h"] - grid["z"] = IN["h"][0].ravel() + # grid["z"] = IN["h"][0].ravel() # TODO add gradient field later # IN['dhdx'] = data_from_elmer('dhdx') # IN['dhdy'] = data_from_elmer('dhdy') From 45b43b7924fa0c19b057d321ed2a2cbee46ce437 Mon Sep 17 00:00:00 2001 From: Benjamin Rodenberg Date: Fri, 16 Jan 2026 17:34:27 +0100 Subject: [PATCH 2/5] Potential fix for tags not starting with v* messing up the pip installation. (#72) --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 47c0d2ca..7eb487cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,6 +36,7 @@ requires = ["setuptools", "setuptools_scm"] build-backend = "setuptools.build_meta" [tool.setuptools_scm] +git_describe_command = "git describe --tags --dirty --match v*" version_scheme = "post-release" local_scheme = "node-and-date" From 983171de2146a71acd71ea6fa2697a195bc81528 Mon Sep 17 00:00:00 2001 From: Benjamin Rodenberg Date: Thu, 15 Jan 2026 16:54:02 +0100 Subject: [PATCH 3/5] Apply suggestions from code review --- src/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.py b/src/main.py index 5ad75b17..067cf7ce 100644 --- a/src/main.py +++ b/src/main.py @@ -297,7 +297,8 @@ def main(): logger.debug("Received the following data from Elmer/Ice:", data_from_elmer) IN["h"] = data_from_elmer["h"] - # grid["z"] = IN["h"][0].ravel() + if coupler.couple_to_icon_atmo: + grid["z"] = IN["h"][0].ravel() # TODO add gradient field later # IN['dhdx'] = data_from_elmer('dhdx') # IN['dhdy'] = data_from_elmer('dhdy') From 4fbddd4bc9bd15fe4b930bb93317aa34845f9aff Mon Sep 17 00:00:00 2001 From: Benjamin Rodenberg Date: Mon, 19 Jan 2026 14:52:49 +0100 Subject: [PATCH 4/5] Fix Python < 3.10 compatibility. --- src/coupling/couplers/yacCoupler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/coupling/couplers/yacCoupler.py b/src/coupling/couplers/yacCoupler.py index 6d64d394..8b911211 100644 --- a/src/coupling/couplers/yacCoupler.py +++ b/src/coupling/couplers/yacCoupler.py @@ -13,6 +13,8 @@ from coupling.fields import FieldSet from coupling.fields import YACField as Field +from typing import Union + # from ebfm.geometry import Grid # TODO: consider introducing a new data structure native to EBFM? logger = logging.getLogger(__name__) @@ -39,7 +41,7 @@ def __init__(self, coupling_config: CouplingConfig): self.grid: yac.UnstructuredGrid = None self.corner_points: yac.Points = None - def setup(self, grid: Dict | Grid, time: Dict[str, float]): + def setup(self, grid: Union[Dict, Grid], time: Dict[str, float]): """ Setup the coupling interface From df98c38c7086d9d3a6d178791280d3c7f7c1c4ef Mon Sep 17 00:00:00 2001 From: Benjamin Rodenberg Date: Mon, 19 Jan 2026 15:20:27 +0100 Subject: [PATCH 5/5] Potential fix for regression w.r.t baseline. --- src/ebfm/INIT.py | 6 +++++- src/reader.py | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ebfm/INIT.py b/src/ebfm/INIT.py index 90b3cb84..d21ad561 100644 --- a/src/ebfm/INIT.py +++ b/src/ebfm/INIT.py @@ -199,7 +199,11 @@ def init_grid(grid, io, config: GridConfig): else: grid["mask"] = np.ones_like(grid["x"]) # treats every grid cell as glacier - grid["gpsum"] = compute_number_of_glacier_cells(grid) + if config.grid_type is GridInputType.ELMERXIOS: + grid["gpsum"] = grid["z"].shape[0] + else: + grid["gpsum"] = compute_number_of_glacier_cells(grid) + grid["slope_x"] = np.zeros_like(grid["x"]) # test values! grid["slope_y"] = np.zeros_like(grid["x"]) # test values! grid["slope_beta"] = np.zeros_like(grid["x"]) # test values! diff --git a/src/reader.py b/src/reader.py index bdae6c42..7f32277f 100644 --- a/src/reader.py +++ b/src/reader.py @@ -106,8 +106,9 @@ def read_dem_xios(dem_file: Path, grid: dict): np.squeeze(nc["x"][:]).shape == grid["x"].shape ), "Surface mesh and Elmer mesh do not have the same number of vertices" grid["z"] = np.squeeze(nc["zs"][:]).data - grid["lat"] = np.squeeze(nc["mesh2D_node_x"][:]).data - grid["lon"] = np.squeeze(nc["mesh2D_node_y"][:]).data + grid["h"] = np.squeeze(nc["h"][:]).data + grid["lat"] = nc["mesh2D_node_x"][:] + grid["lon"] = nc["mesh2D_node_y"][:] return grid