metloom.pointdata package¶
Submodules¶
metloom.pointdata.base module¶
- class metloom.pointdata.base.GenericPoint(station_id, name, metadata=None)[source]¶
Bases:
objectClass for storing metadata. and defining the expected data format returned from get_data methods
- ALLOWED_VARIABLES¶
alias of
VariableBase
- DATASOURCE = None¶
- EXPECTED_COLUMNS = ['geometry', 'datasource']¶
- EXPECTED_INDICES = ['datetime', 'site']¶
- ITERATOR_CLASS¶
alias of
PointDataCollection
- NON_VARIABLE_COLUMNS = ['datetime', 'site', 'geometry', 'datasource']¶
- property metadata¶
metadata property Returns:
shapely.point.Point object in Longitude, Latitude with z in ft
- property tzinfo¶
tzinfo that pandas can use for tz_localize
- class metloom.pointdata.base.PointData(station_id, name, metadata=None)[source]¶
Bases:
GenericPointExtend GenericPoint and add functions for finding data from geometry and for gettings daily, hourly, or snow course data
- POINTS_FROM_GEOM_DEFAULTS = {'buffer': 0.0, 'filter_to_active': False, 'snow_courses': False, 'within_geometry': True}¶
- get_daily_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get daily measurement data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- get_hourly_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get hourly measurement data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- get_snow_course_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get snow course data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- classmethod points_from_geometry(geometry: GeoDataFrame, variables: List[SensorDescription], snow_courses=False, within_geometry=True, buffer=0.0)[source]¶
Find a collection of points with measurements for certain variables contained within a shapefile. Any point in the shapefile with measurements for any of the variables should be included Args:
geometry: GeoDataFrame for shapefile from gpd.read_file variables: List of SensorDescription snow_courses: boolean for including only snowcourse data or no
snowcourse data
- within_geometry: filter the points to within the shapefile
instead of just the extents. Default True
buffer: buffer added to search box
- Returns:
PointDataCollection
- class metloom.pointdata.base.PointDataCollection(points: List[object] | None = None)[source]¶
Bases:
objectIterator class for a collection of PointData objects. This allows conversion to a GeoDataFrame
metloom.pointdata.cdec module¶
- class metloom.pointdata.cdec.CDECPointData(station_id, name, metadata=None)[source]¶
Bases:
PointDataImplement PointData methods for CDEC data source API documentation here https://cdec.water.ca.gov/dynamicapp/
- ALLOWED_VARIABLES¶
alias of
CdecStationVariables
- CDEC_URL = 'http://cdec.water.ca.gov/dynamicapp/req/JSONDataServlet'¶
- DATASOURCE = 'CDEC'¶
- META_URL = 'https://cdec.water.ca.gov/dynamicapp/req/CSVMetaDataServlet'¶
- get_daily_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_daily_data Example query: https://cdec.water.ca.gov/dynamicapp/req/JSONDataServlet? Stations=TNY&SensorNums=3&dur_code=D&Start=2021-05-16&End=2021-05-16
- get_event_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
- get_hourly_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_hourly_data
- get_snow_course_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_snow_course_data
- is_only_snow_course(variables: List[SensorDescription])[source]¶
Determine if a station only has snow course measurements
- is_partly_snow_course()[source]¶
Determine if any of the snow sensors at a station are on a monthly interval Assumption: Monthly snow sensor measurements are snow courses
- classmethod points_from_geometry(geometry: GeoDataFrame, variables: List[SensorDescription], **kwargs)[source]¶
See docstring for PointData.points_from_geometry
- Args:
geometry: GeoDataFrame for shapefile from gpd.read_file variables: List of SensorDescription snow_courses: Boolean for including only snowcourse data or no snowcourse data within_geometry: filter the points to within the shapefile instead of just the extents. Default True buffer: buffer added to search box
- Returns:
PointDataCollection
metloom.pointdata.csas module¶
Data reader for the Center for Snow and Avalanche Studies
- class metloom.pointdata.csas.CSASMet(station_id, name=None, metadata=None, cache='./cache')[source]¶
Bases:
CSVPointData- ALLOWED_STATIONS¶
alias of
CSASStationInfo
- ALLOWED_VARIABLES¶
alias of
CSASVariables
- CURRENT_AVAILABLE_YEAR = 2024¶
- DATASOURCE = 'CSAS'¶
- DOI = ''¶
- URL = 'https://snowstudies.org/wp-content/uploads/'¶
- UTC_OFFSET_HOURS = -7¶
- class metloom.pointdata.csas.CSASStationInfo(value)[source]¶
Bases:
StationInfoAn enumeration.
- PUTNEY = ('Putney Study Plot', 'PTSP', 37.89233, -107.69577, 12323, '2025/05/PTSP_1hr.csv')¶
- SENATOR_BECK = ('Senator Beck Study Plot', 'SBSP', 37.90688, -107.72627, 12186, '2023/11/SBSP_1hr_2003-2009.csv')¶
- SENATOR_BECK_STREAM_GAUGE = ('Senator Beck Stream Gauge', 'SBSG', 37.90678, -107.70943, 11030, '2025/05/SBSG_1hr.csv')¶
- SWAMP_ANGEL = ('Swamp Angel Study Plot', 'SASP', 37.90691, -107.71132, 11060, '2023/11/SASP_1hr_2003-2009.csv')¶
metloom.pointdata.cues module¶
A reader for the Mammoth CUES site https://snow.ucsb.edu/index.php/description/
- class metloom.pointdata.cues.CuesLevel1(station_id, name, metadata=None)[source]¶
Bases:
PointDataImplement PointData methods for CUES level 1 data https://snow.ucsb.edu/index.php/description/ https://snow.ucsb.edu/index.php/query-db/ https://doi.org/10.21424/R4159Q
- ALLOWED_VARIABLES¶
alias of
CuesLevel1Variables
- DATASOURCE = 'UCSB CUES'¶
- URL = 'https://snow.ucsb.edu/index.php/query-db/'¶
- get_daily_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get daily measurement data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- get_hourly_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get hourly measurement data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- get_snow_course_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get snow course data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- property metadata¶
Hardcode the metadata
- points_from_geometry(geometry: GeoDataFrame, variables: List[SensorDescription], snow_courses=False, within_geometry=True, buffer=0.0)[source]¶
Find a collection of points with measurements for certain variables contained within a shapefile. Any point in the shapefile with measurements for any of the variables should be included Args:
geometry: GeoDataFrame for shapefile from gpd.read_file variables: List of SensorDescription snow_courses: boolean for including only snowcourse data or no
snowcourse data
- within_geometry: filter the points to within the shapefile
instead of just the extents. Default True
buffer: buffer added to search box
- Returns:
PointDataCollection
metloom.pointdata.files module¶
Location to keep readers that pull in a flat file like a csv.
- class metloom.pointdata.files.CSVPointData(station_id, name=None, metadata=None, cache='./cache')[source]¶
Bases:
PointDataSome met station data is stored off in flat csv files. This class enables the management of downloading those files while still allowing a similar interface
- ALLOWED_STATIONS¶
alias of
StationInfo
- UTC_OFFSET_HOURS = 0¶
- get_daily_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get daily measurement data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- get_hourly_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get hourly measurement data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- classmethod points_from_geometry(geometry: GeoDataFrame, variables: List[SensorDescription], within_geometry=True, buffer=0.0, **kwargs)[source]¶
Find a collection of points with measurements for certain variables contained within a shapefile. Any point in the shapefile with measurements for any of the variables should be included Args:
geometry: GeoDataFrame for shapefile from gpd.read_file variables: List of SensorDescription snow_courses: boolean for including only snowcourse data or no
snowcourse data
- within_geometry: filter the points to within the shapefile
instead of just the extents. Default True
buffer: buffer added to search box
- Returns:
PointDataCollection
- class metloom.pointdata.files.StationInfo(value)[source]¶
Bases:
EnumSince there is not enough info via an API, csv readers rely on a list of stations and info associated with them to build the calls. This should allow for a common dataset with multiple stations to be verified and isolated
- property elevation¶
- property latitude¶
- property longitude¶
- property path¶
- property point¶
- property station_id¶
- property station_name¶
metloom.pointdata.geosphere_austria module¶
- class metloom.pointdata.geosphere_austria.GeoSphereCurrentPointData(station_id, name, metadata=None)[source]¶
Bases:
GeoSpherePointDataBaseImplement PointData methods for GeoSphere Austria data source API documentation here https://dataset.api.hub.geosphere.at/v1/docs/index.html https://dataset.api.hub.geosphere.at/v1/docs/user-guide/resource.html
Datasets available here https://data.hub.geosphere.at/dataset/
We use tawes-v1 data which consists of data from the last 3 months in 10 minute increment
- ALLOWED_VARIABLES¶
alias of
GeoSphereCurrentVariables
- DATASOURCE = 'GEOSPHERE'¶
- META_EXTENSION = '/v1/station/current/tawes-v1-10min/metadata'¶
- URL = 'https://dataset.api.hub.geosphere.at'¶
- get_daily_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_daily_data Example query: https://dataset.api.hub.geosphere.at/v1/station/current/ tawes-v1-10min?parameters=TL&station_ids=11035
- get_hourly_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_hourly_data
- class metloom.pointdata.geosphere_austria.GeoSphereHistPointData(station_id, name, metadata=None)[source]¶
Bases:
GeoSpherePointDataBaseImplement PointData methods for GeoSphere Austria data source API documentation here https://dataset.api.hub.geosphere.at/v1/docs/index.html https://dataset.api.hub.geosphere.at/v1/docs/user-guide/resource.html
Datasets available here https://data.hub.geosphere.at/dataset/
We use klima-v1-1d data which consists of historical daily data. There is historical hourly data, but the parameter names are different and as such this has not bee implemented
- ALLOWED_VARIABLES¶
alias of
GeoSphereHistVariables
- DATASOURCE = 'GEOSPHERE'¶
- META_EXTENSION = '/v1/station/historical/klima-v1-1d/metadata'¶
- URL = 'https://dataset.api.hub.geosphere.at'¶
- get_daily_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_daily_data Example query: https://dataset.api.hub.geosphere.at/v1/station/historical/klima-v1-1d ?station_ids=11401&start=2023-04-12&end=2023-04-14¶meters=schnee
- class metloom.pointdata.geosphere_austria.GeoSpherePointDataBase(station_id, name, metadata=None)[source]¶
Bases:
PointDataImplement PointData methods for GeoSphere Austria data source API documentation here https://dataset.api.hub.geosphere.at/v1/docs/index.html https://dataset.api.hub.geosphere.at/v1/docs/user-guide/resource.html
Datasets available here https://data.hub.geosphere.at/dataset/
We could either use the verified klima-v1 data or the raw tawes-v1 data. Kilma has hourly and daily, taws is 10minute and most current
- ALLOWED_VARIABLES = None¶
- DATASOURCE = 'GEOSPHERE'¶
- META_EXTENSION = None¶
- URL = 'https://dataset.api.hub.geosphere.at'¶
- classmethod points_from_geometry(geometry: GeoDataFrame, variables: List[SensorDescription], **kwargs)[source]¶
See docstring for PointData.points_from_geometry
The Austria Geosphere API does not allow filtering by variable. As a result, we do not filter according to which points have specific variables. The function arguments allow variables to be passed in to keep consistency with the same function from other classes.
- Args:
geometry: GeoDataFrame for shapefile from gpd.read_file variables: List of SensorDescription. NOT USED FOR THIS CLASS within_geometry: filter the points to within the shapefile instead of just the extents. Default True buffer: buffer added to search box, filter_to_active: filter to active stations
- Returns:
PointDataCollection
metloom.pointdata.mesowest module¶
- class metloom.pointdata.mesowest.MesowestPointData(station_id, name, token_json='~/.synoptic_token.json', metadata=None)[source]¶
Bases:
PointData- ALLOWED_VARIABLES¶
alias of
MesowestVariables
- DATASOURCE = 'Mesowest'¶
- MESO_URL = 'https://api.synopticdata.com/v2/stations/timeseries'¶
- META_URL = 'https://api.synopticdata.com/v2/stations/metadata'¶
- NO_DATA_MESSAGE = 'No stations found for this request.'¶
- POINTS_FROM_GEOM_DEFAULTS = {'buffer': 0.0, 'token_json': '~/.synoptic_token.json', 'within_geometry': True}¶
- classmethod create_token_json(token)[source]¶
Creates the neccessary synoptic token json for mesowest requests. To get public token visit: https://synopticdata.com/mesonet-api Args:
token: Syntoptic Lab’s public token.
- Returns:
None
- get_daily_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get daily measurement data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- get_hourly_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get hourly measurement data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- classmethod points_from_geometry(geometry: GeoDataFrame, variables: List[SensorDescription], **kwargs)[source]¶
See docstring for PointData.points_from_geometry
- Args:
geometry: GeoDataFrame for shapefile from gpd.read_file variables: List of SensorDescription within_geometry: filter the points to within the shapefile
instead of just the extents. Default True
buffer: buffer added to search box token_json: Path to the public token for the mesowest api
default = “~/.synoptic_token.json”
- Returns:
PointDataCollection
- property token¶
metloom.pointdata.norway module¶
- class metloom.pointdata.norway.MetNorwayPointData(station_id, name, token_json='~/.frost_token.json', metadata=None)[source]¶
Bases:
PointDataClass for the Norway Frost API https://frost.met.no/index.html
To create a user, go here https://frost.met.no/auth/requestCredentials.html
Data is provided by MET Norway, see license for details https://www.met.no/en/free-meteorological-data
Element (variable) information can be found here https://frost.met.no/elementtable
Observations/AvailableTimeSeries/ can be used to find out what types elements are available for a station or time range - we can use this to filter
The Sources endpoint returns metadata. It can be used to filter based on geometry and variables
For this class we will use default levels and timeoffsets. See more info here https://frost.met.no/concepts2.html#level-offset-filter
It is important to note that this class does NOT implement all of the functionality of the frost API. The frost documentation is extensive and worth looking through.
Read more about data quality codes here https://frost.met.no/dataclarifications.html
Read more about general concepts: https://frost.met.no/concepts2.html
- ALLOWED_VARIABLES¶
alias of
MetNorwayVariables
- DATASOURCE = 'MET Norway'¶
- POINTS_FROM_GEOM_DEFAULTS = {'buffer': 0.0, 'token_json': '~/.frost_token.json', 'within_geometry': True}¶
- URL = 'https://frost.met.no/'¶
- property auth_header¶
Get the auth header and set the expiration time
- get_daily_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_daily_data
- get_event_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get data in original frequency from API
- get_hourly_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_hourly_data
- classmethod points_from_geometry(geometry: GeoDataFrame, variables: List[SensorDescription], **kwargs)[source]¶
See docstring for PointData.points_from_geometry
- Args:
geometry: GeoDataFrame for shapefile from gpd.read_file variables: List of SensorDescription within_geometry: filter the points to within the shapefile
instead of just the extents. Default True
buffer: buffer added to search box token_json: Path to the public token for the mesowest api
default = “~/.frost_token.json”
- Returns:
PointDataCollection
metloom.pointdata.nws_forecast module¶
- class metloom.pointdata.nws_forecast.NWSForecastPointData(station_id, name, initial_metadata=None, metadata=None)[source]¶
Bases:
GenericPointImplementation for NWS forecast API https://www.weather.gov/documentation/services-web-api
We can call the points api to get the URL for the forecast, i.e. https://api.weather.gov/points/42,-119
In this example, 3 forecast URLs are available
“forecast”: “https://api.weather.gov/gridpoints/BOI/28,28/forecast”, “forecastHourly”: “https://api.weather.gov/gridpoints/BOI/28,28/forecast/hourly”, “forecastGridData”: “https://api.weather.gov/gridpoints/BOI/28,28”,
forecast can be used to return the 12 hour increments
forecastHourly returns hourly data (hourly in local tz)
forecastGridData returns the ‘raw’ grid data (hourly UTC).
We will use the forecastGridData endpoint for this implementation
The API returns data from a grid, meaning the geometry column in the returned geodataframes will represent the CENTER of the forecast grid cell.
- ALLOWED_VARIABLES¶
alias of
NWSForecastVariables
- DATASOURCE = 'NWS Forecast'¶
- POINTS_FROM_GEOM_DEFAULTS = {'buffer': 0.0, 'token_json': '~/.frost_token.json', 'within_geometry': True}¶
- URL = 'https://api.weather.gov'¶
- get_daily_forecast(variables: List[SensorDescription])[source]¶
Get a geopandas dataframe with daily results for a 7 day forecast. The geometry column will be the center of the forecast gridcell
- Args:
variables: list of variables to return
- get_forecast(variables: List[SensorDescription])[source]¶
Get a geopandas dataframe with hourly results for a 7 day forecast. The geometry column will be the center of the forecast gridcell
- Args:
variables: list of variables to return
- get_hourly_forecast(variables: List[SensorDescription])[source]¶
Get a geopandas dataframe with hourly results for a 7 day forecast. The geometry column will be the center of the forecast gridcell
- Args:
variables: list of variables to return
metloom.pointdata.sail module¶
- class metloom.pointdata.sail.SAILPointData(station_id: str, metadata: dict | None = None, cache: str | Path = PosixPath('.cache'), token_json: str | Path = PosixPath('~/.arm_token.json'))[source]¶
Bases:
PointDatahttps://adc.arm.gov/discovery/#/results/site_code::guc
- ALLOWED_VARIABLES¶
alias of
SAILStationVariables
- DATASOURCE = 'SAIL'¶
- get_daily_data(start_date: datetime, end_date: datetime, variables: list[SensorDescription])[source]¶
Get daily measurement data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- get_hourly_data(start_date: datetime, end_date: datetime, variables: list[SensorDescription])[source]¶
Get hourly measurement data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- static get_location(station_id: str, variable: SensorDescription | None = None) tuple[float, float, float][source]¶
Get the location of the site and facility code.
The Gunnison SAIL site has 3 supplemental sites (S1, S2, S3, S4) and one main site (M1). The S4 site is atmospheric measurements made with a teathered balloon, thus the location is not constant and it is excluded from the hard-coded locations.
Returns a tuple of (latitude, longitude, elevation [m]) https://www.arm.gov/capabilities/observatories/guc/locations
- get_snow_course_data(start_date: date, end_date: date, variables: list[SensorDescription])[source]¶
Get snow course data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- classmethod points_from_geometry(geometry: GeoDataFrame, variables: list[SensorDescription], snow_courses=None, within_geometry=True, buffer=0.0)[source]¶
Find a collection of points with measurements for certain variables contained within a shapefile. Any point in the shapefile with measurements for any of the variables should be included Args:
geometry: GeoDataFrame for shapefile from gpd.read_file variables: List of SensorDescription snow_courses: boolean for including only snowcourse data or no
snowcourse data
- within_geometry: filter the points to within the shapefile
instead of just the extents. Default True
buffer: buffer added to search box
- Returns:
PointDataCollection
metloom.pointdata.snotel module¶
- class metloom.pointdata.snotel.SnotelPointData(station_id, name, metadata=None)[source]¶
Bases:
PointDataImplement PointData methods for SNOTEL data source API documentation here: https://www.nrcs.usda.gov/wps/portal/wcc/home/dataAccessHelp/webService/webServiceReference/ Website has variable and network codes Possible testing resource: https://wcc.sc.egov.usda.gov/awdbWebService/webservice/testwebservice.jsf?webserviceName=/awdbWebService
- ALLOWED_VARIABLES¶
alias of
SnotelVariables
- DATASOURCE = 'NRCS'¶
- get_daily_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_daily_data
- get_hourly_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_hourly_data
- get_snow_course_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_snow_course_data
- classmethod points_from_geometry(geometry: GeoDataFrame, variables: List[SensorDescription], **kwargs)[source]¶
See docstring for PointData.points_from_geometry
- Args:
geometry: GeoDataFrame for shapefile from gpd.read_file variables: List of SensorDescription snow_courses: boolean for including only snowcourse data or no
snowcourse data
- within_geometry: filter the points to within the shapefile
instead of just the extents. Default True
buffer: buffer added to search box
- Returns:
PointDataCollection
- property tzinfo¶
tzinfo that pandas can use for tz_localize
metloom.pointdata.snotel_client module¶
- class metloom.pointdata.snotel_client.BaseSnotelClient(**kwargs)[source]¶
Bases:
objectBase snotel client class. Used for interacting with SNOTEL SOAP client. This is just a base class and not meant for direct use.
Example use with extended class:
MetaDataSnotelClient('TNY:CA:SNOW').get_data()
- DEFAULT_PARAMS = {}¶
- PARAMS_MAP = {'begin_date': 'beginDate', 'duration': 'duration', 'element_cd': 'elementCd', 'element_cds': 'elementCds', 'end_date': 'endDate', 'height_depth': 'heightDepth', 'max_latitude': 'maxLatitude', 'max_longitude': 'maxLongitude', 'min_latitude': 'minLatitude', 'min_longitude': 'minLongitude', 'network_cds': 'networkCds', 'ordinal': 'ordinal', 'parameter': 'parameter', 'station_triplet': 'stationTriplet', 'station_triplets': 'stationTriplets'}¶
- SERVICE_NAME = None¶
- URL = 'https://wcc.sc.egov.usda.gov/awdbWebService/services?WSDL'¶
- class metloom.pointdata.snotel_client.DailySnotelDataClient(begin_date: datetime, end_date: datetime, station_triplet: str, **kwargs)[source]¶
Bases:
SeriesSnotelClientClass for getting daily data
- class metloom.pointdata.snotel_client.ElementSnotelClient(station_triplet: str, **kwargs)[source]¶
Bases:
BaseSnotelClientGet all station elements for a station triplet. Station triplets are descriptions of each sensor on the station
get_data returns a list of zeep objects. Zeep objects are indexible or attributes can be accessed with getattr or
.- SERVICE_NAME = 'getStationElements'¶
- class metloom.pointdata.snotel_client.HourlySnotelDataClient(begin_date: datetime, end_date: datetime, station_triplet: str, **kwargs)[source]¶
Bases:
SeriesSnotelClientClass for getting hourly data
- DEFAULT_PARAMS = {'ordinal': 1}¶
- DURATION = None¶
- SERVICE_NAME = 'getHourlyData'¶
- class metloom.pointdata.snotel_client.MetaDataSnotelClient(station_triplet: str, **kwargs)[source]¶
Bases:
BaseSnotelClientRead metadata from the metadata service for a particular station triplet
- SERVICE_NAME = 'getStationMetadata'¶
- class metloom.pointdata.snotel_client.PointSearchSnotelClient(max_latitude: float, min_latitude: float, max_longitude: float, min_longitude: float, network_cds: str, element_cds: str, **kwargs)[source]¶
Bases:
BaseSnotelClientSearch for stations based on criteria. This search is default logical
ANDmeaning all criteria need to be true. get_data returns a list of string station triplets- DEFAULT_PARAMS = {'logicalAnd': 'true'}¶
- SERVICE_NAME = 'getStations'¶
- class metloom.pointdata.snotel_client.SemiMonthlySnotelClient(begin_date: datetime, end_date: datetime, station_triplet: str, **kwargs)[source]¶
Bases:
SeriesSnotelClientClass for getting semi monthly (snow course) data
- DURATION = 'SEMIMONTHLY'¶
- class metloom.pointdata.snotel_client.SeriesSnotelClient(begin_date: datetime, end_date: datetime, station_triplet: str, **kwargs)[source]¶
Bases:
BaseSnotelClientBase extension for services that return timseries data.
- DEFAULT_PARAMS = {'alwaysReturnDailyFeb29': 'false', 'getFlags': 'true', 'ordinal': 1}¶
- DURATION = 'DAILY'¶
- SERVICE_NAME = 'getData'¶
metloom.pointdata.snowex module¶
- class metloom.pointdata.snowex.SnowExMet(station_id, name=None, metadata=None, cache='./cache')[source]¶
Bases:
CSVPointDataThese data are stored in csv data formats
- ALLOWED_STATIONS¶
alias of
SnowExMetInfo
- ALLOWED_VARIABLES¶
alias of
SnowExVariables
- DATASOURCE = 'NSIDC'¶
- DOI = 'https://doi.org/10.5067/497NQVJ0CBEX'¶
- URL = 'https://n5eil01u.ecs.nsidc.org/SNOWEX/SNEX_Met.001/'¶
- UTC_OFFSET_HOURS = 0¶
- class metloom.pointdata.snowex.SnowExMetInfo(value)[source]¶
Bases:
StationInfoAn enumeration.
- GM_STUDY_PLOT = ('Grand Mesa Study Plot', 'GMSP', 39.05084, -108.06144, 10626, '2017.06.21/SNEX_Met_GMSP2_final_output.csv')¶
- LS_OBS_SITE = ('Local Scale Observation Site', 'LSOS', 39.05225, -108.09792, 9791, '2016.10.09/SNEX_Met_LSOS_final_output.csv')¶
- MESA_EAST = ('Mesa East', 'ME', 39.10358, -107.88383, 10105, '2016.10.10/SNEX_Met_ME_final_output.csv')¶
- MESA_MIDDLE = ('Mesa Middle', 'MM', 39.03954, -107.94174, 10286, '2016.10.10/SNEX_Met_MM_final_output.csv')¶
- MESA_WEST = ('Mesa West', 'MW', 39.03388, -108.21399, 9950, '2016.10.09/SNEX_Met_MW_final_output.csv')¶
metloom.pointdata.usgs module¶
- class metloom.pointdata.usgs.USGSPointData(station_id, name, metadata=None, duration=None)[source]¶
Bases:
PointDataImplement PointData methods for USGS data source.
- APIs and help
https://waterservices.usgs.gov/rest/DV-Service.html#Service https://waterservices.usgs.gov/rest/IV-Service.html#Service https://waterservices.usgs.gov/rest/Site-Test-Tool.html
- ALLOWED_VARIABLES¶
alias of
USGSVariables
- DATASOURCE = 'USGS'¶
- META_URL = 'https://waterservices.usgs.gov/nwis/site/'¶
- USGS_URL = 'https://waterservices.usgs.gov/nwis/'¶
- get_daily_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_daily_data
- get_hourly_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get hourly measurement data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- get_instantaneous_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
USGS ‘instantaneous’ data, which is generally 15 minutes.
- classmethod points_from_geometry(geometry: GeoDataFrame, variables: List[SensorDescription], **kwargs)[source]¶
See docstring for PointData.points_from_geometry
- Args:
geometry: GeoDataFrame for shapefile from gpd.read_file variables: List of SensorDescription
- Returns:
PointDataCollection
- property tzinfo¶
tzinfo that pandas can use for tz_localize
Module contents¶
- class metloom.pointdata.CDECPointData(station_id, name, metadata=None)[source]¶
Bases:
PointDataImplement PointData methods for CDEC data source API documentation here https://cdec.water.ca.gov/dynamicapp/
- ALLOWED_VARIABLES¶
alias of
CdecStationVariables
- CDEC_URL = 'http://cdec.water.ca.gov/dynamicapp/req/JSONDataServlet'¶
- DATASOURCE = 'CDEC'¶
- META_URL = 'https://cdec.water.ca.gov/dynamicapp/req/CSVMetaDataServlet'¶
- get_daily_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_daily_data Example query: https://cdec.water.ca.gov/dynamicapp/req/JSONDataServlet? Stations=TNY&SensorNums=3&dur_code=D&Start=2021-05-16&End=2021-05-16
- get_event_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
- get_hourly_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_hourly_data
- get_snow_course_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_snow_course_data
- is_only_snow_course(variables: List[SensorDescription])[source]¶
Determine if a station only has snow course measurements
- is_partly_snow_course()[source]¶
Determine if any of the snow sensors at a station are on a monthly interval Assumption: Monthly snow sensor measurements are snow courses
- classmethod points_from_geometry(geometry: GeoDataFrame, variables: List[SensorDescription], **kwargs)[source]¶
See docstring for PointData.points_from_geometry
- Args:
geometry: GeoDataFrame for shapefile from gpd.read_file variables: List of SensorDescription snow_courses: Boolean for including only snowcourse data or no snowcourse data within_geometry: filter the points to within the shapefile instead of just the extents. Default True buffer: buffer added to search box
- Returns:
PointDataCollection
- class metloom.pointdata.CSASMet(station_id, name=None, metadata=None, cache='./cache')[source]¶
Bases:
CSVPointData- ALLOWED_STATIONS¶
alias of
CSASStationInfo
- ALLOWED_VARIABLES¶
alias of
CSASVariables
- CURRENT_AVAILABLE_YEAR = 2024¶
- DATASOURCE = 'CSAS'¶
- DOI = ''¶
- URL = 'https://snowstudies.org/wp-content/uploads/'¶
- UTC_OFFSET_HOURS = -7¶
- class metloom.pointdata.CSVPointData(station_id, name=None, metadata=None, cache='./cache')[source]¶
Bases:
PointDataSome met station data is stored off in flat csv files. This class enables the management of downloading those files while still allowing a similar interface
- ALLOWED_STATIONS¶
alias of
StationInfo
- UTC_OFFSET_HOURS = 0¶
- get_daily_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get daily measurement data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- get_hourly_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get hourly measurement data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- classmethod points_from_geometry(geometry: GeoDataFrame, variables: List[SensorDescription], within_geometry=True, buffer=0.0, **kwargs)[source]¶
Find a collection of points with measurements for certain variables contained within a shapefile. Any point in the shapefile with measurements for any of the variables should be included Args:
geometry: GeoDataFrame for shapefile from gpd.read_file variables: List of SensorDescription snow_courses: boolean for including only snowcourse data or no
snowcourse data
- within_geometry: filter the points to within the shapefile
instead of just the extents. Default True
buffer: buffer added to search box
- Returns:
PointDataCollection
- class metloom.pointdata.CuesLevel1(station_id, name, metadata=None)[source]¶
Bases:
PointDataImplement PointData methods for CUES level 1 data https://snow.ucsb.edu/index.php/description/ https://snow.ucsb.edu/index.php/query-db/ https://doi.org/10.21424/R4159Q
- ALLOWED_VARIABLES¶
alias of
CuesLevel1Variables
- DATASOURCE = 'UCSB CUES'¶
- URL = 'https://snow.ucsb.edu/index.php/query-db/'¶
- get_daily_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get daily measurement data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- get_hourly_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get hourly measurement data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- get_snow_course_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get snow course data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- property metadata¶
Hardcode the metadata
- points_from_geometry(geometry: GeoDataFrame, variables: List[SensorDescription], snow_courses=False, within_geometry=True, buffer=0.0)[source]¶
Find a collection of points with measurements for certain variables contained within a shapefile. Any point in the shapefile with measurements for any of the variables should be included Args:
geometry: GeoDataFrame for shapefile from gpd.read_file variables: List of SensorDescription snow_courses: boolean for including only snowcourse data or no
snowcourse data
- within_geometry: filter the points to within the shapefile
instead of just the extents. Default True
buffer: buffer added to search box
- Returns:
PointDataCollection
- class metloom.pointdata.GeoSphereCurrentPointData(station_id, name, metadata=None)[source]¶
Bases:
GeoSpherePointDataBaseImplement PointData methods for GeoSphere Austria data source API documentation here https://dataset.api.hub.geosphere.at/v1/docs/index.html https://dataset.api.hub.geosphere.at/v1/docs/user-guide/resource.html
Datasets available here https://data.hub.geosphere.at/dataset/
We use tawes-v1 data which consists of data from the last 3 months in 10 minute increment
- ALLOWED_VARIABLES¶
alias of
GeoSphereCurrentVariables
- DATASOURCE = 'GEOSPHERE'¶
- META_EXTENSION = '/v1/station/current/tawes-v1-10min/metadata'¶
- URL = 'https://dataset.api.hub.geosphere.at'¶
- get_daily_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_daily_data Example query: https://dataset.api.hub.geosphere.at/v1/station/current/ tawes-v1-10min?parameters=TL&station_ids=11035
- get_hourly_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_hourly_data
- class metloom.pointdata.GeoSphereHistPointData(station_id, name, metadata=None)[source]¶
Bases:
GeoSpherePointDataBaseImplement PointData methods for GeoSphere Austria data source API documentation here https://dataset.api.hub.geosphere.at/v1/docs/index.html https://dataset.api.hub.geosphere.at/v1/docs/user-guide/resource.html
Datasets available here https://data.hub.geosphere.at/dataset/
We use klima-v1-1d data which consists of historical daily data. There is historical hourly data, but the parameter names are different and as such this has not bee implemented
- ALLOWED_VARIABLES¶
alias of
GeoSphereHistVariables
- DATASOURCE = 'GEOSPHERE'¶
- META_EXTENSION = '/v1/station/historical/klima-v1-1d/metadata'¶
- URL = 'https://dataset.api.hub.geosphere.at'¶
- get_daily_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_daily_data Example query: https://dataset.api.hub.geosphere.at/v1/station/historical/klima-v1-1d ?station_ids=11401&start=2023-04-12&end=2023-04-14¶meters=schnee
- class metloom.pointdata.MesowestPointData(station_id, name, token_json='~/.synoptic_token.json', metadata=None)[source]¶
Bases:
PointData- ALLOWED_VARIABLES¶
alias of
MesowestVariables
- DATASOURCE = 'Mesowest'¶
- MESO_URL = 'https://api.synopticdata.com/v2/stations/timeseries'¶
- META_URL = 'https://api.synopticdata.com/v2/stations/metadata'¶
- NO_DATA_MESSAGE = 'No stations found for this request.'¶
- POINTS_FROM_GEOM_DEFAULTS = {'buffer': 0.0, 'token_json': '~/.synoptic_token.json', 'within_geometry': True}¶
- classmethod create_token_json(token)[source]¶
Creates the neccessary synoptic token json for mesowest requests. To get public token visit: https://synopticdata.com/mesonet-api Args:
token: Syntoptic Lab’s public token.
- Returns:
None
- get_daily_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get daily measurement data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- get_hourly_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get hourly measurement data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- classmethod points_from_geometry(geometry: GeoDataFrame, variables: List[SensorDescription], **kwargs)[source]¶
See docstring for PointData.points_from_geometry
- Args:
geometry: GeoDataFrame for shapefile from gpd.read_file variables: List of SensorDescription within_geometry: filter the points to within the shapefile
instead of just the extents. Default True
buffer: buffer added to search box token_json: Path to the public token for the mesowest api
default = “~/.synoptic_token.json”
- Returns:
PointDataCollection
- property token¶
- class metloom.pointdata.MetNorwayPointData(station_id, name, token_json='~/.frost_token.json', metadata=None)[source]¶
Bases:
PointDataClass for the Norway Frost API https://frost.met.no/index.html
To create a user, go here https://frost.met.no/auth/requestCredentials.html
Data is provided by MET Norway, see license for details https://www.met.no/en/free-meteorological-data
Element (variable) information can be found here https://frost.met.no/elementtable
Observations/AvailableTimeSeries/ can be used to find out what types elements are available for a station or time range - we can use this to filter
The Sources endpoint returns metadata. It can be used to filter based on geometry and variables
For this class we will use default levels and timeoffsets. See more info here https://frost.met.no/concepts2.html#level-offset-filter
It is important to note that this class does NOT implement all of the functionality of the frost API. The frost documentation is extensive and worth looking through.
Read more about data quality codes here https://frost.met.no/dataclarifications.html
Read more about general concepts: https://frost.met.no/concepts2.html
- ALLOWED_VARIABLES¶
alias of
MetNorwayVariables
- DATASOURCE = 'MET Norway'¶
- POINTS_FROM_GEOM_DEFAULTS = {'buffer': 0.0, 'token_json': '~/.frost_token.json', 'within_geometry': True}¶
- URL = 'https://frost.met.no/'¶
- property auth_header¶
Get the auth header and set the expiration time
- get_daily_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_daily_data
- get_event_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get data in original frequency from API
- get_hourly_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_hourly_data
- classmethod points_from_geometry(geometry: GeoDataFrame, variables: List[SensorDescription], **kwargs)[source]¶
See docstring for PointData.points_from_geometry
- Args:
geometry: GeoDataFrame for shapefile from gpd.read_file variables: List of SensorDescription within_geometry: filter the points to within the shapefile
instead of just the extents. Default True
buffer: buffer added to search box token_json: Path to the public token for the mesowest api
default = “~/.frost_token.json”
- Returns:
PointDataCollection
- class metloom.pointdata.NWSForecastPointData(station_id, name, initial_metadata=None, metadata=None)[source]¶
Bases:
GenericPointImplementation for NWS forecast API https://www.weather.gov/documentation/services-web-api
We can call the points api to get the URL for the forecast, i.e. https://api.weather.gov/points/42,-119
In this example, 3 forecast URLs are available
“forecast”: “https://api.weather.gov/gridpoints/BOI/28,28/forecast”, “forecastHourly”: “https://api.weather.gov/gridpoints/BOI/28,28/forecast/hourly”, “forecastGridData”: “https://api.weather.gov/gridpoints/BOI/28,28”,
forecast can be used to return the 12 hour increments
forecastHourly returns hourly data (hourly in local tz)
forecastGridData returns the ‘raw’ grid data (hourly UTC).
We will use the forecastGridData endpoint for this implementation
The API returns data from a grid, meaning the geometry column in the returned geodataframes will represent the CENTER of the forecast grid cell.
- ALLOWED_VARIABLES¶
alias of
NWSForecastVariables
- DATASOURCE = 'NWS Forecast'¶
- POINTS_FROM_GEOM_DEFAULTS = {'buffer': 0.0, 'token_json': '~/.frost_token.json', 'within_geometry': True}¶
- URL = 'https://api.weather.gov'¶
- get_daily_forecast(variables: List[SensorDescription])[source]¶
Get a geopandas dataframe with daily results for a 7 day forecast. The geometry column will be the center of the forecast gridcell
- Args:
variables: list of variables to return
- get_forecast(variables: List[SensorDescription])[source]¶
Get a geopandas dataframe with hourly results for a 7 day forecast. The geometry column will be the center of the forecast gridcell
- Args:
variables: list of variables to return
- get_hourly_forecast(variables: List[SensorDescription])[source]¶
Get a geopandas dataframe with hourly results for a 7 day forecast. The geometry column will be the center of the forecast gridcell
- Args:
variables: list of variables to return
- class metloom.pointdata.PointData(station_id, name, metadata=None)[source]¶
Bases:
GenericPointExtend GenericPoint and add functions for finding data from geometry and for gettings daily, hourly, or snow course data
- POINTS_FROM_GEOM_DEFAULTS = {'buffer': 0.0, 'filter_to_active': False, 'snow_courses': False, 'within_geometry': True}¶
- get_daily_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get daily measurement data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- get_hourly_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get hourly measurement data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- get_snow_course_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get snow course data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- classmethod points_from_geometry(geometry: GeoDataFrame, variables: List[SensorDescription], snow_courses=False, within_geometry=True, buffer=0.0)[source]¶
Find a collection of points with measurements for certain variables contained within a shapefile. Any point in the shapefile with measurements for any of the variables should be included Args:
geometry: GeoDataFrame for shapefile from gpd.read_file variables: List of SensorDescription snow_courses: boolean for including only snowcourse data or no
snowcourse data
- within_geometry: filter the points to within the shapefile
instead of just the extents. Default True
buffer: buffer added to search box
- Returns:
PointDataCollection
- class metloom.pointdata.PointDataCollection(points: List[object] | None = None)[source]¶
Bases:
objectIterator class for a collection of PointData objects. This allows conversion to a GeoDataFrame
- class metloom.pointdata.SAILPointData(station_id: str, metadata: dict | None = None, cache: str | Path = PosixPath('.cache'), token_json: str | Path = PosixPath('~/.arm_token.json'))[source]¶
Bases:
PointDatahttps://adc.arm.gov/discovery/#/results/site_code::guc
- ALLOWED_VARIABLES¶
alias of
SAILStationVariables
- DATASOURCE = 'SAIL'¶
- get_daily_data(start_date: datetime, end_date: datetime, variables: list[SensorDescription])[source]¶
Get daily measurement data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- get_hourly_data(start_date: datetime, end_date: datetime, variables: list[SensorDescription])[source]¶
Get hourly measurement data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- static get_location(station_id: str, variable: SensorDescription | None = None) tuple[float, float, float][source]¶
Get the location of the site and facility code.
The Gunnison SAIL site has 3 supplemental sites (S1, S2, S3, S4) and one main site (M1). The S4 site is atmospheric measurements made with a teathered balloon, thus the location is not constant and it is excluded from the hard-coded locations.
Returns a tuple of (latitude, longitude, elevation [m]) https://www.arm.gov/capabilities/observatories/guc/locations
- get_snow_course_data(start_date: date, end_date: date, variables: list[SensorDescription])[source]¶
Get snow course data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- classmethod points_from_geometry(geometry: GeoDataFrame, variables: list[SensorDescription], snow_courses=None, within_geometry=True, buffer=0.0)[source]¶
Find a collection of points with measurements for certain variables contained within a shapefile. Any point in the shapefile with measurements for any of the variables should be included Args:
geometry: GeoDataFrame for shapefile from gpd.read_file variables: List of SensorDescription snow_courses: boolean for including only snowcourse data or no
snowcourse data
- within_geometry: filter the points to within the shapefile
instead of just the extents. Default True
buffer: buffer added to search box
- Returns:
PointDataCollection
- class metloom.pointdata.SnotelPointData(station_id, name, metadata=None)[source]¶
Bases:
PointDataImplement PointData methods for SNOTEL data source API documentation here: https://www.nrcs.usda.gov/wps/portal/wcc/home/dataAccessHelp/webService/webServiceReference/ Website has variable and network codes Possible testing resource: https://wcc.sc.egov.usda.gov/awdbWebService/webservice/testwebservice.jsf?webserviceName=/awdbWebService
- ALLOWED_VARIABLES¶
alias of
SnotelVariables
- DATASOURCE = 'NRCS'¶
- get_daily_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_daily_data
- get_hourly_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_hourly_data
- get_snow_course_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_snow_course_data
- classmethod points_from_geometry(geometry: GeoDataFrame, variables: List[SensorDescription], **kwargs)[source]¶
See docstring for PointData.points_from_geometry
- Args:
geometry: GeoDataFrame for shapefile from gpd.read_file variables: List of SensorDescription snow_courses: boolean for including only snowcourse data or no
snowcourse data
- within_geometry: filter the points to within the shapefile
instead of just the extents. Default True
buffer: buffer added to search box
- Returns:
PointDataCollection
- property tzinfo¶
tzinfo that pandas can use for tz_localize
- class metloom.pointdata.SnowExMet(station_id, name=None, metadata=None, cache='./cache')[source]¶
Bases:
CSVPointDataThese data are stored in csv data formats
- ALLOWED_STATIONS¶
alias of
SnowExMetInfo
- ALLOWED_VARIABLES¶
alias of
SnowExVariables
- DATASOURCE = 'NSIDC'¶
- DOI = 'https://doi.org/10.5067/497NQVJ0CBEX'¶
- URL = 'https://n5eil01u.ecs.nsidc.org/SNOWEX/SNEX_Met.001/'¶
- UTC_OFFSET_HOURS = 0¶
- class metloom.pointdata.StationInfo(value)[source]¶
Bases:
EnumSince there is not enough info via an API, csv readers rely on a list of stations and info associated with them to build the calls. This should allow for a common dataset with multiple stations to be verified and isolated
- property elevation¶
- property latitude¶
- property longitude¶
- property path¶
- property point¶
- property station_id¶
- property station_name¶
- class metloom.pointdata.USGSPointData(station_id, name, metadata=None, duration=None)[source]¶
Bases:
PointDataImplement PointData methods for USGS data source.
- APIs and help
https://waterservices.usgs.gov/rest/DV-Service.html#Service https://waterservices.usgs.gov/rest/IV-Service.html#Service https://waterservices.usgs.gov/rest/Site-Test-Tool.html
- ALLOWED_VARIABLES¶
alias of
USGSVariables
- DATASOURCE = 'USGS'¶
- META_URL = 'https://waterservices.usgs.gov/nwis/site/'¶
- USGS_URL = 'https://waterservices.usgs.gov/nwis/'¶
- get_daily_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
See docstring for PointData.get_daily_data
- get_hourly_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
Get hourly measurement data Args:
start_date: datetime object for start of data collection period end_date: datetime object for end of data collection period variables: List of metloom.variables.SensorDescription object
from self.ALLOWED_VARIABLES
- Returns:
GeoDataFrame of data. The dataframe should be indexed on [‘datetime’, ‘site’] and have columns [‘geometry’, ‘site’, ‘measurementDate’]. Additionally, for each variables, it should have column f’{variable.name}’ and f’{variable.name}_UNITS’ See CDECPointData._get_data for example implementation and TestCDECStation.tny_daily_expected for example dataframe. Datetimes should be in UTC
- get_instantaneous_data(start_date: datetime, end_date: datetime, variables: List[SensorDescription])[source]¶
USGS ‘instantaneous’ data, which is generally 15 minutes.
- classmethod points_from_geometry(geometry: GeoDataFrame, variables: List[SensorDescription], **kwargs)[source]¶
See docstring for PointData.points_from_geometry
- Args:
geometry: GeoDataFrame for shapefile from gpd.read_file variables: List of SensorDescription
- Returns:
PointDataCollection
- property tzinfo¶
tzinfo that pandas can use for tz_localize