Skip to content

Conversation

@mjreno
Copy link
Contributor

@mjreno mjreno commented Dec 18, 2025

MODFLOW 6 NetCDF input files from pydantic based model objects:

  • "data only" files currently (for simulation input not visualization)
  • pyandic NetCDF model objects are internally validated once generated
  • Interfaces support creating objects from dictionary descriptions or pyphoenix models
  • Interfaces support generating xarray datasets, json schema dictionaries and full meta description dictionaries from objects

Example:

dims = [2, 4, 3, 2]   # "nper", "nlay", "nrow", "ncol" for structured gridtype
recharge = np.linspace(1, 2, 12)
packages = [
    {
        "package_name": "rcha_0",
        "package_type": "gwf-rcha",
        "params": [
            {"name": "recharge", "data": recharge},
        ],
    },
]
nc_cfg = {
    "modeltype": "gwf6",
    "modelname": "gwfmodel",
    "gridtype": "structured",
    "packages": packages,
}

nc_model = NetCDFModel.from_dict(nc_cfg, context={"dims": dims})
ds = nc_model.to_xarray()

@mjreno mjreno merged commit 6ea6b35 into modflowpy:develop Dec 19, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant