-
Notifications
You must be signed in to change notification settings - Fork 330
Release 3.8.0 #2287
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
Merged
Release 3.8.0 #2287
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Post release 3.7.0 reset
…#2200) This PR changes deprecated .to_shapefile() functions to raise AttributeError with a helpful message. These are the affected functions: flopy.utils.util_list.MfList.to_shapefile flopy.pakbase.Package.to_shapefile flopy.mbase.BaseModel.to_shapefile While these functions have been deprecated since 3.2.4 released in 2016, they were never documented as such. Thus a helpful exception message and cross-referenced docstring is used instead of removing these functions.
The RTD builds have stopped working for a few weeks now, with a fatal error due to insufficient memory on the worker node. Troubleshooting docs suggests to reduce the number of output formats. This PR disables the following output formats. - PDF. For flopy 3.6.0, this document is 2145 pages in US Letter page size (hopefully never printed). Is this document ever read or checked? For example, pages 733 to 753 simply lists numbers 1 to 1000. - EPUB is an e-book file format. Is this document ever read or checked? This PR keeps the following output formats: - HTML is always built, and is the primary document most people use. - Downloadable HTML ("htmlzip"). For flopy 3.6.0, this archive is 47 MB, which is expected. It is plausible this version of docs may need to be downloaded for "offline use" or for archiving, so I feel it is appropriate to keep this format option.
This PR fixes the doc section headers to have consistent lengths. It is a cause of many errors while building docs with sphinx. This was mostly automated with ruff check --select=D409 --fix with the rule kept in pyproject.toml for future-proofing.
the key should be `per` not `d`
) This PR raises NotImplementedError where appropriate, for example abstract methods. Several instances where a comment or message printing "not implemented" are changed to raise this exception instead. A few other exceptions from flopy/mbase.py are reclassified to raise TypeError where some of the expected types are missing.
This PR addresses the following issue: #2214
* avoid datetime.utcnow() deprecation warning * motivation: fix broken nbsphinx galleries on RTD * alternative: deprecation warning filter in examples?
* devtools now replaces square brackets from parametrization in path names * also need to name_map pyshp -> shapefile since requires_pkg is strict now
* only allow one concurrent workflow run per branch
* feat(exg pkg binary file support) * feat(binary file) * feat(exchange binary file) * fix(workflows): use latest version of modflow with notebook tests * fix(workflows)
Reproduce and fix #2198
This PR aims to clean-up docs/comments in python files. Primarily, it removes commented-out lines of code that appear to have been unintentionally staged for commit. The deletions include: Old code prior to refactoring Assert statements Print debug statements Warning, logging, exception messages Function arguments etc. The deletions do not include: .docs/Notebooks/*.py As the changes are limited to comments, for the most part, they should not affect the existing behavior of the code, hence the "docs" label for this PR.
This feature adds a .headers property for a pandas data frame of the headers of various data files, including HeadFile, FormattedHeadFile, UcnFile and CellBudgetFile. This is a modern accessor to the headers, which is created internally using: pd.DataFrame(self.recordarray, index=self.iposarray) where the index is the file position to the start of each array. Text fields are decoded to str types (rather than dealing with bytes types, which is probably a hang-over from Python2). Int32 types are left as-is, except for iposarray which should be int64 to read large files >2GB. Float32 types are also left as-is, since these would otherwise have a lossy conversion to float64. With the CellBudgetFile, the headers vary depending on the type of budget file. For instance, "classic" files (created without "COMPACT BUDGET" option) don't have imeth, delt, pertim, or totim columns. Furthermore, only files with imeth=6 have the extra text columns modelnam, paknam, modelnam2, and paknam2, since these fields are always empty. This PR also adds more checks to the outputs created with ._build_index() methods. Eventually, I'm planning to deprecate other properties and functions that are using the .recordarray structured array, so it is important to have a detailed trace of these outputs before replacing them. This PR also moves the __enter__ / __exit__ methods from BinaryLayerFile to LayerFile (this feature was from #669). This is so FormattedHeadFile can also use the "with" context statement to also auto-close the file.
for a simulation with N successful particles,`get_alldata()` was returning the first N particles by `particleid` rather than the N particles which terminated successfully Co-authored-by: wpbonelli <wbonelli@ucar.edu>
This PR has a few aims related to data files, including FormattedHeadFile, HeadFile and CellBudgetFile. These files have a "number of records" property that was implemented with get_nrecords(). This "length of the object" measure is more naturally done with __len__, i.e. len(headsfile). It is advised to prefer the len() approach, so instances of get_nrecords() for these files show a DeprecationWarning. The CellBudgetFile also has a .nrecords property. It is also advised to show a DeprecationWarning with this property. This PR also fixes a bug with get_nrecords(), recordarray is a structured array (np.ndarray), not a record array, so this always silently returns 0. This bug does not apply to CellBudgetFile, which worked fine and matches obj.nrecords. Fixing this bug caused a test to fail, since a for-loop was never activated. A "todo" note is added since the reversed header is not the same as the original header. Another aim of this PR is to re-organize a few CellBudgetFile tests from test_binaryfile.py to test_cellbudgetfile.py. Most of this is copied with perhaps minor simplifications. Note that none of these changes apply to flopy.utils.swroutputfile.SwrBudget.get_nrecords(), which returns a tuple.
While this regression test "passes", this PR resolves two errors to actually compare concentrations results: * Fix typo for filename "gwt_mst03.unc" ->"gwt_mst03.ucn" * Compare the two concentration files with compare_heads with text="concentration". Further explanations to the fixes: * The flopy.utils.compare module "passes" (returns assert True) if there are there are not two files to compare, which is an unusually silent approach. This was due to the filename typo. * These files are not MT3D-style concentration files, and would raise exceptions if read with UcnFile. They must be read with HeadFile(..., text="concentration")
This fixes issues while reading some binaryfiles with auto precision detection, and also modernizes a few aspects of flopy.utils.binaryfile left-over from python2. There are two changes to flopy.utils.binaryfile.binaryread(): * Raises EOFError if attempting to read data beyond the end-of-file * Deprecate vartype=str, since bytes is the the return type with Python3 Other refactors: * Simplify conventional ASCII range checks by converting bytes to a list of int, then check if bytes are within range * Remove checks if bytes are not str, and use .encode("ascii") where appropriate
…dependent on grid type (#2230)
…2232) Now that data files have a .headers data frame property (#2221), there is no need to have methods that print parts of this information to stdout (they return None). This PR deprecates the following: * list_records(): use headers instead * list_unique_records(): use headers[["text", "imeth"]].drop_duplicates() instead * list_unique_packages(to=True/False): use headers.paknam.drop_duplicates() or headers.paknam2.unique() (there are a few ways) The last two only apply to CellBudgetFile. This PR does not apply to flopy.mf6.utils.mfobservation.list_records().
Checking test_uzf_negative_iuzfopt with NumPy 2.0 (xref #2153), this test failed. The test criteria originally had several issues, including confusing extpd as pet. These issues are fixed in this PR to properly compare expected array values.
…20.3 (#2237) This PR resolves several deprecation warnings from NumPy 2.0 (xref #2153): * np.in1d() → np.isin() * "a16" → "S16" to describe 16-length string of bytes * The numpy.core.records module is private, so use numpy.rec instead, which seems to work with older versions This also bumps the minimum version of numpy from 1.15.0 to 1.20.3, since this is the minimum for pandas 2.0.0, thus the minimum versions were incompatible.
Remove code.json and disclaimer after discussion as they are no longer needed for this repo. Also a bit of miscellaneous cleanup.
#2225) An ARM mac distribution has been added to the executables repository, we can now detect arch and install the suitable binaries for all three repositories (mf6, nightly build, executables).
Fix the write logic for head file reversal to properly write each layer. Add a test for each discretization type. Fix in-place reverse by writing to a temp file first then renaming. Improve docstrings. Resolves #2246
This lets us trigger the RTD build at will, which will allow fixing problems like #2253 without pushing commits. Also some ruff updates: ignore e721 globally for now, ignore f632 in-place.
I think these can be removed since each has an equivalent and more complete duplicate in the mf6 examples repository, this also speeds up cumulative notebook runtime so we can eventually run them on RTD
Followup to #2254
Small step towards #1872. Move geometry info to a YAML file under examples/data/ and move utils into scripts to remove common/ module import and sys.path manipulation. A later PR may introduce pooch as we have done for the mf6 examples: - MODFLOW-ORG/modflow6-examples#137 - MODFLOW-ORG/modflow6-examples#153
* update(Raster): add new methods and checks * add feature `to_crs()` for re-projecting rasters * add static method `raster_from_array()` to allow users to make rasters from data * update `resample_to_grid()` - removed multithread and thread_pool kwargs - added initial check for raster/modelgrid intersection * add testing for raster improvements * Updates for raster_intersection_example.py * Linting * linting part 2 * Catch point with GeoSpatialUtil() in add_region()
* feat(lgr-disv): add new to_disv_gridprops to lgr object * ruff ruff * modflow6 lgr tutorial was mistakenly marked as modflow-lgr tutorial * add test * add layer information to gridprops and update test * ruff * minor tweaks to require idomain the same for all layers * add deprecation warnings for gridlist_to_disv_gridprops * ruff * ruff
Fix the failing optional dependency CI tests: https://github.com/modflowpy/flopy/actions/runs/10140767481/job/28036619744#step:7:3899
This fixes MFModel.get_ims_package which is a method that returns the relevant IMS through the simulation name files's solution group block.
This is no longer needed/supported as of #2240
Closes #2283 --------- Co-authored-by: wpbonelli <wbonelli@ucar.edu>
#2264 removed the notebook_utils.py module but neglected to remove this dependency from 3 examples: * export_vtk_tutorial.py * plot_cross_section_example.py * plot_map_view_example.py This is why these are missing from the develop version of the RTD site. This PR inlines the shared models which previously lived in notebook_utils.py. This duplication will go away once we have a models API as proposed in #1872.
jdhughes-dev
approved these changes
Aug 8, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
FloPy 3.8.0
The release can be approved by merging this pull request into
master
. This will trigger a final job to publish the release to PyPI.