Newer
Older
Christoph Fischer
committed
# Usage Example
from enstools.feature.pipeline import FeaturePipeline
from enstools.feature.identification.african_easterly_waves import AEWIdentification
from enstools.feature.tracking.african_easterly_waves import AEWTracking
from enstools.feature.identification._proto_gen import african_easterly_waves_pb2
from os.path import expanduser, join
from enstools.feature.identification.african_easterly_waves.plotting import plot_timesteps_from_desc, plot_waves_from_desc
Christoph Fischer
committed
pipeline = FeaturePipeline(african_easterly_waves_pb2)
Christoph Fischer
committed
# init AEWIdentification strategy, can take different parameters
i_strat = AEWIdentification()
t_strat = AEWTracking()
Christoph Fischer
committed
pipeline.set_identification_strategy(i_strat)
pipeline.set_tracking_strategy(t_strat)
Christoph Fischer
committed
data_path = join(expanduser("~") + '/phd/data/aew/cv/*.nc')
Christoph Fischer
committed
pipeline.set_data_path(data_path)
# execute pipeline
pipeline.execute()
# TODO
# pipeline.save_as_json_graph() -> for each set: all (time,obj) pairs, with connections
# result has only connections.
Christoph Fischer
committed
# out_netcdf_path = data_path + '_streamers.nc'
out_json_path = data_path[:-4] + 'aew_desc.json'
out_graph_path = data_path[:-4] + 'aew_graph.json'
Christoph Fischer
committed
pipeline.save_result(description_type='json', description_path=out_json_path, graph_path=out_graph_path)
od = pipeline.get_object_desc()
gd = pipeline.get_graph_desc()
Christoph Fischer
committed
Christoph Fischer
committed
# plot_timesteps_from_desc(od, pipeline.get_data())
# plot_waves_from_desc(od, pipeline.get_data())