Skip to content

Commit

Permalink
Merge branch 'dorelease' into 'master'
Browse files Browse the repository at this point in the history
prepare for release

See merge request deltares/imod/imod-python!76
  • Loading branch information
visr committed Jan 19, 2020
2 parents 11c6674 + a33f332 commit af93f66
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 13 deletions.
7 changes: 7 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ The format is based on `Keep a Changelog`_, and this project adheres to
[Unreleased]
------------

[0.9.0] - 2020-01-19
--------------------

Added
~~~~~
- IDF files representing data of arbitrary dimensionality can be opened and
Expand All @@ -19,11 +22,15 @@ Added
- Writing GDAL rasters using (:meth:`imod.rasterio.save`) and (:meth:`imod.rasterio.write`) auto-detects GDAL driver based on file extension
- 64-bit IDF files can be opened (:meth:`imod.idf.open`)
- 64-bit IDF files can be written using (:meth:`imod.idf.save`) and (:meth:`imod.idf.write`) using keyword ``dtype=np.float64``
- ``sel`` and ``isel`` methods to ``SeawatModel`` to support taking out a subdomain
- Docstrings for the Modflow 6 classes in :mod:`imod.mf6`
- :meth:`imod.select.upper_active_layer` function to get the upper active layer from ibound ``xr.DataArray``

Changed
~~~~~~~

- :func:`imod.idf.read` is deprecated, use :mod:`imod.idf.open` instead
- :func:`imod.rasterio.read` is deprecated, use :mod:`imod.rasterio.open` instead

Fixed
~~~~~
Expand Down
34 changes: 30 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,23 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
iMOD-Python: work with iMOD MODFLOW models in Python
====================================================
iMOD-Python: make massive MODFLOW models
========================================

Work with `iMOD <https://oss.deltares.nl/web/imod>`__ MODFLOW models in
Python.
The imod Python package is designed to help you in your MODFLOW groundwater modeling efforts.
It makes it easy to go from your raw data to a fully defined MODFLOW model, with the aim to make this process reproducable.
Whether you want to build a simple 2D conceptual model, or a complex 3D regional model with millions of cells,
imod-python scales automatically by making use of `dask <https://dask.org/>`__.

By building on top of popular Python packages like `xarray <http://xarray.pydata.org/>`__, `pandas <http://pandas.pydata.org/>`__,
`rasterio <https://rasterio.readthedocs.io/en/latest/>`__ and `geopandas <http://geopandas.org/>`__, a lot of functionality comes
for free.

Currently we support the creation of the following MODFLOW-based models:

* `USGS MODFLOW 6 <https://www.usgs.gov/software/modflow-6-usgs-modular-hydrologic-model>`__ (:doc:`api/mf6`), structured grids only
* `iMODFLOW <https://oss.deltares.nl/web/imod>`__ (:doc:`api/flow`)
* `iMOD-WQ <https://oss.deltares.nl/web/imod>`__ (:doc:`api/wq`), which integrates SEAWAT (density-dependent groundwater flow) and MT3DMS (multi-species reactive transport calculations)

Documentation: https://imod.xyz/

Expand Down Expand Up @@ -97,6 +109,20 @@ information see :doc:`installation`.
# with dimensions time, layer, y, x
da = imod.idf.open('path/to/results/head_*.idf')
# create a groundwater model
# abridged example, see examples for the full code
gwf_model = imod.mf6.GroundwaterFlowModel()
gwf_model["dis"] = imod.mf6.StructuredDiscretization(
top=200.0, bottom=bottom, idomain=idomain
)
gwf_model["chd"] = imod.mf6.ConstantHead(
head, print_input=True, print_flows=True, save_flows=True
)
simulation = imod.mf6.Modflow6Simulation("ex01-twri")
simulation["GWF_1"] = gwf_model
simulation.time_discretization(times=["2000-01-01", "2000-01-02"])
simulation.write(modeldir)
Authors
-------
This Python package was written primarily by Martijn Visser and Huite Bootsma at Deltares.
Expand Down
9 changes: 9 additions & 0 deletions imod/rasterio.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import glob
import pathlib
import warnings

import numpy as np
import xarray as xr
Expand Down Expand Up @@ -168,6 +169,14 @@ def _read(path, headersize, nrow, ncol, nodata, dtype):
return a


def read(path, use_cftime=False, pattern=None):
warnings.warn(
"The imod.rasterio.read() function is deprecated. Instead use imod.rasterio.open().",
FutureWarning,
)
return open(path, use_cftime=False, pattern=None).load()


def open(path, use_cftime=False, pattern=None):
r"""
Open one or more GDAL supported raster files as an xarray.DataArray.
Expand Down
21 changes: 14 additions & 7 deletions imod/select/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,22 @@

def upper_active_layer(da, is_ibound=True, include_constant_head=False):
"""
Function to get the upper active layer from ibound xr.DataArray
Function to get the upper active layer from ibound xarray.DataArray
Parameters:
da : 3d xr.DataArray
is_ibound: da is interpreted as ibound, with values 0 inactive, 1, active, -1 chd
if False: upper_active_layer is interpreted as upper layer that has data
include_constant_head : also incluse chd cells? bool, default False
Parameters
----------
da : xarray.DataArray
A 3D DataArray
is_ibound: bool, optional
If True, ``da`` is interpreted as ibound, with values 0: inactive, 1: active, -1 constant head.
If False, ``upper_active_layer`` is interpreted as first layer that has data.
Default is True.
include_constant_head : bool, optional
If True and ``is_ibound``, also include constant head cells.
Default is False.
Returns:
Returns
-------
2d xr.DataArray of layernumber of upper active model layer
"""
if is_ibound:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="imod",
description="Work with iMOD MODFLOW models",
description="Make massive MODFLOW models",
long_description=long_description,
url="https://gitlab.com/deltares/imod/imod-python",
author="Martijn Visser",
Expand Down Expand Up @@ -50,7 +50,7 @@
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Hydrology",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
Expand Down

0 comments on commit af93f66

Please sign in to comment.