Skip to content

Commit

Permalink
Bugfix lai and other small IO errors (#297)
Browse files Browse the repository at this point in the history
* bugfix unit conversion error in setup_laimaps_from_lulc_mapping

* other io fixes

* update changelog
  • Loading branch information
hboisgon authored Sep 25, 2024
1 parent e638577 commit 8158e1b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ Changed

Fixed
-----
-
- Error in computation of LAI values from mapping to landuse in **setup_laimaps**. PR #297
- IO error for write_states in write. PR #297
- Creating the staticgeoms folder if it does not already exist (eg when dir_input is provided). PR #297

v0.6.1 (16 September 2024)
==========================
Expand Down
6 changes: 4 additions & 2 deletions hydromt_wflow/wflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class WflowModel(GridModel):
"glacstore": "wflow_glacierstore",
}
_FOLDERS = [
"staticgeoms",
"instate",
"run_default",
]
Expand Down Expand Up @@ -3225,7 +3224,7 @@ def write(
if self._tables:
self.write_tables()
if self._states:
self.write_states(states_fn=states_fn)
self.write_states(fn_out=states_fn)
# Write the config last as variables can get set in other write methods
self.write_config(config_name=config_fn)

Expand Down Expand Up @@ -3443,6 +3442,9 @@ def write_geoms(
)
else:
geoms_dir = join(self.root, geoms_fn)
# Create the geoms dir if it does not already exist
if not isdir(geoms_dir):
os.makedirs(geoms_dir)

for name, gdf in self.geoms.items():
# TODO change to geopandas functionality once geopandas 1.0.0 comes
Expand Down
2 changes: 1 addition & 1 deletion hydromt_wflow/workflows/landuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def create_lulc_lai_mapping_table(
df_lai.index.name = "landuse"
else:
# Compute the mean
lai_mean_per_lu = np.round(lu["lai"].load().mean(dim="z") / 10, 3)
lai_mean_per_lu = np.round(lu["lai"].load().mean(dim="z"), 3)
# Add the landuse id as an extra dimension
lai_mean_per_lu = lai_mean_per_lu.expand_dims("landuse")
lai_mean_per_lu["landuse"] = [lulc_id]
Expand Down

0 comments on commit 8158e1b

Please sign in to comment.