Skip to content

neptoon.corrections.factory

correction_classes

Classes:

Functions:

CorrectionType

Bases: Enum

The types of correction avaiable to implement.

CorrectionTheory

Bases: Enum

The corrections theories for correcting influence on neutron signal beyond soil moisture

Correction

Correction(correction_type, correction_factor_column_name)

Bases: ABC

Abstract class for the Correction classes.

All corrections have an apply method which takes a DataFrame as an argument. The return of the apply function should always be a DataFrame with the correction factor calculated and added as a column. The correction_factor_column_name should be set to the desired column name for the calculated correction factor.

The CorrectionBuilder class will store the name of columns where correction factors are stored (when multiple corrections are undertaken). This enables the creation of the overall corrected neutron count column.

apply abstractmethod

apply(data_frame)

The apply button should always take a dataframe as an input, do some logic, and return a dataframe with the additional columns calucalted during processing.

Parameters:

Name Type Description Default
data_frame DataFrame

The crns_data_frame

required

get_correction_factor_column_name

get_correction_factor_column_name()

Declare the name of the correction factor column

IncomingIntensityCorrectionZreda2012

IncomingIntensityCorrectionZreda2012(reference_incoming_neutron_value=str(REFERENCE_INCOMING_NEUTRON_VALUE), correction_type=INCOMING_INTENSITY, correction_factor_column_name=str(INTENSITY_CORRECTION), incoming_neutron_column_name=str(INCOMING_NEUTRON_INTENSITY))

Bases: Correction

Corrects neutrons for incoming neutron intensity according to the original Zreda et al. (2012) equation.

https://doi.org/10.5194/hess-16-4079-2012

Required attributes for creation.

Parameters:

Name Type Description Default
reference_incoming_neutron_value str

name of the column holding the reference count of incoming neutron intensity at a point in time.

str(REFERENCE_INCOMING_NEUTRON_VALUE)
correction_type str

correction type, by default CorrectionType.INCOMING_INTENSITY

INCOMING_INTENSITY
correction_factor_column_name str

name of column corrections will be written to, by default ColumnInfo.Name.INTENSITY_CORRECTION

str(INTENSITY_CORRECTION)
incoming_neutron_column_name str

name of column where incoming neutron intensity values are stored in the dataframe, by default "incoming_neutron_intensity"

str(INCOMING_NEUTRON_INTENSITY)

apply

apply(data_frame)

Applies the neutron correction

Parameters:

Name Type Description Default
data_frame DataFrame

DataFrame with appropriate data

required

Returns:

Type Description
DataFrame

DataFrame now corrected

IncomingIntensityCorrectionHawdon2014

IncomingIntensityCorrectionHawdon2014(ref_incoming_neutron_value=str(REFERENCE_INCOMING_NEUTRON_VALUE), site_cutoff_rigidity=str(SITE_CUTOFF_RIGIDITY), correction_factor_column_name=str(INTENSITY_CORRECTION), incoming_neutron_column_name=str(INCOMING_NEUTRON_INTENSITY), ref_monitor_cutoff_rigidity=str(REFERENCE_MONITOR_CUTOFF_RIGIDITY), rc_correction_factor=str(RC_CORRECTION_FACTOR), correction_type=INCOMING_INTENSITY)

Bases: Correction

Corrects for incoming neutron intensity according to the method outlined in Hawdon et al., (2014).

https://doi.org/10.1002/2013WR015138

Parameters:

Name Type Description Default
ref_incoming_neutron_value str

column name containing the reference incoming neutron value, by default str( ColumnInfo.Name.REFERENCE_INCOMING_NEUTRON_VALUE )

str(REFERENCE_INCOMING_NEUTRON_VALUE)
site_cutoff_rigidity str

column name containing the site cutoff rigidity, by default str(ColumnInfo.Name.SITE_CUTOFF_RIGIDITY)

str(SITE_CUTOFF_RIGIDITY)
correction_factor_column_name str

column name where correction factor will be written, by default str( ColumnInfo.Name.INTENSITY_CORRECTION )

str(INTENSITY_CORRECTION)
incoming_neutron_column_name str

column name where incoming neutron intensity values are stored , by default str( ColumnInfo.Name.INCOMING_NEUTRON_INTENSITY )

str(INCOMING_NEUTRON_INTENSITY)
ref_monitor_cutoff_rigidity str

Name of the column the reference monitor cutoff rigidity is stored, by default str( ColumnInfo.Name.REFERENCE_MONITOR_CUTOFF_RIGIDITY )

str(REFERENCE_MONITOR_CUTOFF_RIGIDITY)
rc_correction_factor str

name of the column the rc_correction will be written to, by default str( ColumnInfo.Name.RC_CORRECTION_FACTOR )

str(RC_CORRECTION_FACTOR)
correction_type CorrectionType

The correction type as an Enum, by default CorrectionType.INCOMING_INTENSITY

INCOMING_INTENSITY

apply

apply(data_frame)

Applies the correction factor returning a dataframe with the calculated values in it.

Parameters:

Name Type Description Default
data_frame DataFrame

DataFrame

required

Returns:

Type Description
DataFrame

DataFrame with the correction values attached

IncomingIntensityCorrectionMcJannetDesilets2023

IncomingIntensityCorrectionMcJannetDesilets2023(ref_incoming_neutron_value=str(REFERENCE_INCOMING_NEUTRON_VALUE), site_cutoff_rigidity=str(SITE_CUTOFF_RIGIDITY), correction_factor_column_name=str(INTENSITY_CORRECTION), incoming_neutron_column_name=str(INCOMING_NEUTRON_INTENSITY), latitude=str(LATITUDE), elevation=str(ELEVATION), rc_correction_factor=str(RC_CORRECTION_FACTOR), correction_type=INCOMING_INTENSITY)

Bases: Correction

Corrects for incoming neutron intensity according to the method outlined in McJannet and Desilets., (2023).

https://doi.org/10.1029/2022WR033889

Parameters:

Name Type Description Default
ref_incoming_neutron_value str

column name containing the reference incoming neutron value, by default str( ColumnInfo.Name.REFERENCE_INCOMING_NEUTRON_VALUE )

str(REFERENCE_INCOMING_NEUTRON_VALUE)
site_cutoff_rigidity str

column name containing the site cutoff rigidity, by default str(ColumnInfo.Name.SITE_CUTOFF_RIGIDITY)

str(SITE_CUTOFF_RIGIDITY)
correction_factor_column_name str

column name where correction factor will be written, by default str( ColumnInfo.Name.INTENSITY_CORRECTION )

str(INTENSITY_CORRECTION)
incoming_neutron_column_name str

column name where incoming neutron intensity values are stored, by default str( ColumnInfo.Name.INCOMING_NEUTRON_INTENSITY )

str(INCOMING_NEUTRON_INTENSITY)
latitude str

column name where latitude values are stored, by default str(ColumnInfo.Name.LATITUDE)

str(LATITUDE)
elevation str

column name where elevation values are stored, by default str(ColumnInfo.Name.ELEVATION)

str(ELEVATION)
rc_correction_factor str

name of the column the rc_correction will be written to, by default str(ColumnInfo.Name.RC_CORRECTION_FACTOR)

str(RC_CORRECTION_FACTOR)
correction_type CorrectionType

the correction type as an Enum, by default CorrectionType.INCOMING_INTENSITY

INCOMING_INTENSITY

HumidityCorrectionRosolem2013

HumidityCorrectionRosolem2013(reference_absolute_humidity_value=0, correction_type=HUMIDITY, correction_factor_column_name=str(HUMIDITY_CORRECTION), sat_vapour_pressure_column_name=str(SATURATION_VAPOUR_PRESSURE), air_temperature_column_name=str(AIR_TEMPERATURE), actual_vapour_pressure_column_name=str(ACTUAL_VAPOUR_PRESSURE), absolute_humidity_column_name=str(ABSOLUTE_HUMIDITY), relative_humidity_column_name=str(AIR_RELATIVE_HUMIDITY))

Bases: Correction

Corrects neutrons for humidity according to the Rosolem et al. (2013) equation.

https://doi.org/10.1175/JHM-D-12-0120.1

Required attributes for creation.

Parameters:

Name Type Description Default
reference_incoming_neutron_value float

reference count of incoming neutron intensity at a point in time.

required
correction_type str

correction type, by default "intensity"

HUMIDITY
correction_factor_column_name str

name of column corrections will be written to, by default "correction_for_intensity"

str(HUMIDITY_CORRECTION)
incoming_neutron_column_name str

name of column where incoming neutron intensity values are stored in the dataframe, by default "incoming_neutron_intensity"

required

apply

apply(data_frame)

Applies the neutron correction

Parameters:

Name Type Description Default
data_frame DataFrame

DataFrame with appropriate data

required

Returns:

Type Description
DataFrame

DataFrame now corrected

PressureCorrection

PressureCorrection(beta_coefficient_col_name=None, site_cutoff_rigidity_col_name=None, correction_type=PRESSURE, correction_factor_column_name=None, reference_pressure_value=1013.25)

Bases: Correction

Corrects neutrons for changes in atmospheric pressure according to the original Zreda et al. (2012) equation.

https://doi.org/10.5194/hess-16-4079-2012

Required attributes for creation.

Parameters:

Name Type Description Default
site_elevation_col_name str

column containing elevation, by default None

required
correction_type str

correction type, by default CorrectionType.PRESSURE

PRESSURE
correction_factor_column_name str

Name of column to store correction factors, by default str( ColumnInfo.Name.PRESSURE_CORRECTION )

None
beta_coefficient_col_name float

beta_coefficient for processing, by default None

None
latitude_col_name float

latitude of site in degrees, by default None

required
site_cutoff_rigidity_col_name _type_

cut-off rigidity at the site, by default None

None
reference_pressure_value float

reference pressure for correction in hPa , by default 1013.25

1013.25

apply

apply(data_frame)

Applies the neutron correction

Parameters:

Name Type Description Default
data_frame DataFrame

DataFrame with appropriate data

required

Returns:

Type Description
DataFrame

DataFrame now corrected

PressureCorrectionDesiletsZreda2003

PressureCorrectionDesiletsZreda2003(beta_coefficient_col_name=None, site_cutoff_rigidity_col_name=None, correction_type=PRESSURE, correction_factor_column_name=None, reference_pressure_value=1013.25, latitude_col_name=None, site_elevation_col_name=None)

Bases: PressureCorrection

Corrects neutrons for changes in atmospheric pressure according to the original Zreda et al. (2012) equation.

https://doi.org/10.5194/hess-16-4079-2012

Required attributes for creation.

Parameters:

Name Type Description Default
site_elevation_col_name str

column containing elevation, by default None

None
correction_type str

correction type, by default CorrectionType.PRESSURE

PRESSURE
correction_factor_column_name str

Name of column to store correction factors, by default str( ColumnInfo.Name.PRESSURE_CORRECTION )

None
beta_coefficient_col_name float

beta_coefficient for processing, by default None

None
latitude_col_name float

latitude of site in degrees, by default None

None
site_cutoff_rigidity_col_name _type_

cut-off rigidity at the site, by default None

None
reference_pressure_value float

reference pressure for correction in hPa , by default 1013.25

1013.25

PressureCorrectionDesilets2021

PressureCorrectionDesilets2021(beta_coefficient_col_name=None, site_cutoff_rigidity_col_name=None, correction_type=PRESSURE, correction_factor_column_name=None, reference_pressure_value=1013.25, latitude_col_name=None, site_elevation_col_name=None)

Bases: PressureCorrection

Corrects neutrons for changes in atmospheric pressure according to the original Zreda et al. (2012) equation.

https://doi.org/10.5194/hess-16-4079-2012

Required attributes for creation.

Parameters:

Name Type Description Default
site_elevation_col_name str

column containing elevation, by default None

None
correction_type str

correction type, by default CorrectionType.PRESSURE

PRESSURE
correction_factor_column_name str

Name of column to store correction factors, by default str( ColumnInfo.Name.PRESSURE_CORRECTION )

None
beta_coefficient_col_name float

beta_coefficient for processing, by default None

None
latitude_col_name float

latitude of site in degrees, by default None

None
site_cutoff_rigidity_col_name _type_

cut-off rigidity at the site, by default None

None
reference_pressure_value float

reference pressure for correction in hPa , by default 1013.25

1013.25

PressureCorrectionTiradoBueno2021

PressureCorrectionTiradoBueno2021(beta_coefficient_col_name=None, site_cutoff_rigidity_col_name=None, correction_type=PRESSURE, correction_factor_column_name=None, reference_pressure_value=1013.25)

Bases: PressureCorrection

Required attributes for creation.

Parameters:

Name Type Description Default
site_elevation_col_name str

column containing elevation, by default None

required
correction_type str

correction type, by default CorrectionType.PRESSURE

PRESSURE
correction_factor_column_name str

Name of column to store correction factors, by default str( ColumnInfo.Name.PRESSURE_CORRECTION )

None
beta_coefficient_col_name float

beta_coefficient for processing, by default None

None
latitude_col_name float

latitude of site in degrees, by default None

required
site_cutoff_rigidity_col_name _type_

cut-off rigidity at the site, by default None

None
reference_pressure_value float

reference pressure for correction in hPa , by default 1013.25

1013.25

AboveGroundBiomassCorrectionBaatz2015

AboveGroundBiomassCorrectionBaatz2015(correction_type=ABOVE_GROUND_BIOMASS, correction_factor_column_name=str(ABOVEGROUND_BIOMASS_CORRECTION), above_ground_biomass_column_name='above_ground_biomass')

Bases: Correction

Required attributes for creation.

Parameters:

Name Type Description Default
correction_type CorrectionType

The correction type, by default CorrectionType.ABOVE_GROUND_BIOMASS

ABOVE_GROUND_BIOMASS
correction_factor_column_name str

Name of column corrections will be written to, by default ColumnInfo.Name.ABOVEGROUND_BIOMASS_CORRECTION

str(ABOVEGROUND_BIOMASS_CORRECTION)
above_ground_biomass_column_name str

Name of column in the dataframe with above ground biomass values, by default "above_ground_biomass"

'above_ground_biomass'

AboveGroundBiomassCorrectionMorris2024

AboveGroundBiomassCorrectionMorris2024(correction_type=ABOVE_GROUND_BIOMASS, correction_factor_column_name=str(ABOVEGROUND_BIOMASS_CORRECTION), above_ground_biomass_column_name='above_ground_biomass')

is_column_missing_or_empty

is_column_missing_or_empty(data_frame, column_name)

Find whether a column is missing or empty in a dataframe. Useful for checking data before making calculations.

Parameters:

Name Type Description Default
data_frame DataFrame

description

required
column_name str

Name of column to check for

required

Returns:

Type Description
bool

True or False whether column is missing or empty