Skip to content

Xarray io tests #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 12 commits into
base: develop
Choose a base branch
from
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-22.04, macos-13, windows-2022 ]
python: [ "311", "312", "313" ]
# Disable py313 until numba is available for python 3.13
python: [ "311", "312" ]
env:
GCC_V: 11
steps:
Expand Down
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
}
}
}
},
"files.insertFinalNewline": true,
}
12 changes: 12 additions & 0 deletions flopy4/xarray_jinja/filters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import numpy as np
import xarray as xr


def dask_expand(data: xr.DataArray):
for block in data.data.to_delayed():
block_data = block.compute()
yield block_data


def nparray2string(data: np.ndarray):
return np.array2string(data, separator=" ")[1:-1] # remove brackets
5 changes: 5 additions & 0 deletions flopy4/xarray_jinja/templates/disu_template.disu.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
BEGIN GRIDDATA
{% for chunk in data | dask_expand %}
{{chunk | nparray2string }}
{% endfor %}
END GRIDDATA
999 changes: 181 additions & 818 deletions pixi.lock

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ dependencies = [
"networkx>=3.4.2,<4",
"xarray[parallel,io]>=2024.11.0,<2025",
"scipy>=1.14.1,<2",
"xarray-extras>=0.6.0",
]
dynamic = ["version"]

Expand Down Expand Up @@ -120,13 +121,15 @@ python = "3.11"
[tool.pixi.feature.py312.dependencies]
python = "3.12"

[tool.pixi.feature.py313.dependencies]
python = "3.13"
# Disable py313 until numba is available for python 3.13
# [tool.pixi.feature.py313.dependencies]
# python = "3.13"

[tool.pixi.environments]
test311 = { features = ["py311", "test"], solve-group = "py311" }
test312 = { features = ["py312", "test"], solve-group = "py312" }
test313 = { features = ["py313", "test"], solve-group = "py313" }
# Disable py313 until numba is available for python 3.13
# test313 = { features = ["py313", "test"], solve-group = "py313" }
dev = { features = ["py311", "test", "lint", "build"], solve-group = "py311" }

[tool.pixi.feature.build.tasks]
Expand Down
4 changes: 3 additions & 1 deletion test/pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ addopts = --color=yes
python_files =
test_*.py
markers =
slow: tests not completing in a few seconds
slow: tests not completing in a few seconds
timing: mark test as time profiling test
memory: mark test as memory profiling test
Loading
Loading