kiwis_pie package
Subpackages
Submodules
kiwis_pie.kiwis module
- class kiwis_pie.kiwis.KIWIS(server_url, strict_mode=True, verify_ssl=True, headers=None)[source]
Bases:
objectProvides access to the KiWIS API at a specified end point.
- Parameters:
server_url (string) – The URL to the KiWIS server.
strict_mode (boolean) – Perform validation on query options passed as kwargs and the return_fields list if True. Otherwise pass through to the KiWIS API which may result in a 500 error if the query option/return field isn’t valid. Default: True
verify_ssl (boolean | str) – (optional) Passed through to [requests](https://requests.readthedocs.io/en/latest/api/#requests.request). Either a boolean, in which case it controls whether we verify the server’s TLS certificate, or a string, in which case it must be a path to a CA bundle to use. Defaults to True.
headers (dict[str, Any]) – HTTP headers to pass along with the GET request to the KiWIS server.
- get_parameter_list(return_fields=None, keep_tz=False, verify=True, **kwargs)
Python method to query the ‘getParameterList’ KiWIS method.
Keyword arguments are those available in the ‘Query field’ name list below. That is the keywords match the Queryfield names used by KiWIS.
- Parameters:
keep_tz (boolean) – Set to true to prevent the series datetimes from being converted to UTC. This optional argument only applies when the returned data includes data with timestamps.
return_fields (list(string)) –
Optional keyword argument, which is a list made up from the following available fields:
station_no,
station_id,
station_name,
site_no,
site_id,
site_name,
stationparameter_id,
stationparameter_name,
stationparameter_no,
stationparameter_longname,
parametertype_id,
parametertype_name,
parametertype_longname,
parametertype_shortunitname,
parametertype_unitname.
kwargs – Queryfield name for keyword argument. Refer to table:
Queryfield name
* as wildcard
accepts list
station_no
no
yes
station_id
no
yes
station_name
yes
yes
site_False
no
yes
site_id
no
yes
site_name
yes
yes
stationparameter_id
no
yes
stationparameter_name
yes
yes
stationparameter_no
no
yes
stationparameter_longname
yes
yes
parametertype_id
no
yes
parametertype_name
yes
yes
parametertype_longname
yes
yes
- Returns:
Pandas DataFrame with columns based on the default return from KiWIS or based on the return_fields specified.
- Return type:
pandas.DataFrame
- get_parameter_type_list(return_fields=None, keep_tz=False, verify=True, **kwargs)
Python method to query the ‘getParameterTypeList’ KiWIS method.
Keyword arguments are those available in the ‘Query field’ name list below. That is the keywords match the Queryfield names used by KiWIS.
- Parameters:
keep_tz (boolean) – Set to true to prevent the series datetimes from being converted to UTC. This optional argument only applies when the returned data includes data with timestamps.
return_fields (list(string)) –
Optional keyword argument, which is a list made up from the following available fields:
.
kwargs – Queryfield name for keyword argument. Refer to table:
Queryfield name
* as wildcard
accepts list
parametertype_id
no
yes
parametertype_name
yes
yes
- Returns:
Pandas DataFrame with columns based on the default return from KiWIS or based on the return_fields specified.
- Return type:
pandas.DataFrame
- get_site_list(return_fields=None, keep_tz=False, verify=True, **kwargs)
Python method to query the ‘getSiteList’ KiWIS method.
Keyword arguments are those available in the ‘Query field’ name list below. That is the keywords match the Queryfield names used by KiWIS.
- Parameters:
keep_tz (boolean) – Set to true to prevent the series datetimes from being converted to UTC. This optional argument only applies when the returned data includes data with timestamps.
return_fields (list(string)) –
Optional keyword argument, which is a list made up from the following available fields:
site_no,
site_id,
site_name,
site_latitude,
site_longitude,
site_carteasting,
site_cartnorthing,
site_type_name,
site_type_shortname,
parametertype_id,
parametertype_name,
stationparameter_name,
site_georefsystem,
custom_attributes.
kwargs – Queryfield name for keyword argument. Refer to table:
Queryfield name
* as wildcard
accepts list
site_no
no
yes
site_id
no
yes
site_name
no
yes
parametertype_id
no
yes
parametertype_name
yes
yes
stationparameter_name
yes
yes
bbox
n/a
n/a
- Returns:
Pandas DataFrame with columns based on the default return from KiWIS or based on the return_fields specified.
- Return type:
pandas.DataFrame
- get_station_list(return_fields=None, keep_tz=False, verify=True, **kwargs)
Python method to query the ‘getStationList’ KiWIS method.
Keyword arguments are those available in the ‘Query field’ name list below. That is the keywords match the Queryfield names used by KiWIS.
- Parameters:
keep_tz (boolean) – Set to true to prevent the series datetimes from being converted to UTC. This optional argument only applies when the returned data includes data with timestamps.
return_fields (list(string)) –
Optional keyword argument, which is a list made up from the following available fields:
station_no,
station_id,
station_name,
catchment_no,
catchment_id,
catchment_name,
station_latitude,
station_longitude,
station_carteasting,
station_cartnorthing,
site_no,
site_id,
site_name,
parametertype_id,
parametertype_name,
stationparameter_name,
object_type,
station_georefsystem,
station_longname,
custom_attributes.
kwargs – Queryfield name for keyword argument. Refer to table:
Queryfield name
* as wildcard
accepts list
station_no
yes
yes
station_id
no
yes
station_name
yes
yes
catchment_no
no
yes
catchment_id
no
yes
catchment_name
yes
yes
site_no
no
yes
site_id
no
yes
site_name
no
yes
stationgroup_id
no
no
parametertype_id
no
yes
parametertype_name
yes
yes
stationparameter_name
yes
yes
bbox
n/a
n/a
- Returns:
Pandas DataFrame with columns based on the default return from KiWIS or based on the return_fields specified.
- Return type:
pandas.DataFrame
- get_timeseries_list(return_fields=None, keep_tz=False, verify=True, **kwargs)
Python method to query the ‘getTimeseriesList’ KiWIS method.
Keyword arguments are those available in the ‘Query field’ name list below. That is the keywords match the Queryfield names used by KiWIS.
- Parameters:
keep_tz (boolean) – Set to true to prevent the series datetimes from being converted to UTC. This optional argument only applies when the returned data includes data with timestamps.
return_fields (list(string)) –
Optional keyword argument, which is a list made up from the following available fields:
station_no,
station_id,
station_name,
station_latitude,
station_longitude,
station_carteasting,
station_cartnorthing,
station_georefsystem,
station_longname,
ts_id,
ts_name,
ts_shortname,
ts_pat,
parametertype_id,
parametertype_name,
stationparameter_name,
stationparameter_longname,
ts_unitname,
ts_unitsymbol,
ts_unitname_abs,
ts_unitsymbol_abs,
coverage,
ts_density,
datacart.
kwargs – Queryfield name for keyword argument. Refer to table:
Queryfield name
* as wildcard
accepts list
station_no
yes
yes
station_id
no
yes
station_name
yes
yes
ts_id
no
yes
ts_path
yes
yes
ts_name
yes
yes
ts_shortname
yes
yes
ts_type_id
no
yes
parametertype_id
no
yes
parametertype_name
yes
yes
stationparameter_name
yes
yes
stationparameter_no
no
yes
ts_unitname
yes
yes
timeseriesgroup_id
no
no
fulltext
yes
no
- Returns:
Pandas DataFrame with columns based on the default return from KiWIS or based on the return_fields specified.
- Return type:
pandas.DataFrame
- get_timeseries_values(return_fields=None, keep_tz=False, verify=True, **kwargs)
Python method to query the ‘getTimeseriesValues’ KiWIS method.
Keyword arguments are those available in the ‘Query field’ name list below. That is the keywords match the Queryfield names used by KiWIS.
- Parameters:
keep_tz (boolean) – Set to true to prevent the series datetimes from being converted to UTC. This optional argument only applies when the returned data includes data with timestamps.
return_fields (list(string)) –
Optional keyword argument, which is a list made up from the following available fields:
Timestamp,
Value,
Interpolation Type,
Quality Code,
Aggregation,
Accuracy,
Absolute Value,
AV Interpolation,
Type,
AV Quality Code,
Runoff Value,
RV Interpolation,
Type,
RV Quality Code.
kwargs – Queryfield name for keyword argument. Refer to table:
Queryfield name
* as wildcard
accepts list
ts_id
no
yes
timeseriesgroup_id
no
yes
ts_path
yes
yes
from
n/a
n/a
to
n/a
n/a
period
n/a
n/a
timezone
no
n/a
- Returns:
Pandas DataFrame with columns based on the default return from KiWIS or based on the return_fields specified.
- Return type:
pandas.DataFrame
- exception kiwis_pie.kiwis.KIWISError[source]
Bases:
ExceptionException for when the KiWIS service responds with an error.