Skip to content

feat(netcdf): support writing simulation #2564

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

Open
wants to merge 22 commits into
base: develop
Choose a base branch
from

Conversation

mjreno
Copy link
Contributor

@mjreno mjreno commented Aug 1, 2025

NetCDF simulation write support:

  • netcdf argument supported for write_simulation()
  • NetCDF simulation load not yet supported
  • argument can create structured, layered or no NetCDF file
  • model and package support for interactively creating dataset

Non-interactive example:

# load ascii simulation 
sim = flopy.mf6.MFSimulation.load(sim_ws=ascii_ws)
# set simulation path and write simulation
sim.set_sim_path(netcdf_ws)
sim.write_simulation(netcdf="structured")

MODFLOW 6 netcdf file info via MFModel / MFPackage. Static and instance methods support retrieving attribute dictionaries for LAYERED MESH (UGRID) or non-mesh netcdf files. The attributes in the returned dictionary are those required for a MODFLOW 6 compliant netcdf model input file. Usage examples for structured datasets are in the tutorial files.

Copy link

codecov bot commented Aug 1, 2025

Codecov Report

❌ Patch coverage is 14.06926% with 397 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.3%. Comparing base (556c088) to head (f72a49c).
⚠️ Report is 34 commits behind head on develop.

Files with missing lines Patch % Lines
flopy/mf6/mfpackage.py 10.9% 138 Missing ⚠️
flopy/discretization/structuredgrid.py 2.4% 120 Missing ⚠️
flopy/discretization/vertexgrid.py 1.4% 66 Missing ⚠️
flopy/mf6/mfmodel.py 21.3% 59 Missing ⚠️
flopy/mf6/data/mfdataarray.py 57.8% 8 Missing ⚠️
flopy/mf6/data/mfstructure.py 81.8% 2 Missing ⚠️
flopy/discretization/grid.py 50.0% 1 Missing ⚠️
flopy/discretization/unstructuredgrid.py 50.0% 1 Missing ⚠️
flopy/mf6/data/mfdatastorage.py 80.0% 1 Missing ⚠️
flopy/mf6/utils/codegen/filters.py 0.0% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2564      +/-   ##
===========================================
+ Coverage     55.5%    72.3%   +16.7%     
===========================================
  Files          644      667      +23     
  Lines       124135   129503    +5368     
===========================================
+ Hits         68947    93685   +24738     
+ Misses       55188    35818   -19370     
Files with missing lines Coverage Δ
flopy/mf6/mfbase.py 75.0% <100.0%> (-12.7%) ⬇️
flopy/mf6/mfsimbase.py 62.2% <100.0%> (-13.3%) ⬇️
flopy/discretization/grid.py 75.6% <50.0%> (-0.4%) ⬇️
flopy/discretization/unstructuredgrid.py 75.0% <50.0%> (-6.5%) ⬇️
flopy/mf6/data/mfdatastorage.py 70.5% <80.0%> (-3.4%) ⬇️
flopy/mf6/utils/codegen/filters.py 0.0% <0.0%> (ø)
flopy/mf6/data/mfstructure.py 73.8% <81.8%> (+<0.1%) ⬆️
flopy/mf6/data/mfdataarray.py 58.5% <57.8%> (-8.5%) ⬇️
flopy/mf6/mfmodel.py 53.9% <21.3%> (-27.0%) ⬇️
flopy/discretization/vertexgrid.py 64.5% <1.4%> (-19.2%) ⬇️
... and 2 more

... and 402 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mjreno mjreno force-pushed the netcdf_info branch 2 times, most recently from d4fbc10 to 83e5167 Compare August 8, 2025 17:44
@mjreno mjreno changed the title feat(netcdf): retrieve netcdf info for model and package feat(netcdf): support writing simulation Aug 15, 2025
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