Skip to main content

NCFTOOLS

A collection of Python tools for working with NetCDF files.

Installation

pip install -e .

Features

  • meshinfo: Display mesh information from FlowFM NetCDF files (node/face/edge counts, element types, spatial extent)
  • nc2shp: Convert a UGRID-compliant NetCDF mesh file to ESRI Shapefiles
  • transzone1: Build a transition zone from triangle mesh faces and select all intersecting faces
  • transzone2: Extract the core transition zone — faces fully within the shrunk zone
  • setncrain: Point a D-Flow FM model (.ext / .mdu) at a NetCDF rainfall forcing file
  • rnxml: Rename dimr.xml to dimr_config.xml

Usage

Check version

ncftools --version

List all available commands

ncftools-info

meshinfo

Display mesh information from a FlowFM NetCDF file.

meshinfo FlowFM_net.nc
meshinfo -h

nc2shp

Convert a NetCDF mesh file to ESRI Shapefiles. Outputs {stem}_faces.shp in the output directory. Pass -d/--dissolve to additionally write {stem}_dissolved.shp, a single polygon dissolved from all mesh faces (slower on large meshes).

nc2shp -i FlowFM_net.nc
nc2shp -i mesh.nc -d
nc2shp -i mesh.nc -o output --crs EPSG:4326
nc2shp -i mesh.nc -q

transzone1

Buffer triangle mesh faces by +1 m to form a transition zone, then select all faces that intersect it. Outputs trans_zone.shp and trans_zone_extend.shp.

Triangles are identified from the type attribute column when present; otherwise they are detected automatically by vertex count (closed rings with 3 unique vertices).

transzone1 -i SHP_NC/FlowFM_net_faces.shp
transzone1 -i SHP_NC/FlowFM_net_faces.shp -o SHP_TRANS
transzone1 -i SHP_NC/FlowFM_net_faces.shp -q

transzone2

Shrink trans_zone_extend.shp (output of transzone1) by −1 m and select faces fully within the core zone. Outputs trans_zone_core.shp.

transzone2 -i SHP_NC/FlowFM_net_faces.shp -z SHP_TRANS/trans_zone_extend.shp
transzone2 -i SHP_NC/FlowFM_net_faces.shp -z SHP_TRANS/trans_zone_extend.shp -o SHP_TRANS
transzone2 -i SHP_NC/FlowFM_net_faces.shp -z SHP_TRANS/trans_zone_extend.shp -q

setncrain

Point a D-Flow FM model at a NetCDF rainfall forcing file.

Every [Meteo] block in the .ext file is rewritten to quantity=rainfall, forcingFile=<your .nc>, forcingFileType=netcdf. If the .ext file does not exist it is created from a built-in template and registered in the .mdu as ExtForceFileNew.

The NetCDF time axis is read and the model times in the .mdu are set to match it (expressed in the model's Tunit):

Key Value
RefDate midnight of the first time stamp
TStart offset of the first time stamp from RefDate
TStop offset of the last time stamp from RefDate

The forcingFile path is written relative to the .ext file (D-Flow FM resolves it that way); use --as-given to write it exactly as typed. .bak copies of the modified files are written unless --no-backup is given.

setncrain -i May28_Event.nc
setncrain -i data/May28_Event.nc --ext dflowfm/FM_model_bnd.ext
setncrain -i May28_Event.nc --mdu dflowfm/FM_model.mdu --no-time
setncrain -i May28_Event.nc --no-backup --as-given
setncrain -i May28_Event.nc -q

rnxml

Rename dimr.xml to dimr_config.xml, the name the DIMR runner expects. The file stays in its folder and its contents are not touched.

If dimr_config.xml already exists the rename is refused; pass --force to overwrite it (a .bak copy of the old target is kept unless --no-backup).

rnxml
rnxml -i model/dimr.xml
rnxml -i dimr.xml -o dimr_config.xml --force
rnxml -i dimr.xml -q

Python API

from ncftools import meshinfo

meshinfo.show_mesh_info("FlowFM_net.nc")

Metadata

Release files for ncftools 0.9.2

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

Source distribution (sdist)

Source distribution for ncftools 0.9.2
File Size Uploaded
ncftools-0.9.2.tar.gz 17.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ncftools 0.9.2
File Interpreter ABI Platform
ncftools-0.9.2-py3-none-any.whl Python 3 none any Details

Total release size: 38.3 kB

Release files / ncftools-0.9.2.tar.gz

Download URL ncftools-0.9.2.tar.gz
Size 17.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b090cabd2a4aeb2d339770abaa5ddbfefc533c6bc2db539c208f2964b70ea48b
BLAKE2b-256 checksum
How to use checksums
2abd72d01064008b726d13523a12d2cd5a357b30eb5d7380eea0f0661bb80336
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 4, 2026.

Transparency log

Release files / ncftools-0.9.2-py3-none-any.whl

Download URL ncftools-0.9.2-py3-none-any.whl
Size 21.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc11050c4557d5ff1e27ff8f3d23f402144737b14180816b688e3a4b9baa411a
BLAKE2b-256 checksum
How to use checksums
f01ab06597af69e3a62a7997fcc6cb3ed4edd6ca85e6ab256eeb851ad5514e48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 4, 2026.

Transparency log

Release history Release notifications | RSS feed

0.9.3

2 release files

This release

0.9.2 This release

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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