Skip to content

neptoon.workflow

process_with_config

Classes:

Functions:

ProcessWithConfig

ProcessWithConfig(path_to_sensor_config=None, path_to_process_config=None, configuration_object=None)

Processes CRNS data according to configuration files.

This class implements the complete CRNS data processing pipeline using configurations for both sensor parameters and processing steps. It handles all stages from raw data import to final data output and visualization.

Users can provide configurations either as file paths or as a pre-configured ConfigurationManager object.

Example:

Using string paths to configuration files

sensor_config_path = "/path/to/configuration_files/A101_station.yaml" processing_config_path = "/path/to/configuration_files/v1_processing_method.yaml"

Initialize the processor with paths to config files

config_processor = ProcessWithConfig( ... path_to_sensor_config=sensor_config_path, ... path_to_process_config=processing_config_path ... )

Run the full processing pipeline

config_processor.run_full_process()

Alternatively, with a pre-configured ConfigurationManager:

config_manager = ConfigurationManager() config_manager.load_configuration(file_path=sensor_config_path) config_manager.load_configuration(file_path=processing_config_path)

Initialize using the configuration manager

config_processor = ProcessWithConfig(configuration_manager=config_manager) config_processor.run_full_process()

run_full_process

run_full_process()

Executes the complete CRNS data processing pipeline.

This method performs the following steps in sequence:

  1. Creates a data hub using the sensor configuration
  2. Attaches NMDB reference data
  3. Prepares static values and performs initial quality assessment
  4. Applies appropriate corrections to neutron counts
  5. Performs calibration if requested
  6. Applies additional quality assessment and smoothing
  7. Calculates soil moisture estimates with uncertainty bounds
  8. Creates visualizations
  9. Saves processed data and updated configurations

Raises:

Type Description
ValueError

When no N0 calibration parameter is available and calibration is not enabled

QualityAssessmentFromConfig

QualityAssessmentFromConfig(partial_config, sensor_config, name_of_target=None)

Builds quality assessment checks from configuration data.

This class translates quality assessment configuration parameters into executable QualityCheck objects that can be applied to CRNS data. It supports various check types and automatically handles parameter inheritance from sensor information (e.g., N0 values).

Parameters:

Name Type Description Default
partial_config BaseConfig

Configuration section containing quality assessment parameters

required
sensor_config BaseConfig

Sensor configuration containing reference parameters

required
name_of_target (Literal['raw_neutrons', 'corrected_neutrons'],)
None
optional

Specific target to process; if None, processes all targets in config

required

Attributes

Parameters:

Name Type Description Default
partial_config ConfigurationObject

A selection from the ConfigurationObject which stores QA selections

required
sensor_config ConfigurationObject

The config object describing station variables

required
name_of_target str

The name of the target for QA. If None it will loop through any provided in partial config.

None
Notes

The name_of_section should match the final part of the supplied partial_config. For example:

partial_config = ( config.process_config.neutron_quality_assessment.flag_raw_neutrons )

Therefore:

name_of_section = 'flag_raw_neutrons'

create_checks

create_checks()

Creates quality check objects based on the provided configuration.

This method processes the configuration and converts it into a list of QualityCheck objects ready to be applied to data.

Returns:

Type Description
List[QualityCheck]

List of configured quality check objects

return_a_check

return_a_check(name_of_target, target_dict)

Process checks for a specific target.

CorrectionSelectorFromConfig

CorrectionSelectorFromConfig(data_hub, process_config, sensor_config)

Selects and configures neutron count corrections based on configuration.

This class translates correction configuration parameters into the appropriate correction objects to be applied to neutron count data. It supports various correction types including pressure, humidity, incoming intensity, and above-ground biomass.

Parameters:

Name Type Description Default
data_hub CRNSDataHub

The data hub instance to which corrections will be applied

required
process_config BaseConfig

Process configuration containing correction specifications

required
sensor_config BaseConfig

Sensor configuration containing site-specific parameters

required

Attributes

Parameters:

Name Type Description Default
data_hub CRNSDataHub

A CRNSDataHub hub instance

required
process_config

The process YAML as an object.

required
sensor_config

The station information YAML as an object

required

select_corrections

select_corrections()

Applies all configured corrections to the data hub.

This method processes all correction specifications in the process configuration and applies them to the data hub in the appropriate sequence.

Returns:

Type Description
CRNSDataHub

The data hub with all corrections selected and ready to be applied