Skip to main content

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

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(mesh).summary())
write_ugrid(mesh, "mesh_net.nc")

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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for refined-quads 0.1.0
File Size Uploaded Provenance Actions
refined_quads-0.1.0.tar.gz 583.4 kB With provenance Details for refined_quads-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for refined-quads 0.1.0
File Interpreter ABI Platform Actions
refined_quads-0.1.0-py3-none-any.whl Python 3 none any Details for refined_quads-0.1.0-py3-none-any.whl

Total release size: 672.3 kB

Release files / refined_quads-0.1.0.tar.gz

Download URL refined_quads-0.1.0.tar.gz
Size 583.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0fc95708e2f3a686ac966570218cdee09e35cdf8af048078de4f1b4540abd9db
BLAKE2b-256 checksum
How to use checksums
53140f75b2777cb0eda026a93295eb3dd29e9c1d3361fafaa54a7e1f0a1731f6
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 log

Release files / refined_quads-0.1.0-py3-none-any.whl

Download URL refined_quads-0.1.0-py3-none-any.whl
Size 88.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5103835045eb49f12d1087682b765b907bbc0640d0c70d94b22f53488bd0b517
BLAKE2b-256 checksum
How to use checksums
d49d3f177eb6eee7f7d898b29eb0c0ea8b2f57c41b44d17f401145bd04e6338f
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 log

Security for refined-quads 0.1.0

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.

Select from 2 files

Attestation for refined_quads-0.1.0.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 log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page