curryer.correction.results_io¶
NetCDF I/O helpers for the correction pipeline.
This module owns all read/write operations on the NetCDF result file:
_build_netcdf_structure()– initialise the in-memory data dict._save_netcdf_results()– write the final NetCDF output file._save_netcdf_checkpoint()– write a partial checkpoint after each GCP pair._load_checkpoint()– reload a checkpoint to resume an interrupted run._cleanup_checkpoint()– delete the checkpoint file after a successful run.
Attributes¶
Functions¶
|
Build NetCDF data structure dynamically from the sweep + output config. |
|
Save NetCDF checkpoint with partial results after each GCP pair completes. |
|
Load checkpoint if it exists and convert back to netcdf_data dict. |
|
Remove checkpoint file after successful completion. |
|
Save results to NetCDF file using config-driven metadata. |
Module Contents¶
- curryer.correction.results_io.logger¶
- curryer.correction.results_io._build_netcdf_structure(setup: curryer.correction.config.GeolocationSetup, sweep: curryer.correction.config.Sweep, netcdf_config: curryer.correction.config.NetCDFConfig, n_param_sets: int, n_gcp_pairs: int) dict¶
Build NetCDF data structure dynamically from the sweep + output config.
This creates the netcdf_data dictionary with proper variable names based on the parameters defined in the sweep, avoiding hardcoded mission-specific names.
- Parameters:
setup – GeolocationSetup (performance threshold for metric naming)
sweep – Sweep with the parameters to vary
netcdf_config – Resolved NetCDFConfig with metadata
n_param_sets – Number of parameter sets (iterations)
n_gcp_pairs – Number of GCP pairs
- Returns:
Dictionary with initialized arrays for all NetCDF variables
- curryer.correction.results_io._save_netcdf_checkpoint(netcdf_data, output_file, setup, sweep, netcdf_config, pair_idx_completed)¶
Save NetCDF checkpoint with partial results after each GCP pair completes.
This enables resuming correction runs if they are interrupted. Adapted for pair-outer loop order where each pair processes all parameters.
- Parameters:
netcdf_data – Dictionary with current NetCDF data
output_file – Path to final output file (checkpoint uses .checkpoint.nc suffix)
setup – GeolocationSetup (performance threshold for metric naming)
sweep – Sweep with parameters/iterations/seed
netcdf_config – Resolved NetCDFConfig with metadata
pair_idx_completed – Index of the last completed GCP pair (for pair-outer loop)
- curryer.correction.results_io._load_checkpoint(output_file)¶
Load checkpoint if it exists and convert back to netcdf_data dict.
- Parameters:
output_file – Path to final output file (will check for .checkpoint.nc)
- Returns:
Tuple of (netcdf_data dict, start_idx) or (None, 0) if no checkpoint
- curryer.correction.results_io._cleanup_checkpoint(output_file)¶
Remove checkpoint file after successful completion.
- Parameters:
output_file – Path to final output file (will remove .checkpoint.nc)
- curryer.correction.results_io._save_netcdf_results(netcdf_data, output_file, setup, sweep, netcdf_config)¶
Save results to NetCDF file using config-driven metadata.
This function dynamically builds the NetCDF file structure from the netcdf_data dictionary, using configuration for all metadata rather than hardcoding mission-specific values.
- Parameters:
netcdf_data – Dictionary with all NetCDF variables and data
output_file – Path to output NetCDF file
setup – GeolocationSetup (performance threshold for metric naming)
sweep – Sweep with parameters/iterations/seed
netcdf_config – Resolved NetCDFConfig with metadata