Skip to content

fix(model_attributes_to_shapefile): use modelgrid kwarg if provided#2768

Merged
wpbonelli merged 2 commits into
modflowpy:developfrom
wpbonelli:fix-2744
Jun 9, 2026
Merged

fix(model_attributes_to_shapefile): use modelgrid kwarg if provided#2768
wpbonelli merged 2 commits into
modflowpy:developfrom
wpbonelli:fix-2744

Conversation

@wpbonelli

@wpbonelli wpbonelli commented Jun 9, 2026

Copy link
Copy Markdown
Member

The model_attributes_to_shapefile() function is described as accepting a "modelgrid" kwarg, but when provided it went unused. Pop it from kwargs, call to_geodataframe() on it if provided to build an initial gdf, then pass that as an initial gdf to the model's to_geodataframe().

Also, add a trap for base Grid in model-level .to_geodataframe() methods. The base Grid.to_geodataframe() method requires a features param since the grid contains no geometry info.

Related to #2744

@wpbonelli wpbonelli added this to the 3.10.1 milestone Jun 9, 2026
@wpbonelli wpbonelli added the bug label Jun 9, 2026
@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.5%. Comparing base (556c088) to head (58fdd83).
⚠️ Report is 171 commits behind head on develop.

Files with missing lines Patch % Lines
flopy/export/shapefile_utils.py 60.0% 2 Missing ⚠️
flopy/mbase.py 80.0% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2768      +/-   ##
===========================================
+ Coverage     55.5%    72.5%   +17.0%     
===========================================
  Files          644      677      +33     
  Lines       124135   132714    +8579     
===========================================
+ Hits         68947    96319   +27372     
+ Misses       55188    36395   -18793     
Files with missing lines Coverage Δ
flopy/mf6/mfmodel.py 57.6% <100.0%> (-23.3%) ⬇️
flopy/mbase.py 70.4% <80.0%> (-2.3%) ⬇️
flopy/export/shapefile_utils.py 58.6% <60.0%> (-25.4%) ⬇️

... and 577 files with indirect coverage changes

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

@wpbonelli wpbonelli marked this pull request as ready for review June 9, 2026 19:06
@wpbonelli wpbonelli merged commit 6a5d271 into modflowpy:develop Jun 9, 2026
19 checks passed
@wpbonelli wpbonelli deleted the fix-2744 branch June 9, 2026 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant