pygeohydro.pygeohydro#
Accessing data from the supported databases through their APIs.
Module Contents#
- class pygeohydro.pygeohydro.EHydro(data_type='points', cache_dir='ehydro_cache')#
Access USACE Hydrographic Surveys (eHydro).
Notes
For more info visit: https://navigation.usace.army.mil/Survey/Hydro
- bygeom(geom, geo_crs=4326, sql_clause='', distance=None, return_m=False, return_geom=True)#
Get features within a geometry that can be combined with a SQL where clause.
- byids(field, fids, return_m=False, return_geom=True)#
Get features by object IDs.
- bysql(sql_clause, return_m=False, return_geom=True)#
Get features using a valid SQL 92 WHERE clause.
- Parameters:
data_type (
str
, optional) – Type of the survey data to retrieve, defaults topoints
. Note that thepoints
data type gets the best available point cloud data, i.e., ifSurveyPointHD
is available, it will be returned, otherwiseSurveyPoint
will be returned. Available types are:points
: Point cloudsoutlines
: Polygons of survey outlinescontours
: Depth contoursbathymetry
: Bathymetry data
Note that point clouds are not available for all surveys.
cache_dir (
str
orpathlib.Path
, optional) – Directory to store the downloaded raw data, defaults to./ehydro_cache
.
- property survey_grid: geopandas.GeoDataFrame#
Full survey availability on hexagonal grid cells of 35 km resolution.
- pygeohydro.pygeohydro.get_camels()#
Get streaflow and basin attributes of all 671 stations in CAMELS dataset.
Notes
For more info on CAMELS visit: https://ral.ucar.edu/solutions/products/camels
- Returns:
tuple
ofgeopandas.GeoDataFrame
andxarray.Dataset
– The first is basin attributes as ageopandas.GeoDataFrame
and the second is streamflow data and basin attributes as anxarray.Dataset
.- Return type:
- pygeohydro.pygeohydro.soil_gnatsgo(layers, geometry, crs=4326)#
Get US soil data from the gNATSGO dataset.
Notes
This function uses Microsoft’s Planetary Computer service to get the data. The dataset’s description and its supported soil properties can be found at: https://planetarycomputer.microsoft.com/dataset/gnatsgo-rasters
- Parameters:
layers (
list
ofstr
orstr
) – Target layer(s). Available layers can be found at the dataset’s website here.geometry (
Polygon
,MultiPolygon
, ortuple
oflength 4
) – Geometry or bounding box of the region of interest.crs (
int
,str
, orpyproj.CRS
, optional) – The input geometry CRS, defaults toepsg:4326
.
- Returns:
xarray.Dataset
– Requested soil properties.- Return type:
- pygeohydro.pygeohydro.soil_properties(properties='*', soil_dir='cache')#
Get soil properties dataset in the United States from ScienceBase.
Notes
This function downloads the source zip files from ScienceBase , extracts the included
.tif
files, and return them as anxarray.Dataset
.- Parameters:
properties (
list
ofstr
orstr
, optional) – Soil properties to extract, default to “*”, i.e., all the properties. Available properties areawc
for available water capacity,fc
for field capacity, andpor
for porosity.soil_dir (
str
orpathlib.Pathlib.Path
) – Directory to store zip files or if exists read from them, defaults to./cache
.
- pygeohydro.pygeohydro.soil_soilgrids(layers, geometry, geo_crs=4326)#
Get soil data from SoilGrids for the area of interest.
Notes
For more information on the SoilGrids dataset, visit ISRIC.
- Parameters:
layers (
list
ofstr
) – SoilGrids layers to get. Available options are:bdod_*
,cec_*
,cfvo_*
,clay_*
,nitrogen_*
,ocd_*
,ocs_*
,phh2o_*
,sand_*
,silt_*
, andsoc_*
where*
is the depth in cm and can be one of5
,15
,30
,60
,100
, or200
. For example,bdod_5
is the mean bulk density of the fine earth fraction at 0-5 cm depth, andbdod_200
is the mean bulk density of the fine earth fraction at 100-200 cm depth.geometry (
Polygon
,MultiPolygon
, ortuple
oflength 4
) – Geometry to get DEM within. It can be a polygon or a boundong box of form (xmin, ymin, xmax, ymax).geo_crs (
int
,str
,of pyproj.CRS
, optional) – CRS of the input geometry, defaults toepsg:4326
.
- Returns:
xarray.DataArray
– The request DEM at the specified resolution.- Return type:
- pygeohydro.pygeohydro.ssebopeta_bycoords(coords, dates, crs=4326)#
Daily actual ET for a dataframe of coords from SSEBop database in mm/day.
- Parameters:
coords (
pandas.DataFrame
) – A dataframe withid
,x
,y
columns.dates (
tuple
orlist
, optional) – Start and end dates as a tuple (start, end) or a list of years [2001, 2010, …].crs (
str
,int
, orpyproj.CRS
, optional) – The CRS of the input coordinates, defaults toepsg:4326
.
- Returns:
xarray.Dataset
– Daily actual ET in mm/day as a dataset withtime
andlocation_id
dimensions. Thelocation_id
dimension is the same as theid
column in the input dataframe.- Return type:
- pygeohydro.pygeohydro.ssebopeta_bygeom(geometry, dates, geo_crs=4326)#
Get daily actual ET for a region from SSEBop database.
Notes
Since there’s still no web service available for subsetting SSEBop, the data first needs to be downloaded for the requested period then it is masked by the region of interest locally. Therefore, it’s not as fast as other functions and the bottleneck could be the download speed.
- Parameters:
geometry (
shapely.Polygon
ortuple
) – The geometry for downloading clipping the data. For a tuple bbox, the order should be (west, south, east, north).dates (
tuple
orlist
, optional) – Start and end dates as a tuple (start, end) or a list of years [2001, 2010, …].geo_crs (
str
,int
, orpyproj.CRS
, optional) – The CRS of the input geometry, defaults toepsg:4326
.
- Returns:
xarray.DataArray
– Daily actual ET within a geometry in mm/day at 1 km resolution- Return type: