Skip to content

Commit

Permalink
Release/v0.6.0 (#279)
Browse files Browse the repository at this point in the history
* Release 0.6.0 prep

* Remove capital

* Add the days to the releases

* Title underline

* Fix broken PR link
  • Loading branch information
dalmijn authored Jun 7, 2024
1 parent 3a2f3f1 commit 312e2b6
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 120 deletions.
2 changes: 0 additions & 2 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ Attributes
WflowModel.config
WflowModel.grid
WflowModel.geoms
WflowModel.staticmaps
WflowModel.staticgeoms
WflowModel.forcing
WflowModel.states
WflowModel.results
Expand Down
30 changes: 18 additions & 12 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ All notable changes to this project will be documented in this page.
The format is based on `Keep a Changelog`_, and this project adheres to
`Semantic Versioning`_.

Unreleased
==========
v0.6.0 (7 June 2024)
====================

Added
-----
- If applicable, basins geometry based on the higher resolution DEM is stored seperately under **basins_highres** `PR #266 <https://github.com/Deltares/hydromt_wflow/pull/266>`
- If applicable, basins geometry based on the higher resolution DEM is stored seperately under **basins_highres** `PR #266 <https://github.com/Deltares/hydromt_wflow/pull/266>`_
- New function **setup_1dmodel_connection** to connect wflow to 1D river model (eg Delft3D FM 1D, HEC-RAS, etc.) `PR #210 <https://github.com/Deltares/hydromt_wflow/pull/210>`_
- New setup method for the **KsatHorFrac** parameter **setup_ksathorfarc** to up-downscale existing ksathorfrac maps. `PR #255 <https://github.com/Deltares/hydromt_wflow/pull/255>`_
- new function **setup_pet_forcing** to reproject existing pet data rather than computing from other meteo data. PR #257
Expand All @@ -22,7 +22,7 @@ Added
- new utils method **get_grid_from_config** to get the right wflow staticmaps variable based on the TOML configuration (e.g. detects name in netcdf, value, scale and offset). Only applied now to prepare cold states (e.g. not yet in read_grid). PR #252
- Added support for the "GLCNMO" land-use dataset, with a default parameter mapping table (similar to the existing tables). PR #272
- Added the `alpha_h1` parameter (based on land use maps). This parameter represents whether root water uptake reduction at soil water pressure head h1 occurs or not. By default, it is set to 0.0 for all "non-natural" vegetation (crops) and to 1.0 for all "natural vegetation" PR #272
- Parameter for output filename in **write_grid** (`output_fn`). PR #278
- Parameter for output filename in **write_grid** (`fn_out`). PR #278
- New function **setup_laimaps_from_lulc_mapping** to set leaf area index (LAI) climatology maps per month based on landuse mapping. PR #273

Changed
Expand All @@ -40,8 +40,14 @@ Fixed
- Removed building a wflow model without a config file in the build notebook.
- Deprecated np.bool and earlier error message for subbasin delination. PR #263

v0.5.0 (February 2024)
======================
Deprecated
----------
- **clip_staticmaps** in favour of **clip_grid**
- **read_staticmaps** and **write_staticmaps**, superseded by **read_grid** and **write_grid**
- **read_staticgeoms** and **write_staticgeoms**, superseded by **read_geoms** and **write_geoms**

v0.5.0 (13 February 2024)
=========================
Better handling of nodata and a switch from ini to yaml for configuration.

Added
Expand Down Expand Up @@ -70,16 +76,16 @@ Documentation
-------------
- Extra information for most of the setup methods of **WflowModel** and **WflowSedimentModel**

v0.4.1 (November 2023)
======================
v0.4.1 (22 November 2023)
=========================
Small update

Fixed
-----
- Make HydroMT-Wflow **v0.4.0** conda installable

v0.4.0 (November 2023)
======================
v0.4.0 (21 November 2023)
=========================
Small overhaul of internal methods and stability fixes. This version works with HydroMT **v0.9.1** onwards.

Changed
Expand All @@ -95,8 +101,8 @@ Fixed
-----
- Mainly stability fixes

v0.3.0 (July 2023)
==================
v0.3.0 (27 July 2023)
=====================
Various new features and bugfixes in support of Wflow.jl v0.7.1. This version works with HydroMT v0.8.0.

Added
Expand Down
13 changes: 1 addition & 12 deletions hydromt_wflow/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
"""hydroMT plugin for wflow models."""

from os.path import abspath, dirname, join

__version__ = "0.5.1.dev0"

try:
import pcraster as pcr

HAS_PCRASTER = True
except ImportError:
HAS_PCRASTER = False

DATADIR = join(dirname(abspath(__file__)), "data")
__version__ = "0.6.0"

from .utils import *
from .wflow import *
Expand Down
9 changes: 7 additions & 2 deletions hydromt_wflow/pcrm.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
from pyflwdir import core_conversion, core_d8, core_ldd
from pyproj import CRS

try:
import pcraster as pcr

HAS_PCRASTER = True
except ImportError:
HAS_PCRASTER = False

logger = logging.getLogger(__name__)

# specify pcraster map types
Expand Down Expand Up @@ -141,8 +148,6 @@ def write_map(
"""
import tempfile

import pcraster as pcr

with tempfile.TemporaryDirectory() as tmpdir:
# deal with pcr clone map
if clone_path is None:
Expand Down
4 changes: 3 additions & 1 deletion hydromt_wflow/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Some utilities from the Wflow plugin."""
from os.path import abspath, join
from os.path import abspath, dirname, join
from pathlib import Path
from typing import Dict, Optional, Union

Expand All @@ -9,6 +9,8 @@
from hydromt.vector import GeoDataArray
from hydromt.workflows.grid import grid_from_constant

DATADIR = join(dirname(abspath(__file__)), "data")

__all__ = ["read_csv_results", "get_config", "get_grid_from_config"]


Expand Down
92 changes: 4 additions & 88 deletions hydromt_wflow/wflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
from pyflwdir import core_conversion, core_d8, core_ldd
from shapely.geometry import box

from . import DATADIR, utils, workflows
from . import utils, workflows
from .utils import DATADIR

__all__ = ["WflowModel"]

Expand Down Expand Up @@ -110,9 +111,6 @@ def __init__(
self._tables = dict()
self._flwdir = None
self.data_catalog.from_yml(self._CATALOGS)
# To be deprecated from v0.6.0 onwards
self._staticmaps = None
self._staticgeoms = None

# COMPONENTS
def setup_basemaps(
Expand Down Expand Up @@ -3189,13 +3187,11 @@ def read_grid(self, **kwargs):
and ``dir_input``. If not found uses the default path ``staticmaps.nc`` in the
root folder.
If the file is not found, will try to read from the old PCRaster format if map
files are found in the ``staticmaps`` folder in the root folder using
read_staticmaps_pcr.
For reading old PCRaster maps, see the pcrm submodule.
See Also
--------
read_staticmaps_pcr
pcrm.read_staticmaps_pcr
"""
fn_default = "staticmaps.nc"
fn = self.get_config(
Expand Down Expand Up @@ -3225,16 +3221,6 @@ def read_grid(self, **kwargs):
if ds.raster.res[1] > 0:
ds = ds.raster.flipud()
self.set_grid(ds)
elif len(glob.glob(join(self.root, "staticmaps", "*.map"))) > 0:
self.read_staticmaps_pcr()

def read_staticmaps(self, **kwargs):
"""Read staticmaps. DEPRECATED for read_grid."""
self.logger.warning(
"read_staticmaps is deprecated. Use 'read_grid' instead. "
"Will be removed in hydromt_wflow v0.6.0"
)
self.read_grid(**kwargs)

def write_grid(
self,
Expand Down Expand Up @@ -3304,14 +3290,6 @@ def write_grid(
ds_out[v] = ds_out[v].where(mask, ds_out[v].raster.nodata)
ds_out.to_netcdf(fn, encoding=encoding)

def write_staticmaps(self):
"""Write staticmaps: DEPRECATED for write_grid."""
self.logger.warning(
"write_staticmaps is deprecated. Use 'write_grid' instead. "
"Will be removed in hydromt_wflow v0.6.0"
)
self.write_grid()

def read_geoms(
self,
geom_fn: str = "staticgeoms",
Expand All @@ -3337,17 +3315,6 @@ def read_geoms(
if name != "region":
self.set_geoms(gpd.read_file(fn), name=name)

def read_staticgeoms(
self,
geom_fn: str = "staticgeoms",
):
"""Read static geometries: DEPRECATED for read_geoms."""
self.logger.warning(
"read_staticgeoms is deprecated. Use 'read_geoms' instead. "
"Will be removed in hydromt_wflow v0.6.0"
)
self.read_geoms(geom_fn)

def write_geoms(
self,
geom_fn: str = "staticgeoms",
Expand Down Expand Up @@ -3377,17 +3344,6 @@ def write_geoms(
fn_out = join(self.root, geom_fn, f"{name}.geojson")
gdf.to_file(fn_out, driver="GeoJSON")

def write_staticgeoms(
self,
geom_fn: str = "staticgeoms",
):
"""Write static geometries: DEPRECATED for write_geoms."""
self.logger.warning(
"write_staticgeoms is deprecated. Use 'write_geoms' instead. "
"Will be removed in hydromt_wflow v0.6.0"
)
self.write_geoms(geom_fn)

def read_forcing(self):
"""
Read forcing.
Expand Down Expand Up @@ -3926,32 +3882,6 @@ def rivers(self):
gdf = None
return gdf

@property
def staticgeoms(self):
"""Return static geometries.
Note: deprecated and will be removed in hydromt_wflow v0.6.0. Use
:py:attr:`geoms` instead.
"""
self.logger.warning(
"staticgeoms is deprecated. Call 'geoms' instead. "
"Will be removed in hydromt_wflow v0.6.0"
)
return self.geoms

@property
def staticmaps(self):
"""Return staticmaps.
Note: deprecated and will be removed in hydromt_wflow v0.6.0. Use
:py:attr:`grid` instead.
"""
self.logger.warning(
"staticmaps is deprecated. Call 'grid' instead. "
"Will be removed in hydromt_wflow v0.6.0"
)
return self.grid

## WFLOW specific modification (clip for now) methods

def clip_grid(
Expand Down Expand Up @@ -4107,20 +4037,6 @@ def clip_grid(
if self.get_config("state.lateral.river.lake") is not None:
del self.config["state"]["lateral"]["river"]["lake"]

def clip_staticmaps(
self,
region,
buffer=0,
align=None,
crs=4326,
):
"""Clip staticmaps to subbasin."""
self.logger.warning(
"clip_staticmaps is deprecated. Use 'clip_grid' instead. "
"Will be removed in hydromt_wflow v0.6.0"
)
self.clip_grid(region, buffer, align, crs)

def clip_forcing(self, crs=4326, **kwargs):
"""Return clippped forcing for subbasin.
Expand Down
2 changes: 1 addition & 1 deletion hydromt_wflow/wflow_sediment.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from hydromt_wflow.wflow import WflowModel

from . import DATADIR
from .utils import DATADIR
from .workflows import landuse, soilgrids_sediment

__all__ = ["WflowSedimentModel"]
Expand Down
2 changes: 1 addition & 1 deletion hydromt_wflow/workflows/river.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from hydromt import flw, gis_utils, stats, workflows
from scipy.optimize import curve_fit

from hydromt_wflow import DATADIR # global var
from hydromt_wflow.utils import DATADIR # global var

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ authors = [
dependencies = [
"dask",
"geopandas>=0.10",
"hydromt>=0.9.3,<0.10",
"hydromt>=0.9.4,<0.11",
"netcdf4",
"numpy",
"pandas",
Expand Down

0 comments on commit 312e2b6

Please sign in to comment.