Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Small improvements: Safety check for gage load from files; and added .vs folder to gitignore; Skip comment lines while reading GMG datasets#2544

Merged
wpbonelli merged 5 commits into
modflowpy:developfrom
whcollab-proj:main
Jul 14, 2025
Merged

Small improvements: Safety check for gage load from files; and added .vs folder to gitignore; Skip comment lines while reading GMG datasets#2544
wpbonelli merged 5 commits into
modflowpy:developfrom
whcollab-proj:main

Conversation

@whcollab-proj

@whcollab-proj whcollab-proj commented Jul 14, 2025

Copy link
Copy Markdown
Contributor

This pull request includes three minor improvements:

1 - Gage file safety check: Ensures that the loop over gage-related files only executes if the file array is properly initialized. This prevents errors in cases where no files are provided.

2 - .gitignore update**: Added the .vs directory (Visual Studio workspace settings) to the .gitignore file to avoid accidentally committing user-specific IDE files.

3- Extend the comment skip lines to all GMG dataset reads

…aths. This check prevents the function to throw TypeError: "NoneType" object is not iterable.

@wpbonelli wpbonelli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

Comment thread .gitignore Outdated
@whcollab-proj whcollab-proj changed the title Small improvements: Safety check for gage load from files; and added .vs folder to gitignore. Small improvements: Safety check for gage load from files; and added .vs folder to gitignore; Skip comment lines while reading GMG datasets Jul 14, 2025
@codecov

codecov Bot commented Jul 14, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.9%. Comparing base (556c088) to head (88b88da).
Report is 13 commits behind head on develop.

Additional details and impacted files
@@            Coverage Diff             @@
##           develop    #2544     +/-   ##
==========================================
+ Coverage     55.5%    55.9%   +0.4%     
==========================================
  Files          644      640      -4     
  Lines       124135   123798    -337     
==========================================
+ Hits         68947    69265    +318     
+ Misses       55188    54533    -655     
Files with missing lines Coverage Δ
flopy/modflow/mfgage.py 89.1% <100.0%> (+<0.1%) ⬆️
flopy/modflow/mfgmg.py 85.8% <100.0%> (+1.3%) ⬆️

... and 68 files with indirect coverage changes

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

@whcollab-proj

Copy link
Copy Markdown
Contributor Author

@wpbonelli

Added another small fix to the request.

First time making this pull request here... I believe I should have made it in a different one. Just getting the hang of it (sorry :) )

@whcollab-proj whcollab-proj requested a review from wpbonelli July 14, 2025 16:24
@wpbonelli

Copy link
Copy Markdown
Member

@whcollab-proj no problem, thanks for the pr. can you run the ruff formatter/linter?

ideally these could be separate (with tests) but the changes are small. the first one is good, second one, I've never used GMG, are those input files supposed to support comments?

@whcollab-proj

whcollab-proj commented Jul 14, 2025

Copy link
Copy Markdown
Contributor Author

@wpbonelli

> @whcollab-proj no problem, thanks for the pr. can you run the ruff formatter/linter?

  • Yes. Just did.

> ideally these could be separate (with tests) but the changes are small.

  • Makes sense... I'll avoid lumping these kind of changes together... and add tests for more involved requests.

> the first one is good, second one, I've never used GMG, are those input files supposed to support comments?

  • Apparently, those comment lines are also supported in the GMG solver input. Those can be added to input file via external tools. While loading data, flopy was already taking care of the comments prior the first dataset line (dataset 0), but the same check was not added for the following datasets (1, 2, and 3 https://water.usgs.gov/ogw/modflow/MODFLOW-2005-Guide/gmg.html).
    This change was mainly to replicate that check for other datasets, so an input similar to the following can be loaded without errors (ValueError)

    GMG input example:

#Geometric Multigrid Solver: Input Instruction
# [RCLOSE] [IITER] [HCLOSE] [MXITER]
0.01 10 0.01 25
# [DAMP] [IADAMP] [IOUTGMG] [IUNITMHC]
1 0 1 6
# [ISM] [ISC] [DUP] [DLOW] [CHGLIMIT]
0 0 0.75 0.25 10
# [RELAX]
1

@wpbonelli wpbonelli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it makes sense to support the extra comments for compatibility with external tools, even though the spec doesn't mention comments on lines below the first.

@wpbonelli wpbonelli merged commit cd4fa97 into modflowpy:develop Jul 14, 2025
19 of 20 checks passed
@whcollab-proj whcollab-proj deleted the main branch July 14, 2025 19:45
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.

3 participants