src.dynamic_boundary_conditions.river.river_data_from_niwa
Fetch REC data in New Zealand from NIWA using the ArcGIS REST API.
Attributes
Classes
Represents the record counts of the REC feature layer. |
Functions
|
Retrieves the maximum and total record counts from the REC feature layer. |
|
Generate a list of API query parameters used to retrieve REC data in New Zealand. |
|
Fetch REC data using the provided query parameters within a single API call. |
|
Iterate over the list of API query parameters to fetch REC data in New Zealand. |
|
Retrieve REC data in New Zealand from NIWA using the ArcGIS REST API. |
|
Retrieve REC data in New Zealand from NIWA OpenData. |
Module Contents
- src.dynamic_boundary_conditions.river.river_data_from_niwa.log
- src.dynamic_boundary_conditions.river.river_data_from_niwa.REC_API_URL = 'https://gis.niwa.co.nz/server/rest/services/HYDRO/Flood_Statistics_Henderson_Collins_V2/MapServer/2'
- class src.dynamic_boundary_conditions.river.river_data_from_niwa.RecordCounts
Bases:
NamedTuple
Represents the record counts of the REC feature layer.
- max_record_count
The maximum number of records that will be returned per query.
- Type:
int
- total_record_count
The total number of records available in the feature layer.
- Type:
int
- max_record_count: int
- total_record_count: int
- src.dynamic_boundary_conditions.river.river_data_from_niwa.get_feature_layer_record_counts(url: str = REC_API_URL) RecordCounts
Retrieves the maximum and total record counts from the REC feature layer.
- Parameters:
url (str = REC_API_URL) – The URL of the REC feature layer. Defaults to REC_API_URL.
- Returns:
A named tuple containing the maximum and total record counts of the REC feature layer.
- Return type:
- src.dynamic_boundary_conditions.river.river_data_from_niwa.gen_rec_query_param_list(engine: sqlalchemy.engine.Engine, max_record_count: int, total_record_count: int) List[Dict[str, str | int]]
Generate a list of API query parameters used to retrieve REC data in New Zealand.
- Parameters:
engine (Engine) – The engine used to connect to the database.
max_record_count (int) – The maximum number of records that will be returned per query.
total_record_count (int) – The total number of records available in the feature layer.
- Returns:
A list of API query parameters used to retrieve REC data in New Zealand.
- Return type:
List[Dict[str, Union[str, int]]]
- async src.dynamic_boundary_conditions.river.river_data_from_niwa.fetch_rec_data(session: aiohttp.ClientSession, query_param: Dict[str, Union[str, int]], url: str = f'{REC_API_URL}/query') geopandas.GeoDataFrame
Fetch REC data using the provided query parameters within a single API call.
- Parameters:
session (aiohttp.ClientSession) – An instance of aiohttp.ClientSession used for making HTTP requests.
query_param (Dict[str, Union[str, int]]) – The query parameters used to retrieve REC data.
url (str = REC_API_URL) – The query URL of the REC feature layer.
- Returns:
A GeoDataFrame containing the fetched REC data.
- Return type:
gpd.GeoDataFrame
- async src.dynamic_boundary_conditions.river.river_data_from_niwa.fetch_rec_data_for_nz(query_param_list: List[Dict[str, str | int]], url: str = REC_API_URL) geopandas.GeoDataFrame
Iterate over the list of API query parameters to fetch REC data in New Zealand.
- Parameters:
query_param_list (List[Dict[str, Union[str, int]]]) – A list of API query parameters used to retrieve REC data in New Zealand.
url (str = REC_API_URL) – The URL of the REC feature layer. Defaults to REC_API_URL.
- Returns:
A GeoDataFrame containing the fetched REC data in New Zealand.
- Return type:
gpd.GeoDataFrame
- src.dynamic_boundary_conditions.river.river_data_from_niwa.fetch_rec_data_from_niwa(engine: sqlalchemy.engine.Engine, url: str = REC_API_URL) geopandas.GeoDataFrame
Retrieve REC data in New Zealand from NIWA using the ArcGIS REST API.
- Parameters:
engine (Engine) – The engine used to connect to the database.
url (str = REC_API_URL) – The URL of the REC feature layer. Defaults to REC_API_URL.
- Returns:
A GeoDataFrame containing the fetched REC data in New Zealand.
- Return type:
gpd.GeoDataFrame
- Raises:
RuntimeError – If failed to fetch REC data.
- src.dynamic_boundary_conditions.river.river_data_from_niwa.fetch_backup_rec_data_from_niwa() geopandas.GeoDataFrame
Retrieve REC data in New Zealand from NIWA OpenData.
- Returns:
A GeoDataFrame containing the fetched REC data in New Zealand.
- Return type:
gpd.GeoDataFrame