Skip to main content

Module by Artesia for loading observation data into custom DataFrames.

Project description

Artesia

PyPi PyPi Supported Python Versions Binder

hydropandas Codacy Badge Codacy Badge Documentation Status

Format: isort Format: Black Linter: flake8 Linter: ruff

hydropandas

The HydroPandas package allows users to store observation data at multiple locations in a single object (ObsCollection). An ObsCollection is a pandas DataFrame extended with custom methods and attributes related to hydrological timeseries. The HydroPandas package also provides convenient read functions for Dutch hydrological data from:

Installation

Install the module with pip:

pip install hydropandas

Hydropandas requires numpy, scipy, matplotlib, pandas, requests and zeep.

For some functionality additional packages are required:

  • geopandas: for dealing with shapefiles
  • pastastore: for reading or storing data from PastaStore
  • bokeh, branca, folium: for interactive maps
  • flopy: for reading data from MODFLOW models
  • xarray: for loading data from REGIS

For installing in development mode, clone the repository and install by typing pip install -e . from the module root directory. For installing all the optional packages use pip install -e .[full]

If you have trouble installing HydroPandas, refer to the Dependencies section below.

Example usage

Importing a single DINO csv file:

import hydropandas as hpd
fname = './tests/data/2019-Dino-test/Grondwaterstanden_Put/B33F0080001_1.csv'
gw = hpd.GroundwaterObs.from_dino(fname=fname)

Or for a zipfile:

import hydropandas as hpd
dinozip = './tests/data/2019-Dino-test/dino.zip'
dino_gw = hpd.read_dino(dirname=dinozip,
			subdir='Grondwaterstanden_Put',
                        suffix='1.csv',
                        ObsClass=hpd.GroundwaterObs,
                        keep_all_obs=False)

The Obs class

The Obs class holds the measurements and metadata for one timeseries. There are currently 5 specific Obs classes for different types of measurements:

  • GroundwaterObs: for groundwater measurements
  • GroundwaterQualityObs: for groundwater quality measurements
  • WaterlvlObs: for surface water level measurements
  • ModelObs: for "observations" from a MODFLOW model
  • MeteoObs: for meteorological observations
  • PrecipitationObs: for precipitation observations, subclass of MeteoObs
  • EvaporationObs: for evaporation observations, subclass of MeteoObs

Each of these Obs classes is essentially a pandas DataFrame with additional methods and attributes related to the type of measurement that it holds. The classes also contain specific methods to read data from specific sources.

The ObsCollection class

The ObsCollection class, as the name implies, represents a collection of Obs classes, e.g. 10 timeseries of the groundwater level in a certain area. The ObsCollection is also a pandas DataFrame in which each timeseries is stored in a different row. Each row contains metadata (e.g. latitude and longitude of the observation point) and the Obs object (DataFrame) that holds the measurements. It is recommended to let an ObsCollection contain only one Obs type, e.g. to create an ObsCollection for 10 GroundwaterObs, and a separate ObsCollection for 5 PrecipitationObs.

Like the Obs class, the ObsCollection class contains a bunch of methods for reading data from different sources. See the next section for supported data sources.

Dependencies

Hydropandas (indirectly) uses some packages that cannot be installed automatically with pip on Windows. These packages are:

  • GDAL
  • Fiona
  • Shapely

If you do not have these packages already it is recommended to first try installing them with conda install <pkg>. Otherwise, read the instructions below how to install them manually.

Download the packages from Christoph Gohlke's website. Use CTRL+F to find the download link on the page. Be sure to download the correct version of the package. The Python version should match your Python version. Also the architecture should match (i.e. 64bits vs 32bits). For example:

  • GDAL-3.1.4-cp38-cp38-win_amd64.whl

This is the GDAL version for Python 3.8 (as can be seen from the cp38 in the name), for 64-bits Python (as derived from the amd64 in the name).

Once you have downloaded the correct files, navigate to the directory in which you saved your downloads. Now type the following commands (the order is important):

  1. pip install GDAL-3.1.4-cp38-cp38-win_amd64.whl
  2. pip install Fiona-1.8.17-cp38-cp38-win_amd64.whl
  3. pip install Shapely-1.7.1-cp38-cp38-win_amd64.whl

After you've done this you can install hydropandas using pip install hydropandas.

Authors

  • Onno Ebbens, Artesia
  • Ruben Caljé, Artesia
  • Davíd Brakenhoff, Artesia
  • Martin Vonk, Artesia

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hydropandas-0.7.2.tar.gz (110.8 kB view details)

Uploaded Source

Built Distribution

hydropandas-0.7.2-py3-none-any.whl (108.3 kB view details)

Uploaded Python 3

File details

Details for the file hydropandas-0.7.2.tar.gz.

File metadata

  • Download URL: hydropandas-0.7.2.tar.gz
  • Upload date:
  • Size: 110.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for hydropandas-0.7.2.tar.gz
Algorithm Hash digest
SHA256 81e5067333db537e235b6b3c382c5aee1f14be974bdf572cf8f0f65ddcb3069e
MD5 bef9fb39922eaa55a045e30883305ab0
BLAKE2b-256 78f43b7e6afd79f84a4ac3809eca89dc38e4b5d658380e36e7a48148582aa2f1

See more details on using hashes here.

File details

Details for the file hydropandas-0.7.2-py3-none-any.whl.

File metadata

  • Download URL: hydropandas-0.7.2-py3-none-any.whl
  • Upload date:
  • Size: 108.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for hydropandas-0.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bfc66272f528e44c128965fbe26a43402527c966d719dd4eba0b723105293b53
MD5 c390ab0e56ce2d22631a77ef702a65a1
BLAKE2b-256 23f647844bf73c24910527e244b789cd00c161f6a312a3412444ff0433feb6c1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page