koronascript 0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- koronascript-0.1/KoronaScript/Configuration.py +3 -0
- koronascript-0.1/KoronaScript/KoronaModule.py +64 -0
- koronascript-0.1/KoronaScript/Modules.py +295 -0
- koronascript-0.1/KoronaScript/__init__.py +78 -0
- koronascript-0.1/MANIFEST.in +1 -0
- koronascript-0.1/PKG-INFO +76 -0
- koronascript-0.1/README.md +67 -0
- koronascript-0.1/configuration/korona-info.json +2680 -0
- koronascript-0.1/koronascript.egg-info/PKG-INFO +76 -0
- koronascript-0.1/koronascript.egg-info/SOURCES.txt +12 -0
- koronascript-0.1/koronascript.egg-info/dependency_links.txt +1 -0
- koronascript-0.1/koronascript.egg-info/not-zip-safe +1 -0
- koronascript-0.1/koronascript.egg-info/top_level.txt +1 -0
- koronascript-0.1/setup.cfg +4 -0
- koronascript-0.1/setup.py +14 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
# Auto-generated, do not edit directly
|
|
2
|
+
# see genmodule.py
|
|
3
|
+
modules_spec = {'AngleDeletion': {'Active': True, 'Comment': ''}, 'BroadbandNotchFilter': {'Active': True, 'Comment': ''}, 'BroadbandSplitter': {'Active': True, 'Comment': '', 'AutoSplit': False, 'SplitCount': 3, 'StopBandDistance': 1.0, 'MinBandwidth': 10.0, 'Downsampling': 'FACTOR', 'DownsamplingFactor': 1, 'DownsamplingSampleSize': 0.01, 'ComputeAngles': True, 'ComputationalMethod': 'BANDPASS_FILTERING', 'FftWindowSize': 2.0}, 'BubblSpikeFilter': {'Active': True, 'Comment': '', 'LogarithmicValues': True, 'ShowDetails': False, 'OnlyLast': False, 'ChannelsToProcess': -1, 'AutomaticDepthRange': False, 'StartDepth': 10.0, 'EndDepth': 2500.0, 'TotalDelta': 15.0, 'VerticalDelta': 15.0, 'Debug': False, 'VerticalUnit': 'DURATION', 'VerticalMedianSearchHeight': 50, 'WindowMedianSearchHeight': 35, 'VerticalMedianSearchDuration': 2.0, 'WindowMedianSearchDuration': 4.4, 'VerticalMedianSearchDistance': 1.9, 'WindowMedianSearchDistance': 6.6}, 'Categorization': {'Active': True, 'Comment': '', 'CategoryCount': 3, 'ActiveFeatures': [], 'ActiveCategories': [], 'Categorizer': 'Gauss', 'Discriminant': 'Aposteriori', 'ContextualCorrection': 'ICM', 'ContextualIterations': 3, 'UseMinLogSv': True, 'MinLogSv': -100.0}, 'CdsViewer': {'Active': True, 'Comment': ''}, 'ChannelDataRemoval': {'Active': True, 'Comment': '', 'Channels': '', 'ChannelsFromEnd': '', 'Frequencies': '', 'KeepSpecified': False}, 'ChannelRemoval': {'Active': True, 'Comment': '', 'Channels': '', 'ChannelsFromEnd': '', 'Frequencies': '', 'KeepSpecified': False}, 'Combination': {'Active': True, 'Comment': '', 'FirstOperandKhz': 0, 'SecondOperandKhz': 0, 'FirstOperandChannel': 1, 'SecondOperandChannel': 2, 'LogarithmicOperands': False, 'Operation': 'mean'}, 'Comment': {'Active': True, 'Comment': '', 'GroupStart': False, 'GroupCollapsed': False, 'LineBreak': False, 'VerticalSpace': 8, 'Label': ''}, 'ComplexToReal': {'Active': True, 'Comment': '', 'ComputeAngles': True, 'KeepBroadband': False}, 'DataReduction': {'Active': True, 'Comment': '', 'BlindZone': False, 'MinRange': '', 'MinDepth': '', 'TransducerRange': True, 'MaxRange': '', 'MaxDepth': ''}, 'DepthDependentResampling': {'Active': True, 'Comment': '', 'MinFrequency': 150.0, 'SampleDistanceAtRange100': 0.0}, 'Depth': {'Active': True, 'Comment': '', 'Algorithm': 'EK500', 'MinDepthLimit': 10.0, 'MinDepthValueFraction': 0.001, 'SignalStrengthThreshold': -31.0, 'MinimumDepthThresholdFactor': 0.99, 'MaxRangeFactor': 1.5, 'AlwaysDetectBottom': True, 'MinBottomDepth': 0.0, 'MaxBottomDepth': 9999.0, 'MinKHz': 0.0, 'MaxKHz': 9999.0, 'DoNotUseKHz': ''}, 'Dilate': {'Active': True, 'Comment': '', 'LogarithmicValues': True, 'ShowDetails': False, 'OnlyLast': False, 'ChannelsToProcess': -1, 'AutomaticDepthRange': True, 'StartDepth': 10.0, 'EndDepth': 1000.0, 'VertResolution': 1}, 'Downsampling': {'Active': True, 'Comment': '', 'Downsampling': 'FACTOR', 'DownsamplingFactor': 1, 'DownsamplingSampleSize': 0.01}, 'ES60Correction': {'Active': True, 'Comment': '', 'ReliabilityDetectionWindow': 5, 'PerformScan': False, 'ContinueAcrossFiles': False}, 'EdgeDetection': {'Active': True, 'Comment': '', 'LogarithmicValues': True, 'ShowDetails': False, 'OnlyLast': False, 'ChannelsToProcess': -1, 'AutomaticDepthRange': True, 'StartDepth': 10.0, 'EndDepth': 1000.0, 'ScaleFactor': 1.0, 'VertResolution': 1}, 'EmptyPingRemoval': {'Active': True, 'Comment': ''}, 'ErodeLowValues': {'Active': True, 'Comment': '', 'LogarithmicValues': True, 'ShowDetails': False, 'OnlyLast': False, 'ChannelsToProcess': -1, 'AutomaticDepthRange': True, 'StartDepth': 10.0, 'EndDepth': 1000.0, 'Threshold': -70.0, 'ReplacementValue': -120.0, 'VerticalExtent': 1.0}, 'Erode': {'Active': True, 'Comment': '', 'LogarithmicValues': True, 'ShowDetails': False, 'OnlyLast': False, 'ChannelsToProcess': -1, 'AutomaticDepthRange': True, 'StartDepth': 10.0, 'EndDepth': 1000.0, 'VertResolution': 1}, 'Expression': {'Active': True, 'Comment': '', 'Expression': ['C1']}, 'FillMissingData': {'Active': True, 'Comment': ''}, 'Filter3X3': {'Active': True, 'Comment': '', 'LogarithmicValues': True, 'ShowDetails': False, 'OnlyLast': False, 'ChannelsToProcess': -1, 'AutomaticDepthRange': True, 'StartDepth': 10.0, 'EndDepth': 1000.0, 'FilterType': 'User defined', '00': 1.0, '01': 1.0, '02': 1.0, '10': 1.0, '11': 1.0, '12': 1.0, '20': 1.0, '21': 1.0, '22': 1.0}, 'FiskViewDisplay': {'Active': True, 'Comment': ''}, 'GroupEnd': {'Active': True, 'Comment': ''}, 'HorizontalOffsetCorrection': {'Active': True, 'Comment': ''}, 'Isolation': {'Active': True, 'Comment': '', 'Category': ''}, 'Median': {'Active': True, 'Comment': '', 'LogarithmicValues': True, 'ShowDetails': False, 'OnlyLast': False, 'ChannelsToProcess': -1, 'AutomaticDepthRange': True, 'StartDepth': 10.0, 'EndDepth': 1000.0}, 'NoiseAcceptance': {'Active': True, 'Comment': '', 'NoiseFraction': {'min': 0.25, 'max': 4.0}, 'UseFileNoiseFile': True, 'UseDayNoiseFile': True, 'UseSurveyNoiseFile': True, 'UseSurveyLowNoiseFile': True}, 'NoiseMedianQuantification': {'Active': True, 'Comment': '', 'PingHistory': 10, 'NoiseSamplesPerBeam': 100, 'DetectionDistance': 50.0, 'InnermostDistance': False}, 'NoiseQuantification': {'Active': True, 'Comment': '', 'Smooth': 'running averager', 'SmoothInterval': 5, 'Mask': 'dynamic', 'MinimumQuality': 60.0, 'ThresholdMasking': False, 'Threshold': -80.0, 'Histogram': 'geometric', 'UseTimeStepBuffer': True, 'TimeStepBufferMaxSize': 50, 'HistogramInitializationCellCount': 500, 'HistogramMaximumCellCount': 2000, 'HistogramInitializationSampleCount': 1000, 'HistogramMinimumSampleCount': 25000, 'HistogramSmooth': True, 'HistogramSmoothFactor': 100.0, 'SdevMasking': False, 'Sdev': 10.0, 'SNMasking': False, 'SNRatio': 10.0, 'UseFallbackNoiseQuantile': False, 'FallbackNoiseQuantile': 5.0, 'FallbackNoiseChannels': 'true', 'WritePlotParameters': False}, 'NoiseRemover': {'Active': True, 'Comment': '', 'RemoveNoiseFromStart': True, 'MaxBufferSize': 10}, 'NoiseVisualization': {'Active': True, 'Comment': '', 'UpdatePeriod': 20, 'TimeSeriesLength': 200, 'HistogramSpan': 3.0, 'MedianSampleCount': 500}, 'PingCollapsing': {'Active': True, 'Comment': ''}, 'PingThinning': {'Active': True, 'Comment': '', 'PingsToSkipInitially': 0, 'PingsToSkip': 0}, 'PlanktonInversion': {'Active': True, 'Comment': '', 'VerticalUnit': 'SAMPLES', 'PingsPerBin': 7, 'DepthSamplesPerBin': 30, 'DepthDurationPerBin': 4.0, 'DepthDistancePerBin': 6.0, 'Use global noise threshold': True, 'Noise threshold': -90.0, 'Use min depth': False, 'Min depth': 20.0, 'Use max depth': False, 'Max depth': 110.0, 'CategoriesUsedForInversion': [], 'UseAllFrequencies': True, 'ActiveFrequencies': [], 'MinResidualErrorThreshold': 0.01, 'MaxResidualErrorThreshold': 0.2, 'LevenbergMarquardtFactor': 0.0005, 'MaxIter': 4, 'HardShelled': True, 'HardShelledR': 0.5, 'GaseousSphere': True, 'GasSphereG': 0.0012, 'GasSphereH': 0.22, 'FluidSpheriod': True, 'FluidSpheriodG': 1.043, 'FluidSpheriodH': 1.052, 'FluidSpheriodBeta': 5.0, 'FluidBent': True, 'FluidBentR': 0.058, 'FluidBentS': 0.1, 'FluidBentBeta': 11.0, 'FluidBent2': False, 'FluidBentR2': 0.058, 'FluidBentS2': 0.1, 'FluidBentBeta 2': 11.0, 'SDWBA': False, 'SDWBA coeff': 'N(0, 30)', 'SDWBA2': False, 'SDWBA 2 coeff': 'N(0, 30)', 'SDWBA3': False, 'SDWBA 3 coeff': 'N(0, 30)', 'SDWBA4': False, 'SDWBA 4 coeff': 'N(0, 30)', 'SDWBA5': False, 'SDWBA 5 coeff': 'N(0, 30)', 'SDWBAS': False, 'SDWBA smooth coeff': 'N(4, 2)', 'PlotResolution': 0.01, 'PlotMaxRange': 5.0}, 'Plugin': {'Active': True, 'Comment': '', 'Example': '', 'Implementation': ''}, 'PulseCompressionFilter': {'Active': True, 'Comment': ''}, 'RemoveBottom': {'Active': True, 'Comment': '', 'LogarithmicValues': True, 'ShowDetails': False, 'OnlyLast': False, 'ChannelsToProcess': -1, 'AutomaticDepthRange': True, 'StartDepth': 10.0, 'EndDepth': 1000.0, 'UseNeighbours': False, 'Above': 0, 'Below': 100, 'RemoveAboveBottom': False, 'RemoveBottom': True, 'RemoveBelowBottom': False, 'PixelValue': -120.0}, 'Rescale': {'Active': True, 'Comment': '', 'RescaleChannels': 'all', 'DesiredMinimum': -85.0, 'DesiredMaximum': -30.0, 'MinMaxFraction': 0.05, 'InitializationDatagramCount': 10, 'InitializationMaxPingCount': 100}, 'SchoolCategorization': {'Active': True, 'Comment': '', 'UseCellCategorization': True, 'Horizontal cell size': 16, 'Vertical cell size': 50, 'Upper sample offset': 5, 'Lower sample offset': 5, 'HorizontalOffset': 0, 'SecondaryCategoryFraction': 0.1, 'Fill factor for cells': 0.5, 'MinFractionCategorizedCells': 0.5, 'MinCells': 3, 'SchoolCategorizationDistribution': 'CELL', 'EnableUncategorizedCategory': False, 'EnableUnknownCategory': False}, 'SchoolDetection': {'Active': True, 'Comment': '', 'ProcessLast': True, 'Channel': 1, 'MinDepth': '', 'MaxDepth': '', 'Threshold': -62.0, 'Density': {'min': -120.0, 'max': -20.0}, 'MaxSv': {'min': '-Infinity', 'max': 'Infinity'}, 'Length': {'min': 25.0, 'max': 1000000.0}, 'Thickness': {'min': 10.0, 'max': 1000000.0}, 'Area': {'min': 75.0, 'max': 1000000.0}, 'Compactness': {'min': '-Infinity', 'max': 'Infinity'}, 'FillHoles': True}, 'Smoother': {'Active': True, 'Comment': '', 'OnlyLastChannel': False, 'MaskPelagic': False, 'MaskBottom': True, 'MaskSecondBottom': True, 'MaskNoise': False, 'MaskRegion': 'none', 'MaskTrack': 'none', 'MinPing': 0, 'MaxPing': 10, 'HorizontalKernelType': 'gaussian', 'VerticalKernelType': 'gaussian', 'HorizontalWidth': 8.0, 'VerticalWidth': 0.5, 'LogarithmicValues': False}, 'SpikeFilter': {'Active': True, 'Comment': '', 'LogarithmicValues': True, 'ShowDetails': False, 'OnlyLast': False, 'ChannelsToProcess': -1, 'AutomaticDepthRange': False, 'StartDepth': 10.0, 'EndDepth': 2500.0, 'TotalDelta': 15.0, 'VerticalDelta': 15.0, 'Debug': False, 'VerticalUnit': 'DURATION', 'VerticalMedianSearchHeight': 7, 'WindowMedianSearchHeight': 35, 'VerticalMedianSearchDuration': 0.9, 'WindowMedianSearchDuration': 4.4, 'VerticalMedianSearchDistance': 1.3, 'WindowMedianSearchDistance': 6.6}, 'SpotNoise': {'Active': True, 'Comment': '', 'LogarithmicValues': True, 'ShowDetails': False, 'OnlyLast': False, 'ChannelsToProcess': -1, 'AutomaticDepthRange': False, 'StartDepth': 10.0, 'EndDepth': 2500.0, 'Delta': 20.0, 'Debug': False}, 'TemporaryComputationsBegin': {'Active': True, 'Comment': ''}, 'TemporaryComputationsEnd': {'Active': True, 'Comment': ''}, 'ThresholdAllChannels': {'Active': True, 'Comment': '', 'Criterion': 'BELOW', 'Threshold': -70.0, 'Replacement': -120.0, 'MinFrequency': '', 'MaxFrequency': ''}, 'Threshold': {'Active': True, 'Comment': '', 'LogarithmicValues': True, 'ShowDetails': False, 'OnlyLast': False, 'ChannelsToProcess': -1, 'AutomaticDepthRange': True, 'StartDepth': 10.0, 'EndDepth': 1000.0, 'Threshold': -70.0, 'CutBelow': False, 'CutAbove': False, 'BelowVal': -120.0, 'AboveVal': 0.0}, 'TimeInterval': {'Active': True, 'Comment': '', 'StartDateString': '', 'EndDateString': '', 'StartRelativePingNumber': '', 'EndRelativePingNumber': ''}, 'Towfish': {'Active': True, 'Comment': '', 'TowfishBlindZone': 0.0, 'TowfishEchosounderTimeAddition': 0.0, 'DistBehindFunction': 'PYTAGORAS'}, 'TrackFilter': {'Active': True, 'Comment': '', 'MaxBufferSize': 50, 'KeepValid': True}, 'Tracking': {'Active': True, 'Comment': '', 'TrackerType': 'Aggregation', 'kHz': 38, 'PlatformMotionType': 'Floating', 'MinTS': -66.0, 'PulseLengthDeterminationLevel': 6.0, 'MinEchoLength': 0.01, 'MaxEchoLength': 1.8, 'MaxGainCompensation': 6.0, 'DoPhaseDeviationCheck': True, 'MaxPhaseDevSteps': 8.0, 'MaxTS': 0.0, 'MaxDepth': '', 'MaxAlongshipAngle': 10.0, 'MaxAthwartshipAngle': 10.0, 'InitiationGateFunction': [{'id': 'Alpha', 'description': '', 'unit': 'degree', 'defaultValue': 2.8}, {'id': 'Beta', 'description': '', 'unit': 'degree', 'defaultValue': 2.8}, {'id': 'Range', 'description': '', 'unit': 'm', 'defaultValue': 0.1}, {'id': 'TS', 'description': 'dB', 'unit': 'dB', 'defaultValue': 20.0}], 'InitiationMinLength': 1, 'GateFunction': [{'id': 'Alpha', 'description': '', 'unit': 'degree', 'defaultValue': 2.8}, {'id': 'Beta', 'description': '', 'unit': 'degree', 'defaultValue': 2.8}, {'id': 'Range', 'description': '', 'unit': 'm', 'defaultValue': 0.1}, {'id': 'TS', 'description': 'dB', 'unit': 'dB', 'defaultValue': 20.0}], 'AlphaBetaEstimator': [{'id': 'Alpha', 'description': '', 'allowedValuesDescription': '[0, 1]', 'defaultValue': 0.5}, {'id': 'Beta', 'description': '', 'allowedValuesDescription': '[0, 1]', 'defaultValue': 0.5}], 'MaxMissingPings': 4, 'MaxMissingSamples': 2, 'MaxMissingPingsFraction': 0.5, 'MinTrackLength': 8, 'MinSampleToLengthFraction': 2.0}, 'TsDetection': {'Active': True, 'Comment': '', 'DetectorType': 'SED', 'MinTS': -66.0, 'PulseLengthDeterminationLevel': 6.0, 'MinEchoLength': 0.01, 'MaxEchoLength': 1.8, 'MaxGainCompensation': 6.0, 'DoPhaseDeviationCheck': True, 'MaxPhaseDevSteps': 8.0, 'MaxDepth': ''}, 'VerticalOffsetCorrection': {'Active': True, 'Comment': ''}, 'Writer': {'Active': True, 'Comment': '', 'FileName': '', 'UseRelativeDirectory': False, 'RelativeDirectory': '', 'DirectoryName': ''}, 'NetcdfWriter': {'Active': True, 'Comment': '', 'DirName': 'netcdf', 'MainFrequency': 38, 'WriterType': 'GRIDDED', 'DeltaRange': '', 'MaxRange': '', 'GriddedOutputType': 'SV_AND_ANGLES', 'WriteAngels': True, 'FftWindowSize': 2.0, 'DeltaFrequency': 1.0, 'ChannelGroupOutputType': 'PULSE_COMPRESSION'}}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
from .Configuration import modules_spec
|
|
2
|
+
|
|
3
|
+
global_spec = {
|
|
4
|
+
# 'ModuleConfiguration' : None, # cds file name, attrib 'ref' points to...what?
|
|
5
|
+
# <parameter name="ModuleConfiguration" ref="CfsDirectory">CW.cds</parameter>
|
|
6
|
+
# The following are None, or point to xml files (contents unknown)
|
|
7
|
+
'Categorization' : None,
|
|
8
|
+
'HorizontalTransducerOffsets' : None,
|
|
9
|
+
'VerticalTransducerOffsets' : None,
|
|
10
|
+
'TransducerRanges' : None,
|
|
11
|
+
'Plankton' : None,
|
|
12
|
+
'BroadbandNotchFilters' : None,
|
|
13
|
+
'PulseCompressionFilters' : None,
|
|
14
|
+
'BroadbandSplitterBands' : None,
|
|
15
|
+
'Towfish' : None,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
class KoronaModule():
|
|
19
|
+
'''Baseclass for modules'''
|
|
20
|
+
|
|
21
|
+
def __init__(self, name, **parameters):
|
|
22
|
+
'''initialize with parameter definitions'''
|
|
23
|
+
# check that the module exists
|
|
24
|
+
if name not in modules_spec:
|
|
25
|
+
print(f'Unknown Korona module "{name}" - aborting')
|
|
26
|
+
exit(-1)
|
|
27
|
+
self._name = name
|
|
28
|
+
self._config = {}
|
|
29
|
+
# Add defaults
|
|
30
|
+
for k,v in modules_spec[name].items():
|
|
31
|
+
self._config[k] = v
|
|
32
|
+
|
|
33
|
+
for k in parameters:
|
|
34
|
+
if k != 'Active' and not k in modules_spec[name]:
|
|
35
|
+
print(f'Parameter "{k}" not valid for Korona module "{name}" - aborting')
|
|
36
|
+
exit(-1)
|
|
37
|
+
self._config[k] = parameters[k]
|
|
38
|
+
|
|
39
|
+
def to_xml(self):
|
|
40
|
+
'''Generate XML output'''
|
|
41
|
+
res = ''
|
|
42
|
+
myname = self._name + 'Module'
|
|
43
|
+
res += (f' <module name="{myname}">\n')
|
|
44
|
+
res += (' <parameters>\n')
|
|
45
|
+
for k in self._config:
|
|
46
|
+
if self._config[k] is None:
|
|
47
|
+
res += f' <parameter name="{k}"/>\n'
|
|
48
|
+
elif isinstance(self._config[k],list):
|
|
49
|
+
res += f' <parameter name="{k}">'
|
|
50
|
+
for v in self._config[k]:
|
|
51
|
+
res += str(v)+','
|
|
52
|
+
res = res[:-1] # remove last comma
|
|
53
|
+
res += '</parameter>\n'
|
|
54
|
+
elif isinstance(self._config[k],dict):
|
|
55
|
+
res += f' <parameter name="{k}">\n'
|
|
56
|
+
# Should maybe call recursively? Can they be lists or dicts?
|
|
57
|
+
for key,val in self._config[k].items():
|
|
58
|
+
res += f' <parameter name="{key}">{val}</parameter>\n'
|
|
59
|
+
res += ' </parameter>\n'
|
|
60
|
+
else:
|
|
61
|
+
res += (f' <parameter name="{k}">{self._config[k]}</parameter>\n')
|
|
62
|
+
res += (' </parameters>\n')
|
|
63
|
+
res += (' </module>\n')
|
|
64
|
+
return res
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
# Auto-generated, do not edit directly
|
|
2
|
+
# see genmodule.py
|
|
3
|
+
from .Configuration import modules_spec
|
|
4
|
+
from .KoronaModule import KoronaModule
|
|
5
|
+
|
|
6
|
+
class AngleDeletion(KoronaModule):
|
|
7
|
+
"""Converts split beam data to single beam data"""
|
|
8
|
+
def __init__(self, **parameters):
|
|
9
|
+
super().__init__('AngleDeletion', **parameters)
|
|
10
|
+
|
|
11
|
+
class BroadbandNotchFilter(KoronaModule):
|
|
12
|
+
"""Applies notch filter(s) to broadband data"""
|
|
13
|
+
def __init__(self, **parameters):
|
|
14
|
+
super().__init__('BroadbandNotchFilter', **parameters)
|
|
15
|
+
|
|
16
|
+
class BroadbandSplitter(KoronaModule):
|
|
17
|
+
"""Splits broadband data into multiple single frequency channels"""
|
|
18
|
+
def __init__(self, **parameters):
|
|
19
|
+
super().__init__('BroadbandSplitter', **parameters)
|
|
20
|
+
|
|
21
|
+
class BubblSpikeFilter(KoronaModule):
|
|
22
|
+
"""Filters bubble spikes"""
|
|
23
|
+
def __init__(self, **parameters):
|
|
24
|
+
super().__init__('BubblSpikeFilter', **parameters)
|
|
25
|
+
|
|
26
|
+
class Categorization(KoronaModule):
|
|
27
|
+
"""Module for categorization"""
|
|
28
|
+
def __init__(self, **parameters):
|
|
29
|
+
super().__init__('Categorization', **parameters)
|
|
30
|
+
|
|
31
|
+
class CdsViewer(KoronaModule):
|
|
32
|
+
"""For viewing the module configuration stored in a processed file"""
|
|
33
|
+
def __init__(self, **parameters):
|
|
34
|
+
super().__init__('CdsViewer', **parameters)
|
|
35
|
+
|
|
36
|
+
class ChannelDataRemoval(KoronaModule):
|
|
37
|
+
"""Removes data on specified channels"""
|
|
38
|
+
def __init__(self, **parameters):
|
|
39
|
+
super().__init__('ChannelDataRemoval', **parameters)
|
|
40
|
+
|
|
41
|
+
class ChannelRemoval(KoronaModule):
|
|
42
|
+
"""Removes specified channels"""
|
|
43
|
+
def __init__(self, **parameters):
|
|
44
|
+
super().__init__('ChannelRemoval', **parameters)
|
|
45
|
+
|
|
46
|
+
class Combination(KoronaModule):
|
|
47
|
+
"""Module for generating combination echograms"""
|
|
48
|
+
def __init__(self, **parameters):
|
|
49
|
+
super().__init__('Combination', **parameters)
|
|
50
|
+
|
|
51
|
+
class Comment(KoronaModule):
|
|
52
|
+
"""For writing a comment"""
|
|
53
|
+
def __init__(self, **parameters):
|
|
54
|
+
super().__init__('Comment', **parameters)
|
|
55
|
+
|
|
56
|
+
class ComplexToReal(KoronaModule):
|
|
57
|
+
"""Converts complex data to real data. (Many modules require real data as input.)"""
|
|
58
|
+
def __init__(self, **parameters):
|
|
59
|
+
super().__init__('ComplexToReal', **parameters)
|
|
60
|
+
|
|
61
|
+
class DataReduction(KoronaModule):
|
|
62
|
+
"""Removes data below configured transducer range"""
|
|
63
|
+
def __init__(self, **parameters):
|
|
64
|
+
super().__init__('DataReduction', **parameters)
|
|
65
|
+
|
|
66
|
+
class DepthDependentResampling(KoronaModule):
|
|
67
|
+
"""Depth dependent resampling"""
|
|
68
|
+
def __init__(self, **parameters):
|
|
69
|
+
super().__init__('DepthDependentResampling', **parameters)
|
|
70
|
+
|
|
71
|
+
class Depth(KoronaModule):
|
|
72
|
+
"""Bottom depth detection module"""
|
|
73
|
+
def __init__(self, **parameters):
|
|
74
|
+
super().__init__('Depth', **parameters)
|
|
75
|
+
|
|
76
|
+
class Dilate(KoronaModule):
|
|
77
|
+
"""A dilation filter.<br>Each pixel gets the value of the max value of its neighbors"""
|
|
78
|
+
def __init__(self, **parameters):
|
|
79
|
+
super().__init__('Dilate', **parameters)
|
|
80
|
+
|
|
81
|
+
class Downsampling(KoronaModule):
|
|
82
|
+
"""Downsampling to reduce vertical resolution"""
|
|
83
|
+
def __init__(self, **parameters):
|
|
84
|
+
super().__init__('Downsampling', **parameters)
|
|
85
|
+
|
|
86
|
+
class ES60Correction(KoronaModule):
|
|
87
|
+
"""Removes the ES60 triangle noise"""
|
|
88
|
+
def __init__(self, **parameters):
|
|
89
|
+
super().__init__('ES60Correction', **parameters)
|
|
90
|
+
|
|
91
|
+
class EdgeDetection(KoronaModule):
|
|
92
|
+
"""Detects edges by using Sobel horizontal and vertical filter"""
|
|
93
|
+
def __init__(self, **parameters):
|
|
94
|
+
super().__init__('EdgeDetection', **parameters)
|
|
95
|
+
|
|
96
|
+
class EmptyPingRemoval(KoronaModule):
|
|
97
|
+
"""Deletes empty pings"""
|
|
98
|
+
def __init__(self, **parameters):
|
|
99
|
+
super().__init__('EmptyPingRemoval', **parameters)
|
|
100
|
+
|
|
101
|
+
class ErodeLowValues(KoronaModule):
|
|
102
|
+
"""Erode values in a spatial surrounding (given by vertical extent) - often used after top thresholding by means of Thresholding module"""
|
|
103
|
+
def __init__(self, **parameters):
|
|
104
|
+
super().__init__('ErodeLowValues', **parameters)
|
|
105
|
+
|
|
106
|
+
class Erode(KoronaModule):
|
|
107
|
+
"""An erode filter.<br>Each pixel gets the value of the min value of its neighbors"""
|
|
108
|
+
def __init__(self, **parameters):
|
|
109
|
+
super().__init__('Erode', **parameters)
|
|
110
|
+
|
|
111
|
+
class Expression(KoronaModule):
|
|
112
|
+
"""Module for generating combination echograms by an expression"""
|
|
113
|
+
def __init__(self, **parameters):
|
|
114
|
+
super().__init__('Expression', **parameters)
|
|
115
|
+
|
|
116
|
+
class FillMissingData(KoronaModule):
|
|
117
|
+
"""Creates missing pingdata"""
|
|
118
|
+
def __init__(self, **parameters):
|
|
119
|
+
super().__init__('FillMissingData', **parameters)
|
|
120
|
+
|
|
121
|
+
class Filter3X3(KoronaModule):
|
|
122
|
+
"""Class implementing a 3�3 filter"""
|
|
123
|
+
def __init__(self, **parameters):
|
|
124
|
+
super().__init__('Filter3X3', **parameters)
|
|
125
|
+
|
|
126
|
+
class FiskViewDisplay(KoronaModule):
|
|
127
|
+
"""Display module"""
|
|
128
|
+
def __init__(self, **parameters):
|
|
129
|
+
super().__init__('FiskViewDisplay', **parameters)
|
|
130
|
+
|
|
131
|
+
class GroupEnd(KoronaModule):
|
|
132
|
+
"""End of a module group"""
|
|
133
|
+
def __init__(self, **parameters):
|
|
134
|
+
super().__init__('GroupEnd', **parameters)
|
|
135
|
+
|
|
136
|
+
class HorizontalOffsetCorrection(KoronaModule):
|
|
137
|
+
"""Performs horizontal offset correction"""
|
|
138
|
+
def __init__(self, **parameters):
|
|
139
|
+
super().__init__('HorizontalOffsetCorrection', **parameters)
|
|
140
|
+
|
|
141
|
+
class Isolation(KoronaModule):
|
|
142
|
+
"""Isolates one category by zeroing out all pixels of different categories"""
|
|
143
|
+
def __init__(self, **parameters):
|
|
144
|
+
super().__init__('Isolation', **parameters)
|
|
145
|
+
|
|
146
|
+
class Median(KoronaModule):
|
|
147
|
+
"""Sets the pixel value to median of its 8 neighbors and itself"""
|
|
148
|
+
def __init__(self, **parameters):
|
|
149
|
+
super().__init__('Median', **parameters)
|
|
150
|
+
|
|
151
|
+
class NoiseAcceptance(KoronaModule):
|
|
152
|
+
"""Median noise acceptance"""
|
|
153
|
+
def __init__(self, **parameters):
|
|
154
|
+
super().__init__('NoiseAcceptance', **parameters)
|
|
155
|
+
|
|
156
|
+
class NoiseMedianQuantification(KoronaModule):
|
|
157
|
+
"""Median noise quantification"""
|
|
158
|
+
def __init__(self, **parameters):
|
|
159
|
+
super().__init__('NoiseMedianQuantification', **parameters)
|
|
160
|
+
|
|
161
|
+
class NoiseQuantification(KoronaModule):
|
|
162
|
+
"""Produces noise quantification datagrams"""
|
|
163
|
+
def __init__(self, **parameters):
|
|
164
|
+
super().__init__('NoiseQuantification', **parameters)
|
|
165
|
+
|
|
166
|
+
class NoiseRemover(KoronaModule):
|
|
167
|
+
"""Removes noise based on parameters in noise quantification datagrams"""
|
|
168
|
+
def __init__(self, **parameters):
|
|
169
|
+
super().__init__('NoiseRemover', **parameters)
|
|
170
|
+
|
|
171
|
+
class NoiseVisualization(KoronaModule):
|
|
172
|
+
"""Visualizes noise parameters in a separate window"""
|
|
173
|
+
def __init__(self, **parameters):
|
|
174
|
+
super().__init__('NoiseVisualization', **parameters)
|
|
175
|
+
|
|
176
|
+
class PingCollapsing(KoronaModule):
|
|
177
|
+
"""Collapses sequential pinging"""
|
|
178
|
+
def __init__(self, **parameters):
|
|
179
|
+
super().__init__('PingCollapsing', **parameters)
|
|
180
|
+
|
|
181
|
+
class PingThinning(KoronaModule):
|
|
182
|
+
"""Deletes pings"""
|
|
183
|
+
def __init__(self, **parameters):
|
|
184
|
+
super().__init__('PingThinning', **parameters)
|
|
185
|
+
|
|
186
|
+
class PlanktonInversion(KoronaModule):
|
|
187
|
+
"""Performs plankton inversion"""
|
|
188
|
+
def __init__(self, **parameters):
|
|
189
|
+
super().__init__('PlanktonInversion', **parameters)
|
|
190
|
+
|
|
191
|
+
class Plugin(KoronaModule):
|
|
192
|
+
"""Plugin (beta)"""
|
|
193
|
+
def __init__(self, **parameters):
|
|
194
|
+
super().__init__('Plugin', **parameters)
|
|
195
|
+
|
|
196
|
+
class PulseCompressionFilter(KoronaModule):
|
|
197
|
+
"""Applies pulse compression filter(s) to broadband data"""
|
|
198
|
+
def __init__(self, **parameters):
|
|
199
|
+
super().__init__('PulseCompressionFilter', **parameters)
|
|
200
|
+
|
|
201
|
+
class RemoveBottom(KoronaModule):
|
|
202
|
+
"""Removes bottom data"""
|
|
203
|
+
def __init__(self, **parameters):
|
|
204
|
+
super().__init__('RemoveBottom', **parameters)
|
|
205
|
+
|
|
206
|
+
class Rescale(KoronaModule):
|
|
207
|
+
"""Rescales some channels to fit into the logarithmic Sv range"""
|
|
208
|
+
def __init__(self, **parameters):
|
|
209
|
+
super().__init__('Rescale', **parameters)
|
|
210
|
+
|
|
211
|
+
class SchoolCategorization(KoronaModule):
|
|
212
|
+
"""Determines whether a school consists of one or more species, and categorizes the whole school<br>if the schools is a single species school"""
|
|
213
|
+
def __init__(self, **parameters):
|
|
214
|
+
super().__init__('SchoolCategorization', **parameters)
|
|
215
|
+
|
|
216
|
+
class SchoolDetection(KoronaModule):
|
|
217
|
+
"""Detects schools on a specified channel"""
|
|
218
|
+
def __init__(self, **parameters):
|
|
219
|
+
super().__init__('SchoolDetection', **parameters)
|
|
220
|
+
|
|
221
|
+
class Smoother(KoronaModule):
|
|
222
|
+
"""Performs smoothing by convolution"""
|
|
223
|
+
def __init__(self, **parameters):
|
|
224
|
+
super().__init__('Smoother', **parameters)
|
|
225
|
+
|
|
226
|
+
class SpikeFilter(KoronaModule):
|
|
227
|
+
"""Filters spikes"""
|
|
228
|
+
def __init__(self, **parameters):
|
|
229
|
+
super().__init__('SpikeFilter', **parameters)
|
|
230
|
+
|
|
231
|
+
class SpotNoise(KoronaModule):
|
|
232
|
+
"""Sets the pixel value to median of its 14 neighbors and itself provided original value is large compared to most neighbours"""
|
|
233
|
+
def __init__(self, **parameters):
|
|
234
|
+
super().__init__('SpotNoise', **parameters)
|
|
235
|
+
|
|
236
|
+
class TemporaryComputationsBegin(KoronaModule):
|
|
237
|
+
"""Start of temporary computations"""
|
|
238
|
+
def __init__(self, **parameters):
|
|
239
|
+
super().__init__('TemporaryComputationsBegin', **parameters)
|
|
240
|
+
|
|
241
|
+
class TemporaryComputationsEnd(KoronaModule):
|
|
242
|
+
"""End of temporary computations"""
|
|
243
|
+
def __init__(self, **parameters):
|
|
244
|
+
super().__init__('TemporaryComputationsEnd', **parameters)
|
|
245
|
+
|
|
246
|
+
class ThresholdAllChannels(KoronaModule):
|
|
247
|
+
"""Masks out values on all channels if some channels are too weak or too strong"""
|
|
248
|
+
def __init__(self, **parameters):
|
|
249
|
+
super().__init__('ThresholdAllChannels', **parameters)
|
|
250
|
+
|
|
251
|
+
class Threshold(KoronaModule):
|
|
252
|
+
"""Masks out values in specific range on individual channels"""
|
|
253
|
+
def __init__(self, **parameters):
|
|
254
|
+
super().__init__('Threshold', **parameters)
|
|
255
|
+
|
|
256
|
+
class TimeInterval(KoronaModule):
|
|
257
|
+
"""Module for processing only the pings in a specified time interval"""
|
|
258
|
+
def __init__(self, **parameters):
|
|
259
|
+
super().__init__('TimeInterval', **parameters)
|
|
260
|
+
|
|
261
|
+
class Towfish(KoronaModule):
|
|
262
|
+
"""Merges towfish data with main echosounder data"""
|
|
263
|
+
def __init__(self, **parameters):
|
|
264
|
+
super().__init__('Towfish', **parameters)
|
|
265
|
+
|
|
266
|
+
class TrackFilter(KoronaModule):
|
|
267
|
+
"""Filters rejected tracks"""
|
|
268
|
+
def __init__(self, **parameters):
|
|
269
|
+
super().__init__('TrackFilter', **parameters)
|
|
270
|
+
|
|
271
|
+
class Tracking(KoronaModule):
|
|
272
|
+
"""Tracks single targets"""
|
|
273
|
+
def __init__(self, **parameters):
|
|
274
|
+
super().__init__('Tracking', **parameters)
|
|
275
|
+
|
|
276
|
+
class TsDetection(KoronaModule):
|
|
277
|
+
"""Detects single targets"""
|
|
278
|
+
def __init__(self, **parameters):
|
|
279
|
+
super().__init__('TsDetection', **parameters)
|
|
280
|
+
|
|
281
|
+
class VerticalOffsetCorrection(KoronaModule):
|
|
282
|
+
"""Performs vertical offset correction"""
|
|
283
|
+
def __init__(self, **parameters):
|
|
284
|
+
super().__init__('VerticalOffsetCorrection', **parameters)
|
|
285
|
+
|
|
286
|
+
class Writer(KoronaModule):
|
|
287
|
+
"""Writes to a .raw file"""
|
|
288
|
+
def __init__(self, **parameters):
|
|
289
|
+
super().__init__('Writer', **parameters)
|
|
290
|
+
|
|
291
|
+
class NetcdfWriter(KoronaModule):
|
|
292
|
+
"""Writes to a .nc file"""
|
|
293
|
+
def __init__(self, **parameters):
|
|
294
|
+
super().__init__('NetcdfWriter', **parameters)
|
|
295
|
+
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Class to represent and run a sequence of Korona moduleapplications
|
|
2
|
+
# Example usage:
|
|
3
|
+
# ks = KoronaScript(global parameters)
|
|
4
|
+
# ks.add(KoronaModule(parametres)
|
|
5
|
+
# ks.add...
|
|
6
|
+
# ks.write(path)
|
|
7
|
+
# ks.run()
|
|
8
|
+
|
|
9
|
+
import subprocess
|
|
10
|
+
import tempfile
|
|
11
|
+
import os
|
|
12
|
+
import sys
|
|
13
|
+
import json
|
|
14
|
+
|
|
15
|
+
from .KoronaModule import KoronaModule, global_spec
|
|
16
|
+
|
|
17
|
+
class KoronaScript():
|
|
18
|
+
'''Construct, store, and run a set of Korona modules'''
|
|
19
|
+
|
|
20
|
+
def __init__(self, **parameters): # global parameters
|
|
21
|
+
self._module_list = []
|
|
22
|
+
self._config = global_spec
|
|
23
|
+
for k in parameters:
|
|
24
|
+
if k not in global_spec:
|
|
25
|
+
print(f'Unknown global parameter "{k}" - aborting')
|
|
26
|
+
exit(-1)
|
|
27
|
+
self._config[k] = parameters[k]
|
|
28
|
+
|
|
29
|
+
def add(self, module):
|
|
30
|
+
'''Add a module to the script'''
|
|
31
|
+
self._module_list.append(module)
|
|
32
|
+
return self
|
|
33
|
+
|
|
34
|
+
def write(self, cfs=sys.stdout, cds=sys.stdout, cdsname=None):
|
|
35
|
+
'''Write the cds and cfs files'''
|
|
36
|
+
cfs.write('<?xml version="1.0" encoding="UTF-8"?>\n\n')
|
|
37
|
+
cfs.write('<ConfigFiles context="Korona">\n')
|
|
38
|
+
cfs.write(f' <parameter name="ModuleConfiguration" ref="CfsDirectory">{cdsname}</parameter>\n')
|
|
39
|
+
for k,v in self._config.items():
|
|
40
|
+
if v is None:
|
|
41
|
+
cfs.write(f' <parameter name="{k}"/>\n')
|
|
42
|
+
else:
|
|
43
|
+
cfs.write(f' <parameter name="{k}">{v}</parameter>\n')
|
|
44
|
+
cfs.write('</ConfigFiles>\n')
|
|
45
|
+
|
|
46
|
+
cds.write('<?xml version="1.0" encoding="UTF-8"?>\n\n')
|
|
47
|
+
cds.write('<ModuleContainer version="3">\n')
|
|
48
|
+
cds.write(' <modules>\n')
|
|
49
|
+
for m in self._module_list:
|
|
50
|
+
cds.write(m.to_xml())
|
|
51
|
+
cds.write(' </modules>\n')
|
|
52
|
+
cds.write('</ModuleContainer>\n')
|
|
53
|
+
|
|
54
|
+
def run(self, src, dst):
|
|
55
|
+
'''Save the files (to /tmp?) and call Korona to execute them'''
|
|
56
|
+
cfs, cfsname = tempfile.mkstemp(suffix='.cfs')
|
|
57
|
+
cds, cdsname = tempfile.mkstemp(suffix='.cds')
|
|
58
|
+
with os.fdopen(cds, 'w') as cdsfd:
|
|
59
|
+
with os.fdopen(cfs, 'w') as cfsfd:
|
|
60
|
+
self.write(cfs=cfsfd, cds=cdsfd, cdsname=cdsname)
|
|
61
|
+
|
|
62
|
+
# if os.getenv('JAVA_HOME'): (...)
|
|
63
|
+
lsss = os.getenv('LSSS')
|
|
64
|
+
if lsss is None:
|
|
65
|
+
print('LSSS environment variable not specified')
|
|
66
|
+
exit(-1)
|
|
67
|
+
os.environ['TOP_INSTALLATION_DIR'] = lsss
|
|
68
|
+
|
|
69
|
+
java = lsss+'/jre/bin/java'
|
|
70
|
+
|
|
71
|
+
# "-Xmx${MAX_MEMORY_MB}m" -classpath "$TOP_INSTALLATION_DIR/lib/jar/*" "-Djava.library.path=$JAVA_LIBRARY_PATH" "-Djna.library.path=$JAVA_LIBRARY_PATH" -XX:-UseGCOverheadLimit -XX:-OmitStackTraceInFastThrow -Dno.marec.incubator=true no.imr.korona.main.KoronaCliMain "$@"
|
|
72
|
+
javaopts = ['-classpath', f'{lsss}/lib/jar/*', '-Dno.marec.incubator=true', 'no.imr.korona.main.KoronaCliMain']
|
|
73
|
+
res = subprocess.run([java] + javaopts + ['batch', '--cfs', cfsname, '--source', src, '--destination', dst])
|
|
74
|
+
print(res.stdout)
|
|
75
|
+
if res.returncode != 0:
|
|
76
|
+
print(f'Warning: Java subprocess returned error code {res.returncode}')
|
|
77
|
+
print('Errors:')
|
|
78
|
+
print(res.stderr)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include configuration/korona-info.json
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: koronascript
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Wrapper around Korona modules for processing echosounder data
|
|
5
|
+
Home-page: https://github.com/CRIMAC-WP4-Machine-learning/CRIMAC-KoronaScript
|
|
6
|
+
Author: Ketil Malde
|
|
7
|
+
Author-email: ketil@malde.org
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# Running Korona through Python
|
|
11
|
+
|
|
12
|
+
## Prerequisites
|
|
13
|
+
|
|
14
|
+
### Install LSSS/Korona.
|
|
15
|
+
|
|
16
|
+
This version of the KoronaScript is tested against lsss-2.16.0-alpha
|
|
17
|
+
version. LSSS and korona is usually placed at
|
|
18
|
+
`~/lsss/lsss-2.16.0-alpha` or a similar directory.
|
|
19
|
+
|
|
20
|
+
Download the appropriate version from here:
|
|
21
|
+
|
|
22
|
+
https://marec.no/tmp/lsss-2.16.0-alpha-20230922-1417-linux.zip
|
|
23
|
+
|
|
24
|
+
https://marec.no/tmp/lsss-2.16.0-alpha-20230922-1417-windows.zip
|
|
25
|
+
|
|
26
|
+
If you run linux you need to install the netcdf library separately:
|
|
27
|
+
|
|
28
|
+
`apt-get install libnetcdf`
|
|
29
|
+
|
|
30
|
+
### Add license
|
|
31
|
+
|
|
32
|
+
You need an LSSS licence. The licence have to be added according to the LSSS manual. the licence files are typically placed at the `~/marec/license` directory.
|
|
33
|
+
|
|
34
|
+
### Set system variables
|
|
35
|
+
|
|
36
|
+
This can be set at run time either by setting the LSSS environment
|
|
37
|
+
variable in the shell
|
|
38
|
+
~~~
|
|
39
|
+
export LSSS=~/lsss-2.16.0-alpha/korona
|
|
40
|
+
~~~
|
|
41
|
+
before running your script, or by adding to path
|
|
42
|
+
~~~
|
|
43
|
+
lsss = '~/lsss-2.16.0-alpha/korona'
|
|
44
|
+
os.environ["LSSS"] = lsss
|
|
45
|
+
~~~
|
|
46
|
+
pointing at the LSSS environment to your script.
|
|
47
|
+
|
|
48
|
+
# Usage
|
|
49
|
+
|
|
50
|
+
Import the modules:
|
|
51
|
+
|
|
52
|
+
import KoronaScript as ks
|
|
53
|
+
import KoronaScript.Modules as ksm
|
|
54
|
+
|
|
55
|
+
Create a script object:
|
|
56
|
+
|
|
57
|
+
ks = ks.KoronaScript(Categorization='categorization.xml',
|
|
58
|
+
HorizontalTransducerOffsets='HorizontalTransducerOffsets.xml')
|
|
59
|
+
|
|
60
|
+
Add some modules:
|
|
61
|
+
|
|
62
|
+
ks.add(ksm.EmptyPingRemoval())
|
|
63
|
+
ks.add(ksm.Comment(LineBreak='false', Label='CW_0256ms'))
|
|
64
|
+
ks.add(ksm.ChannelRemoval(Channels=[1,5,9,13,17],KeepSpecified='true'))
|
|
65
|
+
ks.add(ksm.Writer(RelativeDirectory='CW_0256ms'))
|
|
66
|
+
|
|
67
|
+
Write out the resulting configuration:
|
|
68
|
+
|
|
69
|
+
ks.write()
|
|
70
|
+
|
|
71
|
+
Run the script:
|
|
72
|
+
|
|
73
|
+
ks.run(src="input_dir", dst="output_dir")
|
|
74
|
+
|
|
75
|
+
The list of modules and their parameters can be found in the
|
|
76
|
+
[configuration/korona-info.json](configuration/korona-info.json) file.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Running Korona through Python
|
|
2
|
+
|
|
3
|
+
## Prerequisites
|
|
4
|
+
|
|
5
|
+
### Install LSSS/Korona.
|
|
6
|
+
|
|
7
|
+
This version of the KoronaScript is tested against lsss-2.16.0-alpha
|
|
8
|
+
version. LSSS and korona is usually placed at
|
|
9
|
+
`~/lsss/lsss-2.16.0-alpha` or a similar directory.
|
|
10
|
+
|
|
11
|
+
Download the appropriate version from here:
|
|
12
|
+
|
|
13
|
+
https://marec.no/tmp/lsss-2.16.0-alpha-20230922-1417-linux.zip
|
|
14
|
+
|
|
15
|
+
https://marec.no/tmp/lsss-2.16.0-alpha-20230922-1417-windows.zip
|
|
16
|
+
|
|
17
|
+
If you run linux you need to install the netcdf library separately:
|
|
18
|
+
|
|
19
|
+
`apt-get install libnetcdf`
|
|
20
|
+
|
|
21
|
+
### Add license
|
|
22
|
+
|
|
23
|
+
You need an LSSS licence. The licence have to be added according to the LSSS manual. the licence files are typically placed at the `~/marec/license` directory.
|
|
24
|
+
|
|
25
|
+
### Set system variables
|
|
26
|
+
|
|
27
|
+
This can be set at run time either by setting the LSSS environment
|
|
28
|
+
variable in the shell
|
|
29
|
+
~~~
|
|
30
|
+
export LSSS=~/lsss-2.16.0-alpha/korona
|
|
31
|
+
~~~
|
|
32
|
+
before running your script, or by adding to path
|
|
33
|
+
~~~
|
|
34
|
+
lsss = '~/lsss-2.16.0-alpha/korona'
|
|
35
|
+
os.environ["LSSS"] = lsss
|
|
36
|
+
~~~
|
|
37
|
+
pointing at the LSSS environment to your script.
|
|
38
|
+
|
|
39
|
+
# Usage
|
|
40
|
+
|
|
41
|
+
Import the modules:
|
|
42
|
+
|
|
43
|
+
import KoronaScript as ks
|
|
44
|
+
import KoronaScript.Modules as ksm
|
|
45
|
+
|
|
46
|
+
Create a script object:
|
|
47
|
+
|
|
48
|
+
ks = ks.KoronaScript(Categorization='categorization.xml',
|
|
49
|
+
HorizontalTransducerOffsets='HorizontalTransducerOffsets.xml')
|
|
50
|
+
|
|
51
|
+
Add some modules:
|
|
52
|
+
|
|
53
|
+
ks.add(ksm.EmptyPingRemoval())
|
|
54
|
+
ks.add(ksm.Comment(LineBreak='false', Label='CW_0256ms'))
|
|
55
|
+
ks.add(ksm.ChannelRemoval(Channels=[1,5,9,13,17],KeepSpecified='true'))
|
|
56
|
+
ks.add(ksm.Writer(RelativeDirectory='CW_0256ms'))
|
|
57
|
+
|
|
58
|
+
Write out the resulting configuration:
|
|
59
|
+
|
|
60
|
+
ks.write()
|
|
61
|
+
|
|
62
|
+
Run the script:
|
|
63
|
+
|
|
64
|
+
ks.run(src="input_dir", dst="output_dir")
|
|
65
|
+
|
|
66
|
+
The list of modules and their parameters can be found in the
|
|
67
|
+
[configuration/korona-info.json](configuration/korona-info.json) file.
|