Skip to content

Commit a1c6266

Browse files
committed
init sequence_processor.py
1 parent 939c221 commit a1c6266

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
"""
2+
Contains main class for processing sequence data
3+
"""
4+
5+
from hypernets_processor.version import __version__
6+
from hypernets_processor.calibration.calibrate import Calibrate
7+
from hypernets_processor.surface_reflectance.surface_reflectance import SurfaceReflectance
8+
from hypernets_processor.interpolation.interpolate import InterpolateL1c
9+
from hypernets_processor.rhymer.rhymer.hypstar.rhymer_hypstar import RhymerHypstar
10+
from hypernets_processor.data_io.hypernets_reader import HypernetsReader
11+
from hypernets_processor.utils.paths import parse_sequence_path
12+
import numpy as np
13+
14+
15+
'''___Authorship___'''
16+
__author__ = "Sam Hunt"
17+
__created__ = "21/10/2020"
18+
__version__ = __version__
19+
__maintainer__ = "Sam Hunt"
20+
__email__ = "sam.hunt@npl.co.uk"
21+
__status__ = "Development"
22+
23+
24+
class SequenceProcessor:
25+
"""
26+
Class for processing sequence data
27+
28+
:type context: processor context
29+
:param context: hypernets_processor.context.Context
30+
"""
31+
32+
def __init__(self, context=None):
33+
"""
34+
Constructor method
35+
"""
36+
self.context = context
37+
38+
def process_sequence(self, sequence_path):
39+
"""
40+
Processes sequence file
41+
"""
42+
43+
self.context.logger.info("Processing sequence: " + sequence_path)
44+
45+
# update context
46+
self.context.set_config_value("time", parse_sequence_path(sequence_path)["datetime"])
47+
48+
# Read L0
49+
self.context.logger.debug("Reading raw data...")
50+
reader = HypernetsReader(self.context)
51+
l0_irr, l0_rad, l0_bla = reader.read_sequence(sequence_path)
52+
self.context.logger.debug("Done")
53+
54+
# Calibrate to L1a
55+
self.context.logger.debug("Calibrating L1a...")
56+
calibrate = Calibrate(self.context, MCsteps=100)
57+
L1a_rad = calibrate.calibrate_l1a("radiance", l0_rad, l0_bla)
58+
L1a_irr = calibrate.calibrate_l1a("irradiance", l0_irr, l0_bla)
59+
self.context.logger.debug("Done")
60+
61+
if self.context.get_config_value("network") == "w":
62+
pass
63+
64+
elif self.context.get_config_value("network") == "l":
65+
pass
66+
67+
else:
68+
raise NameError("Invalid network: " + self.context.get_config_value("network"))
69+
70+
return None
71+
72+
73+
if __name__ == "__main__":
74+
pass

0 commit comments

Comments
 (0)