Skip to main content

hf_hydrodata

Python component to access data in the hydrodata hydrology file share.

Installation

The best way to install hf_hydrodata is using pip. This installs our latest stable release with fully-supported features:

pip install hf_hydrodata

Documentation

You can view the documentation at ReadTheDocs.

Usage

You can use hf_hydrodata to get access to both gridded and point observation data from various datasets available in hy_hydrodata.

You can view the available datasets and variables from the documentation or you can get the list of dataset and variables from functions.

import hf_hydrodata as hf

datasets = hf.get_datasets()
variables = hf_get_variables()

variables = hf.get_variables("dataset": "NLDAS2", "grid": "conus1")

You can get gridded data using the get_gridded_data() function.

import hf_hydrodata as hf

options = {
  "dataset": "NLDAS2", "variable": "precipitation", "period": "hourly",
  "start_time": "2005-10-1", "end_time": "2005-10-2", "grid_bounds": [100, 100, 200, 200]
}
data = hf.get_gridded_data(options)

You can use the point module to read site-level observations data from the hydrodata repository to get a pandas DataFrame.

hf_hydrodata supports access to a collection of site-level data from a variety of sources.

The below syntax will return daily USGS streamflow data from January 1, 2022 through January 5, 2022 for sites that are within the bounding box with latitude bounds of (45, 50) and longitude bounds of (-75, -50).

# Import package
from hf_hydrodata.point import get_data, get_metadata

# Define filters and return as pandas DataFrame
data_source = 'usgs_nwis'
variable = 'streamflow'
temporal_resolution = 'daily'
aggregation = 'average'

data = get_data(data_source, variable, temporal_resolution, aggregation,
                start_date="2022-01-01", end_date="2022-01-05", 
                latitude_range = (45, 50),
                longitude_range = (-75, -50))
data.head(5)

# Get the metadata about the sites with returned data
metadata = get_metadata(data_source, variable, temporal_resolution, aggregation,
                        start_date="2022-01-01", end_date="2022-01-05", 
                        latitude_range = (45, 50),
                        longitude_range = (-75, -50))
metadata.head(5)

Build Instructions

To build the component you must have a python virtual environment containing the required components. Install the required components with:

pip install -r requirements.txt

Edit the python components in src/hf_hydrodata and the unit tests in tests/hf_hydrodata and the data catalog model CSV files in src/hf_hydrodata/model. Use Excel to edit the CSV files so that files are saved in standard CSV format.

Generate the documentation with:

cd docs
make html

This will validate the model CSV files and generate the read-the-docs html into the html folder.

License

Copyright © 2023 The Trustees of Princeton University and The Arizona Board of Regents on behalf of The University of Arizona. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted for academic and research use only (subject to the limitations in the disclaimer below) provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. NO COMMERCIAL USE IS PERMITTED UNDER THIS LICENSE.

hf_hydrodata was created by William M. Hasling, Laura Condon, Reed Maxwell, George Artavanis, Will Lytle, Amy M. Johnson, Amy C. Defnet. It is licensed under the terms of the MIT license.

Data Use Policy

The software is licenced under MIT licence, but the data is controlled by a Data Use Policy.

Release files for hf-hydrodata 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hf-hydrodata 1.0.0
File Size Uploaded
hf_hydrodata-1.0.0.tar.gz 71.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hf-hydrodata 1.0.0
File Interpreter ABI Platform
hf_hydrodata-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 147.6 kB

Release files / hf_hydrodata-1.0.0.tar.gz

Download URL hf_hydrodata-1.0.0.tar.gz
Size 71.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c330c19d47d89e02813440fa2bfbb1bc0e96243d243bcddfb1d90cb522f7cecf
BLAKE2b-256 checksum
How to use checksums
c2186dada2e6ba67e44198cb8d4e190a7eace546083567869b35671d44efc092
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.7

Release files / hf_hydrodata-1.0.0-py3-none-any.whl

Download URL hf_hydrodata-1.0.0-py3-none-any.whl
Size 76.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
08780c81ce2bb0721c101f4d498678225a56d13f63819ccdfe73e09a27a07462
BLAKE2b-256 checksum
How to use checksums
105a0cee521804df9155904d430fadfa7fc9dee12678f4461cc6115ada3b2e71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.7

Release history Release notifications | RSS feed

1.4.12

2 release files

1.4.7

2 release files

1.4.6

2 release files

1.4.5

2 release files

1.4.4

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.3.55

2 release files

1.3.50

2 release files

1.3.49

2 release files

1.3.40

2 release files

1.3.37

2 release files

1.3.35

2 release files

1.3.30

2 release files

1.3.29

2 release files

1.3.27

2 release files

1.3.26

2 release files

1.3.12

2 release files

1.3.11

2 release files

1.3.9

2 release files

1.3.8

2 release files

1.3.7

2 release files

1.3.6

2 release files

1.2.7

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.0

2 release files

1.1.19

2 release files

1.1.18

2 release files

1.1.13

2 release files

1.1.11

2 release files

1.1.9

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.4

2 release files

1.1.0

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

This release

1.0.0 This release

2 release files

0.9.43

2 release files

0.9.39

2 release files

0.9.36

2 release files

0.9.35

2 release files

0.9.33

2 release files

0.9.21

2 release files

0.9.7

2 release files

0.9.6

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page