Newer
Older
# Usage Example
from enstools.feature.pipeline import FeaturePipeline
from enstools.feature.identification.template import IdentificationTemplate
from enstools.feature.tracking.template_object_compare import TrackingCompareTemplate
from enstools.feature.tracking.template import TrackingTemplate
from enstools.feature.identification._proto_gen import template_pb2
from os.path import expanduser
# set the pb_reference to the compiled pb2.py file (see proto_gen directory)
pipeline = FeaturePipeline(template_pb2)
# change this to an identification technique that actually does something: existing one or implement your own
i_strat = IdentificationTemplate(some_parameter='foo') # set the Identification strategy
t_strat = TrackingTemplate() # set the tracking strategy
pipeline.set_identification_strategy(i_strat)
pipeline.set_tracking_strategy(t_strat) # or None as argument if no tracking
path = expanduser("~") + '/phd/data/tracked/feature/enstools_feature_test.nc' # ERA5/vietnam/t0_glob.nc' # tracked/feature/enstools_feature_test.nc' # set data path(s) here
pipeline.set_data_path(path)
pipeline.execute()
out_json_path = path + '.json' # set path to out-json, and also if needed out-netcdf
pipeline.save_result(description_type='json', description_path=out_json_path, dataset_path=None)