Utilities¶
json_utils¶
Helper functions for JSON objects.
-
helios.utilities.json_utils.
merge_json
(data, keys)[source]¶ Merge JSON fields into a single list.
Keys can either be a single string or a list of strings signifying a chain of “keys” into the dictionary.
Parameters: - data (list) – Dictionary to merge data from.
- keys (str or sequence of strs) – A chain of keys into the dictionary to get to the field that will be merged.
Returns: Merged values.
Return type: list
-
helios.utilities.json_utils.
read_json_file
(json_file, **kwargs)[source]¶ Read a json file.
Parameters: - json_file (str) – Full path to JSON file.
- **kwargs – Any keyword argument from the json.load method.
Returns: JSON formatted dictionary.
Return type: dict
parsing_utils¶
Helper functions for paths and URLs.
-
helios.utilities.parsing_utils.
parse_camera
(data)[source]¶ Parse camera name from a URL or image name.
Parameters: data (str) – Image URL or name. Returns: Camera name. Return type: str
-
helios.utilities.parsing_utils.
parse_image_name
(url)[source]¶ Parse image name from a URL.
Parameters: url (str) – Image URL. Returns: Image name. Return type: str
data_utils¶
Utilities for working with SDK results.
-
helios.utilities.data_utils.
concatenate_feature_collections
(*args)[source]¶ Concatenates FeatureCollections.
import helios from helios.utilities.data_utils import concatenate_feature_collections cameras = helios.client('cameras') results1, failed = cameras.index(state='new york') results2, failed = cameras.index(state='maryland') combined = concatenate_feature_collections((results1, results2))
Parameters: args – (fc0, fc1, fc2, …) FeatureCollections to be combined. All FeatureCollections must be of the same type. Returns: FeatureCollection of the same API type as the input. Return type: FeatureCollection