hf_hydrodata
hf_hydrodata: A Python package for accessing hydrologic simulations and observations across the United States - Published in JOSS (2024)
Science Score: 95.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 4 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org -
✓Committers with academic emails
4 of 9 committers (44.4%) from academic institutions -
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Scientific Fields
Repository
Basic Info
- Host: GitHub
- Owner: hydroframe
- License: other
- Language: Python
- Default Branch: main
- Size: 4.65 MB
Statistics
- Stars: 8
- Watchers: 6
- Forks: 1
- Open Issues: 0
- Releases: 33
Metadata Files
README.md
hf_hydrodata
The hf_hydrodata Python package is a product of the HydroFrame project and is designed to provide easy access to national hydrologic simulations generated using the National ParFlow model (ParFlow-CONUS1 and ParFlow-CONUS2) as well as a variety of other gridded model
input datasets and point observations. Some of the datasets provided here are direct observations
(e.g. USGS streamflow observations) while other are model outputs (e.g. ParFlow-CONUS2) or data products
(e.g. remote sensing products).
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
Users must create a HydroFrame API account and register their PIN before using the hf_hydrodata package. Please see Creating a HydroFrame API Account for detailed instructions.
Documentation
You can view the full package documentation on Read the Docs. Please see our Python API Reference for detail on each core method.
Usage
You can use hf_hydrodata to get access to both gridded and point observation data from various
datasets.
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({"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)
hf_hydrodata supports access to a collection of site-level data from a variety of sources using the get_point_data() function.
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).
from hf_hydrodata import get_point_data, get_point_metadata
data_df = get_point_data(
dataset = "usgs_nwis",
variable = "streamflow",
temporal_resolution = "daily",
aggregation = "mean",
date_start = "2022-01-01",
date_end = "2022-01-05",
latitude_range = (45, 50),
longitude_range = (-75, -50)
)
data_df.head(5)
# Get the metadata about the sites with returned data
metadata_df = get_point_metadata(
dataset = "usgs_nwis",
variable = "streamflow",
temporal_resolution = "daily",
aggregation = "mean",
date_start = "2022-01-01",
date_end = "2022-01-05",
latitude_range = (45, 50),
longitude_range = (-75, -50)
)
metadata_df.head(5)
Please see the How To section of our documentation for in-depth examples using the point module functions. Additionally, our team has developed the subsettools Python package which uses hf_hydrodata to access data and subsequently run a ParFlow simulation. Please see the subsettools documentation for full walk-through examples of extracting data for a domain and subsequently running a ParFlow simulation.
State of the Field
The hf_hydrodata package spans multiple agencies, and includes both site-level observations and national gridded datasets. This allows users to interact with data from many sources with a single API call. Existing packages such as the dataRetrieval R package provide some similar capabilities allowing users to access a breadth of hydrologic site-level surface water and groundwater observations from the USGS. However, the dataRetreival package is limited to USGS sources and is designed for R users. Our package goes beyond this to provide access to data from multiple agencies (for example the SNOTEL and FluxNet observation networks). The hf_hydrodata package provides a common syntax for acquiring such observations so that the user need not spend valuable research time learning multiple syntaxes to get all data relevant for their watershed. Additionally, the hf_hydrodata package provides users access to a wide selection of gridded data products. Many of these data products are not publicly available by other means including inputs and outputs from the national ParFlow model and multiple gridded atmospheric forcing datasets.
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.
Generate the documentation with:
cd docs
make html
This will generate the read-the-docs html into the html folder.
Testing
Our tests are located within the tests/hf_hydrodata directory of this repository.
To run the tests, you must first create and register a HydroFrame account.
Then set up a Python virtual environment and install the necessary components:
# Install package requirements
pip install -r requirements.txt
# Install local version of repo for package metadata
pip install -e .
Then run the tests from the root directory with pytest. Note that some of our tests deal with datasets that are currently private to our internal research team. To run all of the tests that do not utilize those datasets, you may run pytest with the following options.
pytest tests/hf_hydrodata -m "not private_dataset"
The full test suite is run automatically via GitHub Actions with each new Pull Request and subsequent commits.
License
Copyright © 2024 The Trustees of Princeton University and The Arizona Board of Regents on behalf of The University of Arizona, College of Science Hydrology & Atmospheric Sciences. All rights reserved.
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. For details, see the LICENSE file.
Data Use Policy
The software is licenced under MIT licence, but the data is controlled by a Data Use Policy.
Report an Issue
If you have a question about our code or find an issue, please create a GitHub Issue with enough information for us to reproduce what you are seeing.
Contribute
If you would like to contribute to hf_hydrodata, please open a GitHub Issue with a description of your plan to initiate a conversation with our development team. Then detailed implementation review will be done via a Pull Request.
Owner
- Name: HydroFrame
- Login: hydroframe
- Kind: organization
- Website: https://www.hydroframe.org/
- Repositories: 9
- Profile: https://github.com/hydroframe
JOSS Publication
hf_hydrodata: A Python package for accessing hydrologic simulations and observations across the United States
Authors
Research Software Engineering, Princeton University, USA, Integrated GroundWater Modeling Center, Princeton University, USA
Research Software Engineering, Princeton University, USA, Integrated GroundWater Modeling Center, Princeton University, USA
Department of Hydrology and Atmospheric Sciences, University of Arizona, USA, CyVerse, USA
Research Software Engineering, Princeton University, USA, Integrated GroundWater Modeling Center, Princeton University, USA
Department of Hydrology and Atmospheric Sciences, University of Arizona, USA
Tags
hydrologyGitHub Events
Total
- Create event: 48
- Issues event: 2
- Release event: 5
- Watch event: 3
- Delete event: 14
- Issue comment event: 6
- Push event: 126
- Pull request review comment event: 12
- Pull request review event: 37
- Pull request event: 56
- Fork event: 1
Last Year
- Create event: 48
- Issues event: 2
- Release event: 5
- Watch event: 3
- Delete event: 14
- Issue comment event: 6
- Push event: 126
- Pull request review comment event: 12
- Pull request review event: 37
- Pull request event: 56
- Fork event: 1
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Bill Hasling | 9****8 | 150 |
| Amy Defnet | 7****t | 67 |
| amymjohnson4000 | a****0@g****m | 21 |
| Will Lytle | w****8@d****u | 9 |
| reedmaxwell | r****l@p****u | 4 |
| George Artavanis | g****6@v****u | 4 |
| Laura Condon | l****n@e****u | 2 |
| gartavanis | 3****s | 1 |
| Will Lytle | 1****e | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 9
- Total pull requests: 231
- Average time to close issues: 2 months
- Average time to close pull requests: about 18 hours
- Total issue authors: 4
- Total pull request authors: 5
- Average comments per issue: 0.78
- Average comments per pull request: 0.19
- Merged pull requests: 214
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 59
- Average time to close issues: 5 months
- Average time to close pull requests: 2 days
- Issue authors: 1
- Pull request authors: 2
- Average comments per issue: 1.0
- Average comments per pull request: 0.25
- Merged pull requests: 52
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- wh3248 (5)
- amy-defnet (3)
- thodson-usgs (2)
- edsaac (1)
Pull Request Authors
- wh3248 (155)
- amy-defnet (108)
- amymjohnson4000 (18)
- welytle (5)
- gartavanis (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- black >=23.3.0 develop
- pylint >=2.13.7 develop
- pytest-mock >=3.10.0 develop
- sphinx >=6.1.3 develop
- sphinx-rtd-theme >=1.2.0 develop
- sphinxcontrib-napoleon >=0.7 develop
- importlib-resources >=5.10.0
- netcdf4 >=1.6.0
- numpy >=1.22.1
- pftools >=1.3.7
- pyproj >=3.5.0
- python ^3.8
- requests >=2.28.2
- rioxarray >=0.13.4
- scipy >=1.10.0
- xarray >=0.21.0
- black >=23.3.0
- dask >=2022.5.1
- importlib-resources >=5.10.0
- netcdf4 >=1.6.0
- numpy >=1.22.1
- pandas >=1.3.5
- pftools >=1.3.7
- pip >=22.0.3
- pylint >=2.13.7
- pyproj >=3.5.0
- pytest >=7.3.1
- pytest-mock >=3.10.0
- requests >=2.28.2
- rioxarray >=0.13.4
- scikit-learn >=1.2.1
- scipy >=1.10.0
- sphinx >=6.1.3
- sphinx-rtd-theme >=1.2.0
- sphinxcontrib-napoleon >=0.7
- xarray >=0.21.0