Skip to content

Commit

Permalink
fix some imports
Browse files Browse the repository at this point in the history
  • Loading branch information
savente93 committed Mar 10, 2025
1 parent 4247fd7 commit 46de589
Show file tree
Hide file tree
Showing 8 changed files with 1,883 additions and 3,122 deletions.
2 changes: 1 addition & 1 deletion hydromt_wflow/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""hydroMT plugin for wflow models."""

__version__ = "0.7.2.dev0"
__version__ = "1.0.0.dev0"

from .naming import *
from .utils import *
Expand Down
18 changes: 9 additions & 9 deletions hydromt_wflow/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

import numpy as np
import xarray as xr
from hydromt.io import open_timeseries_from_table
from hydromt.vector import GeoDataArray
from hydromt.workflows.grid import grid_from_constant
from hydromt._io import _open_timeseries_from_table
from hydromt.gis.vector import GeoDataArray
from hydromt.model.processes.grid import grid_from_constant

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

Expand Down Expand Up @@ -60,7 +60,7 @@ def read_csv_results(fn: Union[str, Path], config: Dict, maps: xr.Dataset) -> Di
usecols = np.append(usecols, np.arange(count, count + len(gdf.index)))
count += len(gdf.index)
da_ts = open_timeseries_from_table(
fn, name=f'{header}_{col["map"]}', usecols=usecols
fn, name=f"{header}_{col['map']}", usecols=usecols
)
da = GeoDataArray.from_gdf(gdf, da_ts, index_dim="index")
# Column based on xy coordinates or reducer for the full model domain domain
Expand Down Expand Up @@ -105,7 +105,7 @@ def read_csv_results(fn: Union[str, Path], config: Dict, maps: xr.Dataset) -> Di
# Dimensions are ascending and ordered as (x,y,layer,time)
# Indices are created before ordering for compatibility with
# raster.idx_to_xy
full_index = maps[f'{config["input"].get("subcatchment")}'].copy()
full_index = maps[f"{config['input'].get('subcatchment')}"].copy()
res_x, res_y = full_index.raster.res
if res_y < 0:
full_index = full_index.reindex(
Expand All @@ -128,18 +128,18 @@ def read_csv_results(fn: Union[str, Path], config: Dict, maps: xr.Dataset) -> Di
"vertical" in col["parameter"]
or "lateral.land" in col["parameter"]
):
mask = maps[f'{config["input"].get("subcatchment")}'].copy()
mask = maps[f"{config['input'].get('subcatchment')}"].copy()
elif "reservoir" in col["parameter"]:
mask = maps[
f'{config["input"]["lateral"]["river"]["reservoir"].get("locs")}'
f"{config['input']['lateral']['river']['reservoir'].get('locs')}"
].copy()
elif "lake" in col["parameter"]:
mask = maps[
f'{config["input"]["lateral"]["river"]["lake"].get("locs")}'
f"{config['input']['lateral']['river']['lake'].get('locs')}"
].copy()
# Else lateral.river
else:
mask = maps[f'{config["input"].get("river_location")}'].copy()
mask = maps[f"{config['input'].get('river_location')}"].copy()
# Rearrange the mask
res_x, res_y = mask.raster.res
if res_y < 0:
Expand Down
2 changes: 1 addition & 1 deletion hydromt_wflow/wflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import toml
import xarray as xr
from dask.diagnostics import ProgressBar
from hydromt import flw
from hydromt.gis import flw
from hydromt.models.model_grid import GridModel
from hydromt.nodata import NoDataStrategy
from pyflwdir import core_conversion, core_d8, core_ldd
Expand Down
4,614 changes: 1,677 additions & 2,937 deletions pixi.lock

Large diffs are not rendered by default.

125 changes: 66 additions & 59 deletions pixi.toml
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
[project]
authors = ["Sam Vente <[email protected]>"]
name = "hydromt_wflow"
channels = ["conda-forge"]
authors = ["Sam Vente <[email protected]>"]
name = "hydromt_wflow"
channels = ["conda-forge"]
platforms = ["linux-64", "win-64"]

[tasks]

install = { depends-on = ["install-hydromt", "install-pre-commit"] }
install-hydromt = "pip install --no-deps --editable ."
install = { depends-on = ["install-hydromt", "install-pre-commit"] }
install-pre-commit = "pre-commit install"

lint = { cmd = ["pre-commit", "run", "--all"] }

doctest = { cmd = [
"sphinx-build",
"-M",
"doctest",
"docs",
"docs/_build",
"-W",
"sphinx-build",
"-M",
"doctest",
"docs",
"docs/_build",
"-W",
] }
docs-build = { cmd = [
"sphinx-build",
"-M",
"html",
"docs",
"docs/_build",
"-W",
"sphinx-build",
"-M",
"html",
"docs",
"docs/_build",
"-W",
], depends-on = [
"doctest",
"doctest",
] }
docs = { depends-on = ["docs-build"] } # alias
doc = { depends-on = ["docs-build"] } # alias
Expand All @@ -37,10 +35,10 @@ serve = { cmd = ["python", "-m", "http.server", "-d", "docs/_build/html"] }

# clean
clean = { depends-on = [
"clean-dist",
"clean-docs-generated",
"clean-docs-build",
"clean-docs-exmaples",
"clean-dist",
"clean-docs-generated",
"clean-docs-build",
"clean-docs-exmaples",
] }
clean-dist = { cmd = ["rm", "-rf", "dist"] }
clean-docs-generated = { cmd = ["rm", "-rf", "docs/_generated"] }
Expand All @@ -51,75 +49,84 @@ test = { cmd = ["pytest"] }
test-lf = { cmd = ["pytest", "--lf", "--tb=short"] }
test-err-warn = { cmd = ["pytest", "--tb=short", "-W", "error"] }
test-cov = { cmd = [
"pytest",
"--verbose",
"--cov=hydromt",
"--cov-report",
"xml",
"pytest",
"--verbose",
"--cov=hydromt",
"--cov-report",
"xml",
] }

mypy = "mypy ."

[dependencies]
dask = "*"
hydromt = ">=v0.10.1,<1"
dask = "*"
hydromt = ">=1"
geopandas = ">=0.10"
netcdf4 = "*"
numpy = "*"
pandas = "*"
pyflwdir = ">=0.5.7"
pyproj = "*"
scipy = "*"
shapely = "*"
toml = "*"
xarray = "*"
netcdf4 = "*"
numpy = "*"
pandas = "*"
pyflwdir = ">=0.5.7"
pyproj = "*"
scipy = "*"
shapely = "*"
toml = "*"
xarray = "*"
python = ">=3.11"

[feature.lint.dependencies]
ruff = "*"
ruff = "*"
pre-commit = "*"
mypy = "*"
pip = ">=23.1.2"
mypy = "*"
pip = ">=23.1.2"


[feature.test.dependencies]
pytest-cov = "*"
pytest-cov = "*"
pytest-mock = "*"
pytest = ">=2.7.3"
pytest = ">=2.7.3"


[feature.io.dependencies]
requests = "*"

[feature.examples.dependencies]
jupyterlab = "*"
cartopy = "*"
notebook = "*"
nbconvert = "==7.13.1"
cartopy = "*"
notebook = "*"

[feature.extra.dependencies]
gdal = "*"
gdal = "*"
pcraster = "*"

[feature.extra.pypi-dependencies]
gwwapi = "*"
gwwapi = "*"
hydroengine = "*"
pyet = "*"
pyet = "*"

[feature.doc.dependencies]
pydata-sphinx-theme = "*"
nbconvert = "==7.13.1"
nbsphinx = "*"
sphinx = "*"
nbconvert = "==7.13.1"
nbsphinx = "*"
sphinx = "*"

[feature.doc.pypi-dependencies]
sphinx-autosummary-accessors = "*"
sphinx-design = "*"
sphinx-design = "*"

[feature.dev.pypi-dependencies]
hydromt_wflow = { path = ".", editable = true }

[environments]
lint = { features = ["lint"], no-default-feature = true, solve-group = "dev" }
test = { features = ["test"], solve-group = "dev" }
doc = { features = ["doc", "examples", "io", "extra"], solve-group = "dev" }

default = { features = ["full"] }
full = { features = ["extra", "io", "lint", "test", "doc", "examples"] }
slim = { features = ["io", "extra", "examples"] }
doc = { features = ["doc", "examples", "io", "extra"], solve-group = "dev" }
default = { features = [
"extra",
"io",
"lint",
"test",
"doc",
"examples",
"dev",
], solve-group = "dev" }
slim = { features = ["io", "extra", "examples"] }
Loading

0 comments on commit 46de589

Please sign in to comment.