From 6bc98ba67ef3292f3b8fb5e980afbf7c01038600 Mon Sep 17 00:00:00 2001 From: Jesse Cusack Date: Tue, 27 Jan 2026 14:28:42 -0800 Subject: [PATCH 1/2] stop thermo calcs if not specified --- src/glide/cli.py | 2 +- src/glide/config.py | 25 ++++++++++++++----------- src/glide/process_l1.py | 8 +++++++- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/glide/cli.py b/src/glide/cli.py index 0f80e7b..eee8acd 100644 --- a/src/glide/cli.py +++ b/src/glide/cli.py @@ -425,7 +425,7 @@ def get_raw_base_name(raw_file: Path) -> str: @app.command() @log_args def cfg( - out_file: _out_file_annotation = "default.config.yaml", + out_file: _out_file_annotation = "default.config.yml", ) -> None: """ Output the default configuration file. diff --git a/src/glide/config.py b/src/glide/config.py index 2deaef0..b26d4ad 100644 --- a/src/glide/config.py +++ b/src/glide/config.py @@ -45,12 +45,11 @@ def _load_core() -> tuple[dict, dict, dict]: with open(core_file) as f: docs = [doc for doc in safe_load_all(f)] - core_variables = docs[0] if docs else {} - flight_attitude = docs[1] if len(docs) > 1 else {} - derived_thermo = docs[2] if len(docs) > 2 else {} - - return core_variables, flight_attitude, derived_thermo + core = docs[0] if docs else {} + flight = docs[1] if len(docs) > 1 else {} + thermo = docs[2] if len(docs) > 2 else {} + return core, flight, thermo def _apply_qc_overrides(variables: dict, qc_overrides: dict) -> dict: """Apply QC parameter overrides to variable definitions. @@ -121,7 +120,7 @@ def load_config(file: str | None = None) -> dict: - merged_variables: variables for higher-level processing """ # Load core definitions - core_variables, flight_attitude, derived_thermo = _load_core() + core, flight, thermo = _load_core() # Load user config if file is None: @@ -141,18 +140,18 @@ def load_config(file: str | None = None) -> dict: # Extract include toggles (default to True for backward compatibility) include = include_config.get("include", {}) - include_flight = include.get("flight_attitude", True) - include_thermo = include.get("derived_thermo", True) + include_flight = include.get("flight", True) + include_thermo = include.get("thermo", True) # Build variable set: start with core - variables = copy.deepcopy(core_variables) + variables = copy.deepcopy(core) # Add optional suites if enabled if include_flight: - variables.update(copy.deepcopy(flight_attitude)) + variables.update(copy.deepcopy(flight)) _log.debug("Including flight_attitude suite") if include_thermo: - variables.update(copy.deepcopy(derived_thermo)) + variables.update(copy.deepcopy(thermo)) _log.debug("Including derived_thermo suite") # Apply QC overrides @@ -193,6 +192,10 @@ def load_config(file: str | None = None) -> dict: variables=variables, slocum=slocum_name_map, merged_variables=merged_vars, + include=dict( + flight=include_flight, + thermo=include_thermo, + ), ) return config diff --git a/src/glide/process_l1.py b/src/glide/process_l1.py index 65d75c3..21975fa 100644 --- a/src/glide/process_l1.py +++ b/src/glide/process_l1.py @@ -205,7 +205,13 @@ def merge( def calculate_thermodynamics(ds: xr.Dataset, config: dict) -> xr.Dataset: - """Should be applied after merging flight and science.""" + """Should be applied after merging flight and science. + + Skips calculation if thermo suite is disabled in config. + """ + if not config.get("include", {}).get("thermo", True): + _log.debug("Skipping thermodynamics (disabled in config)") + return ds _log.debug("Calculating thermodynamics") From 2c6e4a19fbaee03d4fcd41bbdff3489d2decebe1 Mon Sep 17 00:00:00 2001 From: Jesse Cusack Date: Wed, 28 Jan 2026 08:43:41 -0800 Subject: [PATCH 2/2] formatting --- src/glide/config.py | 1 + src/glide/process_l1.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/glide/config.py b/src/glide/config.py index b26d4ad..04ade5b 100644 --- a/src/glide/config.py +++ b/src/glide/config.py @@ -51,6 +51,7 @@ def _load_core() -> tuple[dict, dict, dict]: return core, flight, thermo + def _apply_qc_overrides(variables: dict, qc_overrides: dict) -> dict: """Apply QC parameter overrides to variable definitions. diff --git a/src/glide/process_l1.py b/src/glide/process_l1.py index 21975fa..ccfd8ae 100644 --- a/src/glide/process_l1.py +++ b/src/glide/process_l1.py @@ -206,7 +206,7 @@ def merge( def calculate_thermodynamics(ds: xr.Dataset, config: dict) -> xr.Dataset: """Should be applied after merging flight and science. - + Skips calculation if thermo suite is disabled in config. """ if not config.get("include", {}).get("thermo", True):