loadest_gp.providers.usgs#
Helper functions for pulling USGS data.
Functions
|
Format results of dataretrieval.nwis.get_dv. |
|
Reformat date from 'YYYY-MM-DD' to 'MM-DD-YYYY'. |
|
Format results of dataretrieval.wqp.get_results. |
|
Get daily data from the USGS NWIS API. |
|
Get site metadata from the USGS NWIS API. |
|
Get USGS parameters from a list of parameter codes. |
|
Get sample data from the USGS NWIS API. |
|
Get sample data from the Water Quality Portal API. |
Classes
|
- class loadest_gp.providers.usgs.USGSParameter(pcode: 'str', standard_name: 'str', long_name: 'Optional[str]' = '', units: 'Optional[str]' = '', suffix: 'Optional[str]' = '', conversion: 'Optional[float]' = 1.0)#
- property name#
Alias for standard_name.
- property ppcode#
Return the parameter code with a ‘p’ prefix, which is used by the QWData service.
- loadest_gp.providers.usgs.format_nwis_daily(df: DataFrame, site_id: str | None = None, params: List[USGSParameter] | USGSParameter = [USGSParameter(pcode='00060', standard_name='flow', long_name='Streamflow', units='cubic meters per second', suffix='_Mean', conversion=0.0283168)]) Dataset #
Format results of dataretrieval.nwis.get_dv.
- Parameters:
df (DataFrame) – Dataframe returned from dataretrieval.nwis.get_dv.
site_id (str, optional) – USGS site number for populating metadata. The default is None.
params (List[USGSParameter], optional) – List of parameters to retrieve. The default is flow only [USGSFlow].
- loadest_gp.providers.usgs.format_wqp_date(date: str) str #
Reformat date from ‘YYYY-MM-DD’ to ‘MM-DD-YYYY’.
- loadest_gp.providers.usgs.format_wqp_samples(df: DataFrame, name: str = 'concentration', pcode: str | None = None) Dataset #
Format results of dataretrieval.wqp.get_results.
- Parameters:
df (DataFrame) – Dataframe returned from dataretrieval.wqp.get_results.
name (str) – Short name for the parameter. Default is ‘concentration’.
pcode (str) – USGS parameter code for populating metadata.
- Return type:
Dataset
- loadest_gp.providers.usgs.get_daily(site: str, start_date: str, end_date: str, params: List[USGSParameter] | USGSParameter = USGSParameter(pcode='00060', standard_name='flow', long_name='Streamflow', units='cubic meters per second', suffix='_Mean', conversion=0.0283168), **kwargs) Dataset #
Get daily data from the USGS NWIS API.
- Parameters:
site (str) – USGS site number.
start_date (str) – Start date in the format ‘yyyy-mm-dd’.
end_date (str) – End date in the format ‘yyyy-mm-dd’.
params (List[USGSParameter], optional) – List of parameters to retrieve. The default is flow only [USGSFlow].
kwargs (Dict) – Additional keyword arguments to pass to the NWIS API.
- Returns:
Dataset with the requested data.
- Return type:
Dataset
- loadest_gp.providers.usgs.get_metadata(site: str) MetaData #
Get site metadata from the USGS NWIS API.
- Parameters:
site (str) – USGS site number.
- Returns:
Dataframe with the site information.
- Return type:
pandas.DataFrame
- loadest_gp.providers.usgs.get_parameters(pcodes: Dict[str, str]) USGSParameter | List[USGSParameter] #
Get USGS parameters from a list of parameter codes.
- Parameters:
pcodes (List[str]) – List of USGS parameter codes.
- Returns:
List of USGS parameters.
- Return type:
List[USGSParameter]
- loadest_gp.providers.usgs.get_qwdata_samples(site: str, start_date: str, end_date: str, pcode: str, name: str = 'concentration') Dataset #
Get sample data from the USGS NWIS API.
WARNING: The QWData service is deprecated and no longer receives data.
- Parameters:
site (str) – USGS site number.
start_date (str) – Start date in the format ‘yyyy-mm-dd’.
end_date (str) – End date in the format ‘yyyy-mm-dd’.
pcode (str) – USGS parameter to retrieve.
name (str) – Short name for the parameter.
- Returns:
Dataframe with the requested sample data.
- Return type:
pandas.DataFrame
- loadest_gp.providers.usgs.get_samples(site: str, start_date: str, end_date: str, characteristic: str, fraction: str, provider: str = 'NWIS', name: str = 'concentration', filter_pcodes: List[str] | None = None, **kwargs) Dataset #
Get sample data from the Water Quality Portal API.
- Parameters:
site (str) – Water Quality Portal site id; e.g., ‘USGS-12345678’.
start_date (str) – Start date in the format ‘YYYY-MM-DD’.
end_date (str) – End date in the format ‘YYYY-MM-DD’.
characteristic (str) – The name of the parameter to retrieve.
fraction (str) – The fraction of the parameter to retrieve. Options are ‘Total’, ‘Dissolved’, ‘Suspended’.
provider (str) – The data provider. Options are ‘NWIS’ or ‘STORET’.
name (str) – Short name for the parameter. Default is ‘concentration’.
filter_pcodes (List[str]) – List of parameter codes to filter the dataset.
kwargs (Dict) – Additional keyword arguments to pass to the WQP API.