refined-quads
Generate and refine refined quad meshes for D-Flow FM: axis-aligned squares on a fixed lattice, locally refined by repeated halving, with transition cells only where refinement levels meet.
from shapely import Point, box
from refined_quads import check, generate, write_ugrid
quad_mesh = generate(
box(155_000, 463_000, 155_640, 463_480),
cell_size=32.0,
refinement_areas=[(Point(155_250, 463_240).buffer(70), 3)],
transition_rows=[1, 1, 1],
crs="EPSG:28992",
)
print(check(quad_mesh).summary())
write_ugrid(quad_mesh, "mesh_net.nc")
Warning: do not call the result
meshin a D-HyDAMO script. Those scripts usually importfrom hydrolib.dhydamo.geometry import mesh(the module withmesh2d_clip,links1d2d_add_links_1d_to_2dand so on);mesh = generate(...)replaces that module, and the nextmesh.<function>(...)fails with anAttributeError. That is why the examples usequad_mesh.
The package also refines an existing mesh (also one made by another program), checks a mesh for what D-Flow FM needs, reads its input from GIS layers and runs from a TOML file on the command line. See the documentation.
Status: pre-alpha. The API is not stable yet.
Install
pip install refined-quads
or, in a uv project, uv add refined-quads. All dependencies come as wheels; no separate
GDAL installation is needed. The package is tested on Windows and Linux; on macOS the
MeshKernel wheel needs OpenMP from Homebrew (brew install libomp).
Development
The project uses uv, which also installs Python.
Install uv on Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Install uv on Linux or macOS
curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync --locked # create .venv with all dependency groups
uv run pre-commit install # run the checks below on every commit
uv run pytest # fast test suite
uv run pytest -m benchmark # also: slow, realdata
uv run pre-commit run --all-files # file hygiene, yamllint, ruff check and format
uv run mypy # strict type check of src/
The source in src/refined_quads/ is grouped by task: _generate/, _refine/,
_check/, _io/ (GIS layers and UGRID files) and _common/ (shared building blocks).
The public API is only what the top-level package exports. The tests in tests/ use the
same folders; tests/golden/ holds the golden masters that guard the output.
Documentation
The site is built with Quarto, which is installed separately
(on Windows: winget install Posit.Quarto):
cd docs
uv run quartodoc build # API reference from the docstrings
uv run quarto preview # live preview; `quarto render` builds docs/_site/
Quarto must be on your PATH. On Windows, make sure
C:\Program Files\Quarto\bin is included in the Path environment variable.
After updating it, open a new terminal or reload PATH in your current PowerShell
session, then start the preview from docs/:
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
uv run quarto preview
Releases
The version comes from Git tags (v0.1.0 → 0.1.0). Publishing a GitHub release
uploads the package to PyPI.
Domain terms are defined in CONTEXT.md; architectural decisions are in docs/adr/.
Licence
refined-quads is developed by HKV lijn in water and Svasek Hydraulics and published under the GNU General Public License v3 or later.
Metadata
Release files for refined-quads 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| refined_quads-0.1.1.tar.gz | 583.9 kB | With provenance | Details for refined_quads-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| refined_quads-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for refined_quads-0.1.1-py3-none-any.whl |
Total release size: 673.0 kB
Release files / refined_quads-0.1.1.tar.gz
| Download URL | refined_quads-0.1.1.tar.gz |
|---|---|
| Size | 583.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63be4cfbcd5b8bfda9c927ed7cff88b9b67d23ef0e703153c7938a2f933df97a
|
|
BLAKE2b-256 checksum How to use checksums |
eb8814743fc9a65f6ca8caf669eb7525bfad3102655e5aeb78ee6581f2e58cc3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logRelease files / refined_quads-0.1.1-py3-none-any.whl
| Download URL | refined_quads-0.1.1-py3-none-any.whl |
|---|---|
| Size | 89.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
69f87f3920416e92be1b9de1fd114b82bbc93ac72678d3beb6c0cd7d6cea635f
|
|
BLAKE2b-256 checksum How to use checksums |
0d42a54d2537a06a02c2f77c9554e6dfd1db552067fff04f08de99a9baf9b710
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logSecurity for refined-quads 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for refined_quads-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.