Skip to content
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

Move to pyproject.toml #170

Merged
merged 29 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
cc98281
move to pyproject.toml
dbrakenhoff May 1, 2023
125c8ed
forgot to include linting in ci install
dbrakenhoff May 1, 2023
6a853f5
fix
dbrakenhoff May 1, 2023
9978392
set correct netcdf version for gh actions
dbrakenhoff May 1, 2023
b61b20d
fix nb
dbrakenhoff May 2, 2023
17bd391
try to fix 'no such kernel' error in rtd
OnnoEbbens May 3, 2023
7bf05e7
revert change because of weird error
OnnoEbbens May 3, 2023
b8e227e
add methods:
dbrakenhoff May 1, 2023
c0770dd
add modelgrid_to_ds function
dbrakenhoff May 1, 2023
1b6488b
code formatting
dbrakenhoff May 1, 2023
224f8ba
improve x, y-origin calculation
dbrakenhoff May 1, 2023
8576c3c
codacy suggestion
dbrakenhoff May 1, 2023
8d242ca
some improvements:
dbrakenhoff May 8, 2023
c4ca68d
set gridgen_ws
dbrakenhoff May 8, 2023
f7b65ed
improve dealing with ssm packages
dbrakenhoff May 8, 2023
0de78bb
fix reading ascii file header if key is not in header
martinvonk May 2, 2023
ad39be6
Minor change in surface_water.py
rubencalje May 3, 2023
f1c920e
Knmi stations (#174)
rubencalje May 8, 2023
f931206
Knmi stations (#174)
rubencalje May 8, 2023
ae08bd1
update pyproject toml
dbrakenhoff May 9, 2023
d7d7f16
codacy
dbrakenhoff May 9, 2023
cbf54e6
Merge remote-tracking branch 'origin/dev' into pyproject_toml2
dbrakenhoff May 9, 2023
fc5839a
merge again...
dbrakenhoff May 9, 2023
9a970d9
modify dependency grouping for rtd
dbrakenhoff May 9, 2023
e42e066
add ipython
dbrakenhoff May 9, 2023
a9f6299
attempt to remove metadata
dbrakenhoff May 9, 2023
d271581
attempt to remove metadata
dbrakenhoff May 9, 2023
2bc181c
attempt to remove metadata
dbrakenhoff May 9, 2023
5312c0f
add ipykernel
dbrakenhoff May 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install pytest-cov
pip install pytest-dependency
pip install codacy-coverage
pip install -e .
pip install -e .[ci]

- name: Lint with flake8
run: |
Expand Down
8 changes: 6 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ sphinx:

# Optionally declare the Python requirements required to build your docs
python:
system_packages: true
install:
- requirements: docs/requirements.txt
- method: setuptools
- method: pip
path: .
extra_requirements:
- nbtest
- rtd

12 changes: 12 additions & 0 deletions docs/examples/00_model_from_scratch.ipynb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -35,6 +36,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -53,6 +55,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -78,6 +81,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -105,6 +109,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -121,6 +126,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -144,6 +150,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -173,6 +180,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -215,6 +223,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -231,6 +240,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -247,6 +257,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -276,6 +287,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down
3 changes: 2 additions & 1 deletion docs/examples/01_basic_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -49,7 +50,7 @@
"- a structured grid based on the subsurface models [Regis](https://www.dinoloket.nl/regis-ii-het-hydrogeologische-model) and [Geotop](https://www.dinoloket.nl/detaillering-van-de-bovenste-lagen-met-geotop). The Regis layers that are not present within the extent are removed. In this case we use 'MSz1' as the bottom layer of the model. Use `nlmod.read.regis.get_layer_names()` to get all the layer names of Regis. All Regis layers below this layer are not used in the model. Geotop is used to replace the holoceen layer in Regis because there is no kh or kv defined for the holoceen in Regis. Part of the model is in the North sea. Regis and Geotop have no data there. Therefore the Regis and Geotop layers are extrapolated from the shore and the seabed is added using bathymetry data from [Jarkus](https://www.openearth.nl/rws-bathymetry/2018.html).\n",
"- starting heads of 1 in every cell.\n",
"- the model is a steady state model of a single time step.\n",
"- big surface water bodies (Northsea, IJsselmeer, Markermeer, Noordzeekanaal) within the extent are added as a general head boundary. The surface water bodies are obtained from a [shapefile](..\\data\\opp_water.shp).\n",
"- big surface water bodies (Northsea, IJsselmeer, Markermeer, Noordzeekanaal) within the extent are added as a general head boundary. The surface water bodies are obtained from a [shapefile](..\\data\\shapes\\opp_water.shp).\n",
"- surface drainage is added using [ahn](https://www.ahn.nl) data and a default conductance of $1000 m^2/d$\n",
"- recharge is added using data from the [knmi](https://www.knmi.nl/nederland-nu/klimatologie/daggegevens) using the following steps:~~\n",
" 1. Check for each cell which KNMI weather and/or rainfall station is closest.\n",
Expand Down
16 changes: 1 addition & 15 deletions docs/examples/03_local_grid_refinement.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -399,22 +399,8 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "artesia",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"name": "python"
}
},
"nbformat": 4,
Expand Down
16 changes: 1 addition & 15 deletions docs/examples/11_grid_rotation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -358,22 +358,8 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "artesia",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"name": "python"
}
},
"nbformat": 4,
Expand Down
16 changes: 1 addition & 15 deletions docs/examples/16_groundwater_transport.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -553,22 +553,8 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "artesia",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"name": "python"
}
},
"nbformat": 4,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion nlmod/dcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def plot_grid(
horizontal=True,
vertical=True,
ilayers=None,
**kwargs
**kwargs,
):
lines = []
if ilayers is None:
Expand Down
2 changes: 1 addition & 1 deletion nlmod/dims/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import logging
import os
import warnings
import os

import flopy
import geopandas as gpd
import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion nlmod/read/geotop.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def convert_geotop_to_ml_layers(
lay = 0
logger.info("creating top and bot per geo eenheid")
for geo_eenheid in geo_eenheden:
logger.debug(geo_eenheid)
logger.debug(int(geo_eenheid))

mask = geotop_ds_raw.strat == geo_eenheid
geo_z = xr.where(mask, geotop_ds_raw.z, np.NaN)
Expand Down
2 changes: 1 addition & 1 deletion nlmod/read/knmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import logging

import hydropandas as hpd
from hydropandas.io import knmi as hpd_knmi
import numpy as np
import pandas as pd
from hydropandas.io import knmi as hpd_knmi

from .. import cache, util
from ..dims.layers import get_first_active_layer
Expand Down
2 changes: 1 addition & 1 deletion nlmod/read/meteobase.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def read_ascii(fo: FileIO) -> Union[np.ndarray, dict]:
line_cnt = 0
for line in lines:
linestr = str(line, encoding="utf-8").lower()
if not any([x for x in ascii_header_keys if x in str(linestr)]):
if not any((x for x in ascii_header_keys if x in str(linestr))):
break
l1, l2 = linestr.split()
if l1.lower() in ("ncols", "nrows", "nodata_value"):
Expand Down
6 changes: 3 additions & 3 deletions nlmod/read/rws.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def get_gdf_surface_water(ds):
surface water geodataframe.
"""
# laad bestanden in
fname = os.path.join(nlmod.NLMOD_DATADIR, "opp_water.shp")
fname = os.path.join(nlmod.NLMOD_DATADIR, "shapes", "opp_water.shp")
gdf_swater = gpd.read_file(fname)
extent = dims.get_extent(ds)
gdf_swater = util.gdf_within_extent(gdf_swater, extent)
Expand Down Expand Up @@ -135,9 +135,9 @@ def get_northsea(ds, da_name="northsea"):
def add_northsea(ds, cachedir=None):
"""Add datavariable bathymetry to model dataset.

Performs the following steps:
Performs the following steps:

a) get cells from modelgrid that are within the northsea, add data
a) get cells from modelgrid that are within the northsea, add data
variable 'northsea' to ds
b) fill top, bot, kh and kv add northsea cell by extrapolation
c) get bathymetry (northsea depth) from jarkus.
Expand Down
1 change: 1 addition & 0 deletions nlmod/read/webservices.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
import xml.etree.ElementTree as ET
from io import BytesIO

import geopandas as gpd
import numpy as np
import pandas as pd
Expand Down
88 changes: 88 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
[build-system]
requires = ["setuptools>=64.0.0", "wheel"]
build-backend = "setuptools.build_meta"


[project]
name = "nlmod"
dynamic = ["version"]
description = "nlmod is an open-source Python package for building Modflow 6 groundwater models from online data sources in The Netherlands"
license = { file = "LICENSE" }
readme = "README.md"
authors = [
{ name = "O. Ebbens" },
{ name = "R. Caljé" },
{ name = "D.A. Brakenhoff" },
]
maintainers = [
{ name = "O. Ebbens", email = "o.ebbens@artesia-water.nl" },
{ name = "R. Calje", email = "r.calje@artesia-water.nl" },
{ name = "D.A. Brakenhoff", email = "d.brakenhoff@artesia-water.nl" },
]
requires-python = ">= 3.8"
dependencies = [
"flopy>=3.3.6",
"xarray>=0.16.1",
"netcdf4>=1.5.7",
"rasterio>=1.1.0",
"rioxarray",
"affine>=0.3.1",
"geopandas",
"owslib>=0.24.1",
"hydropandas>=0.7.1",
"shapely>=2.0.0",
"pyshp>=2.1.3",
"matplotlib",
"dask",
"colorama",
]
keywords = ["hydrology", "groundwater", "modeling", "Modflow 6", "flopy"]
classifiers = [
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'Intended Audience :: Other Audience',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Topic :: Scientific/Engineering :: Hydrology',
]

[project.urls]
homepage = "https://github.com/ArtesiaWater/nlmod"
repository = "https://github.com/ArtesiaWater/nlmod"
documentation = "https://nlmod.readthedocs.io/en/latest/"

[project.optional-dependencies]
full = ["gdown", "geocube", "gdown", "bottleneck", "contextily"]
test = ["pytest>=7", "pytest-cov", "pytest-dependency"]
nbtest = ["nbformat", "nbconvert>6.4.5"]
lint = ["flake8", "isort", "black[jupyter]"]
ci = ["nlmod[full,lint,test,nbtest]", "netCDF4==1.5.7"]
rtd = ["ipython", "ipykernel", "nbsphinx", "nbconvert>6.4.5"]

[tool.setuptools.dynamic]
version = { attr = "nlmod.version.__version__" }

[tool.setuptools.packages.find]
where = ["."]

[tool.setuptools]
include-package-data = true

[tool.setuptools.package-data]
"nlmod.data" = ["*.gleg"]
"nlmod.data.geotop" = ["*.csv"]
"nlmod.data.shapes" = ["*"]

[tool.black]
line-length = 88

[tool.isort]
profile = "black"

[tool.pytest.ini_options]
addopts = "--strict-markers --durations=0"
markers = ["notebooks: run notebooks"]

Loading