gnome.outputters.geo_json¶
GeoJson outputter Does not contain a schema for persistence yet
Classes¶
class that outputs GNOME results in a geojson format. The output is a |
|
Class that outputs GNOME ice velocity results for each ice mover |
Module Contents¶
- class gnome.outputters.geo_json.TrajectoryGeoJsonOutput(round_data=True, round_to=4, output_dir=None, **kwargs)¶
Bases:
gnome.outputters.outputter.Outputter
class that outputs GNOME results in a geojson format. The output is a collection of Features. Each Feature contains a Point object with associated properties. Following is the format for a particle - the data in <> are the results for each element.
{ "type": "FeatureCollection", "features": [ { "geometry": { "type": "Point", "coordinates": [ <LONGITUDE>, <LATITUDE> ] }, "type": "Feature", "id": <PARTICLE_ID>, "properties": { "current_time": <TIME IN SEC SINCE EPOCH>, "status_code": <>, "spill_id": <UUID OF SPILL OBJECT THAT RELEASED PARTICLE>, "depth": <DEPTH>, "spill_type": <FORECAST OR UNCERTAIN>, "step_num": <OUTPUT ASSOCIATED WITH THIS STEP NUMBER> } }, ... }
- Parameters:
round_data=True (bool) – if True, then round the numpy arrays containing float to number of digits specified by ‘round_to’. Default is True
round_to=4 (int) – round float arrays to these number of digits. Default is 4.
output_dir=None (str) – output directory for geojson files. Default is None since data is returned in dict for webapi. For using write_output_post_run(), this must be set
use super to pass optional
**kwargs
to base class __init__ method- round_data = True¶
- round_to = 4¶
- output_dir = None¶
- write_output(step_num, islast_step=False)¶
dump data in geojson format
- output_to_file(json_content, step_num)¶
- clean_output_files()¶
Cleans out the output dir
This should be implemented by subclasses that dump files.
Each outputter type dumps different types of files, and this should only clear out those.
See the OutputterFilenameMixin for a simple example.
- class gnome.outputters.geo_json.IceGeoJsonOutput(ice_movers, **kwargs)¶
Bases:
gnome.outputters.outputter.Outputter
Class that outputs GNOME ice velocity results for each ice mover in a geojson format. The output is a collection of Features. Each Feature contains a Point object with associated properties. Following is the output format - the data in <> are the results for each element:
{ "time_stamp": <TIME IN ISO FORMAT>, "step_num": <OUTPUT ASSOCIATED WITH THIS STEP NUMBER>, "feature_collections": {<mover_id>: {"type": "FeatureCollection", "features": [{"type": "Feature", "id": <PARTICLE_ID>, "properties": {"ice_fraction": <FRACTION>, "ice_thickness": <METERS>, "water_velocity": [u, v], "ice_velocity": [u, v] }, "geometry": {"type": "Point", "coordinates": [<LONG>, <LAT>] }, }, ... ], }, ... } }
- Parameters:
ice_movers (An ice_mover object or sequence of ice_mover objects.) – ice_movers associated with this outputter.
Use super to pass optional
**kwargs
to base class __init__ method- clean_output_files()¶
Cleans out the output dir
This should be implemented by subclasses that dump files.
Each outputter type dumps different types of files, and this should only clear out those.
See the OutputterFilenameMixin for a simple example.
- write_output(step_num, islast_step=False)¶
dump data in geojson format
- get_coverage_fc(coverage, triangles)¶
- get_thickness_fc(thickness, triangles)¶
- get_grouped_fc_from_1d_array(values, triangles, property_name, decimals)¶
- get_rounded_ice_values(coverage, thickness)¶
- get_unique_ice_values(ice_values)¶
In order to make numpy perform this function fast, we will use a contiguous structured array using a view of a void type that joins the whole row into a single item.
- get_matching_ice_values(ice_values, v)¶
- rewind()¶
remove previously written files