Skip to content

Feat sim pathlib support#1712

Merged
wpbonelli merged 3 commits into
modflowpy:developfrom
aleaf:feat_sim_pathlib_support
Feb 13, 2023
Merged

Feat sim pathlib support#1712
wpbonelli merged 3 commits into
modflowpy:developfrom
aleaf:feat_sim_pathlib_support

Conversation

@aleaf
Copy link
Copy Markdown
Contributor

@aleaf aleaf commented Feb 8, 2023

This PR aims to add pathlib support for flopy.mf6.MFSimulation, so that one can supply a pathlike object to the sim_ws argument. This also adds pip to etc/environment.yml to avoid the warning that you get when creating a conda environment from this file (conda installs pip anyways after the warning).

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 8, 2023

Codecov Report

Merging #1712 (976079a) into develop (2552de5) will increase coverage by 0.0%.
The diff coverage is 100.0%.

@@           Coverage Diff           @@
##           develop   #1712   +/-   ##
=======================================
  Coverage     71.9%   71.9%           
=======================================
  Files          253     253           
  Lines        55891   55890    -1     
=======================================
+ Hits         40202   40205    +3     
+ Misses       15689   15685    -4     
Impacted Files Coverage Δ
flopy/mf6/mfbase.py 82.1% <100.0%> (-0.1%) ⬇️
flopy/utils/get_modflow.py 63.9% <0.0%> (+0.9%) ⬆️

Copy link
Copy Markdown
Contributor

@mwtoews mwtoews left a comment

Choose a reason for hiding this comment

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

This is a good start. And thanks for resolving the pip warning.

Comment thread flopy/mf6/mfbase.py
self._sim_path = os.path.join(os.getcwd(), path)
# ensure that _sim_path is absolute
path = Path(path)
self._sim_path = path.absolute()
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.

Maybe worth calling path.expanduser().absolute() to get tilde expansion too? Just an extra convenience. Could do this in a followup PR, supporting PathLike more broadly throughout flopy seems worthwhile

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