Observations API¶
Helios Observations API.
Methods are meant to represent the core functionality in the developer documentation. Some may have additional functionality for convenience.
-
class
helios.observations_api.
Observations
(session=None)[source]¶ The Observations API provides ground-truth data generated by the Helios analytics.
-
index
(**kwargs)[source]¶ Get observations matching the provided spatial, text, or metadata filters.
The maximum skip value is 4000. If this is reached, truncated results will be returned. You will need to refine your query to avoid this.
Parameters: **kwargs – Any keyword arguments found in the observations_index_documentation. Returns: - A tuple containing:
- feature_collection (
ObservationsFeatureCollection
): - Observations feature collection.
- failed (list of
Record
): - Failed API call records.
- feature_collection (
Return type: tuple
-
preview
(observation_ids, out_dir=None, return_image_data=False)[source]¶ Get preview images from observations.
Parameters: - observation_ids (str or list of strs) – list of observation IDs.
- out_dir (optional, str) – Directory to write images to. Defaults to None.
- return_image_data (optional, bool) – If True images will be available as PIL images in the returned ImageRecords. Defaults to False.
Returns: - A tuple containing:
- images (list of
ImageRecord
): All received images.
- failed (list of
ImageRecord
): Failed API calls.
- images (list of
Return type: tuple
-
show
(observation_ids)[source]¶ Get attributes for observations.
Parameters: observation_ids (str or list of strs) – Helios observation ID(s). Returns: - A tuple containing:
- feature_collection (
ObservationsFeatureCollection
): - Observations feature collection.
- failed (list of
Record
): - Failed API call records.
- feature_collection (
Return type: tuple
-
-
class
helios.observations_api.
ObservationsFeature
(feature)[source]¶ Individual Observation GeoJSON feature.
-
city
¶ ‘city’ value for the feature.
Type: str
-
country
¶ ‘country’ value for the feature.
Type: str
-
description
¶ ‘description’ value for the feature.
Type: str
-
id
¶ ‘id’ value for the feature.
Type: str
-
json
¶ Raw JSON feature.
Type: dict
-
prev_id
¶ ‘prev_id’ value for the feature.
Type: str
-
region
¶ ‘region’ value for the feature.
Type: str
-
sensors
¶ ‘sensors’ value for the feature.
Type: dict
-
state
¶ ‘state’ value for the feature.
Type: str
-
time
¶ ‘time’ value for the feature.
Type: str
-
-
class
helios.observations_api.
ObservationsFeatureCollection
(features)[source]¶ Collection of GeoJSON features obtained via the Observations API.
Convenience properties are available to extract values from every feature.
-
features
¶ All features returned from a query.
Type: list of ObservationsFeature
-
city
¶ ‘city’ values for every feature.
-
country
¶ ‘country’ values for every feature.
-
description
¶ ‘description’ values for every feature.
-
id
¶ ‘id’ values for every feature.
-
json
¶ Raw ‘json’ for every feature.
-
observations
¶ Observation data from the sensor block of each feature.
Data will be returned as a dictionary with a key for each sensor. Observation data for each sensor is a named tuple ease-of-use.
Each named tuple contains the sensor, time, data, prev, id, and prev_id.
-
prev_id
¶ ‘prev_id’ values for every feature.
-
region
¶ ‘region’ values for every feature.
-
sensors
¶ ‘sensors’ values for every feature.
-
state
¶ ‘state’ values for every feature.
-
time
¶ ‘time’ values for every feature.
-