Skip to content

Commit b8381a3

Browse files
committed
Modifications required to include processing config from context
1 parent 3486283 commit b8381a3

File tree

21 files changed

+575
-546
lines changed

21 files changed

+575
-546
lines changed

hypernets_processor/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from hypernets_processor.data_io.hypernets_reader import read_hypernets_data
21
from hypernets_processor.data_io.hypernets_ds_builder import HypernetsDSBuilder
32
from hypernets_processor.data_io.hypernets_writer import HypernetsWriter
43
from hypernets_processor.main_processor import HypernetsProcessor

hypernets_processor/calibration/calibrate.py

Lines changed: 124 additions & 118 deletions
Large diffs are not rendered by default.

hypernets_processor/calibration/measurement_functions/measurement_function_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ def __init__(self):
2323
def get_names(self):
2424
return self.measurement_functions.keys()
2525

26-
def get_measurement_function(self,name):
26+
def get_measurement_function(self,name) -> object:
2727
return self.measurement_functions[name]

hypernets_processor/context.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from hypernets_processor.version import __version__
55
from hypernets_processor.utils.config import get_config_value
66
import dataset
7-
7+
import configparser
88

99
"""___Authorship___"""
1010
__author__ = "Sam Hunt"
@@ -36,6 +36,7 @@ def __init__(self, processor_config=None, job_config=None, logger=None):
3636
self.metadata_db = None
3737
self.anomoly_db = None
3838

39+
3940
# Unpack processor_config to set relevant attributes
4041
if processor_config is not None:
4142
self.unpack_config(processor_config)
@@ -52,7 +53,7 @@ def __init__(self, processor_config=None, job_config=None, logger=None):
5253

5354
# Connect to anomoly database
5455
if "anomoly_db_url" in self.get_config_names():
55-
self.anomoly_db = dataset.connect(self.get_config_value("anomoly_db_url")
56+
self.anomoly_db = dataset.connect(self.get_config_value("anomoly_db_url"))
5657

5758
def unpack_config(self, config, protected_values=None):
5859
"""
@@ -61,14 +62,15 @@ def unpack_config(self, config, protected_values=None):
6162
:type config: configparser.RawConfigParser
6263
:param config: config data
6364
"""
65+
cp = configparser.ConfigParser()
66+
cp.read(config)
6467

6568
protected_values = [] if protected_values is None else protected_values
66-
67-
for section in config.sections():
68-
for name in config[section].keys():
69+
for section in cp.sections():
70+
for name in cp[section].keys():
6971

7072
if name not in protected_values:
71-
value = get_config_value(config, section, name)
73+
value = get_config_value(cp, section, name)
7274
self.set_config_value(name, value)
7375

7476
def set_config_value(self, name, value):

hypernets_processor/data_io/format/variables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
"""
23
Variable definitions for Hypernets land a water network data products
34
"""
@@ -42,7 +43,6 @@
4243
"units": "nm",
4344
"preferred_symbol": "wv"},
4445
"encoding": {'dtype': np.uint16, "scale_factor": 1.0, "offset": 0.0}},
45-
4646
"bandwidth": {"dim": [WL_DIM],
4747
"dtype": np.float32,
4848
"attributes": {},

hypernets_processor/data_io/hypernets_ds_builder.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ def create_ds_template(self, dim_sizes_dict, ds_format, propagate_ds=None):
8989
if self.context is not None:
9090

9191
metadata_db = self.context.metadata_db
92+
print(metadata_db)
9293

9394
# Evaluate queries for metadata_db to populate product metadata
9495
metadata_db_query = None

0 commit comments

Comments
 (0)