Commit cb5ca9c5 authored by Paulo Medeiros's avatar Paulo Medeiros
Browse files

Some refactoring in config_parser.py

parent 0cadf21d
......@@ -325,29 +325,27 @@ with config_section("_template.clustering_method") as section:
config_metadata.register("eps", default=10.0, minval=0.0)
config_metadata.register("min_samples", default=5, minval=1)
config_metadata.register("min_cluster_size", default=5, minval=1)
# obs_weights not explicitly set will be internally set to 1
config_metadata.register("obs_weights.geo_dist", default=1.0, minval=0.0)
config_metadata.register("obs_weights.x", default=1.0, minval=0.0)
config_metadata.register("obs_weights.y", default=1.0, minval=0.0)
config_metadata.register("obs_weights.alt", default=1.0, minval=0.0)
config_metadata.register(
"obs_weights.temperature", default=5.0, minval=0.0
)
config_metadata.register("obs_weights.pressure", default=0.0, minval=0.0)
config_metadata.register("obs_weights.mslp", default=1.0, minval=0.0)
config_metadata.register("obs_weights.humidity", default=1.0, minval=0.0)
config_metadata.register("obs_weights.sum_rain_1", default=1.0, minval=0.0)
with config_section("_template.clustering_method.outlier_removal") as section:
config_metadata.register(
"outlier_removal.method",
"method",
default="iterative",
choices=[None, "lof", "iterative", "reclustering"],
)
config_metadata.register(
"outlier_removal.iterative.max_n_stdev", default=3.0, minval=0.0
)
config_metadata.register(
"outlier_removal.iterative.max_n_iter", default=100, minval=0
)
config_metadata.register("iterative.max_n_stdev", default=3.0, minval=0.0)
config_metadata.register("iterative.max_n_iter", default=100, minval=0)
with config_section("_template.clustering_method.obs_weights") as section:
# obs_weights not explicitly set will be internally set to 1
config_metadata.register("geo_dist", default=1.0, minval=0.0)
config_metadata.register("x", default=1.0, minval=0.0)
config_metadata.register("y", default=1.0, minval=0.0)
config_metadata.register("alt", default=1.0, minval=0.0)
config_metadata.register("temperature", default=5.0, minval=0.0)
config_metadata.register("pressure", default=0.0, minval=0.0)
config_metadata.register("mslp", default=1.0, minval=0.0)
config_metadata.register("humidity", default=1.0, minval=0.0)
config_metadata.register("sum_rain_1", default=1.0, minval=0.0)
# General section
......@@ -537,7 +535,7 @@ def _parse_dtg_entires(dtgs_config):
def _raw2parsed(raw, recog_configs=config_metadata, parent_keys=()):
"""Return parsed confif from raw input, validating with metadata.
"""Return parsed config from raw input, validating against metadata.
Descend recursively into input dict raw and validate raw configs against
the registered metadata. Configs not that don't have corresponding metadata
......@@ -595,7 +593,7 @@ def _raw2parsed(raw, recog_configs=config_metadata, parent_keys=()):
if isinstance(user_val, dict):
# Top level of some config section
# Descend into further eventual dict levels recusively
# Descend into further eventual dict levels recursively
parsed[key] = _raw2parsed(user_val, parent_keys=all_keys)
else:
# Check if allowed choices (if any) are respected
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment