Skip to content

neptoon.visulisation

figures

Functions:

Here are basic figures for creating plots.

validate_columns_present

validate_columns_present(data_frame, required_cols)

Utility function to validate column existence in data frame Raises ValueError if columns are missing

make_nmdb_data_figure

make_nmdb_data_figure(data_frame, reference_value, incoming_neutron_col_name=str(INCOMING_NEUTRON_INTENSITY), resolution=60, show=False, backend='agg', save_location=None)

Makes the figure

Parameters:

Name Type Description Default
data_frame DataFrame

DataFrame containing data

required
nmdb_station_name str

NMDB station name

required
reference_value int

reference value

required
resolution int

resolution in minutes, by default 60

60
show bool

show interactively, by default False

False
backend str

the backend to use in matplotlib, by default "agg

'agg'
save str

The save path

required

Returns:

Type Description
BytesIO

Figure object to be used for later display

soil_moisture_figure_uncertainty

soil_moisture_figure_uncertainty(data_frame, station_name, soil_moisture_col=str(SOIL_MOISTURE_VOL_FINAL), upper_uncertainty_col=str(SOIL_MOISTURE_UNCERTAINTY_VOL_UPPER), lower_uncertainty_col=str(SOIL_MOISTURE_UNCERTAINTY_VOL_LOWER), sm_range=(0, 0.5), show=False, backend='agg', save_location=None)

Creates a two-panel figure showing soil moisture content and associated uncertainties.

The top panel displays the soil moisture time series. The bottom panel shows the uncertainty bounds as separate lines with filled regions to emphasize the error margins.

Parameters:

Name Type Description Default
data_frame DataFrame

DataFrame containing the soil moisture and uncertainty data

required
station_name str

Name of the CRNS station for the title

required
soil_moisture_col str

Column name for soil moisture data, defaults to SOIL_MOISTURE_FINAL

str(SOIL_MOISTURE_VOL_FINAL)
upper_uncertainty_col str

Column name for upper uncertainty bound

str(SOIL_MOISTURE_UNCERTAINTY_VOL_UPPER)
lower_uncertainty_col str

Column name for lower uncertainty bound

str(SOIL_MOISTURE_UNCERTAINTY_VOL_LOWER)
sm_range tuple

Y-axis range for soil moisture plots as (min, max), defaults to (0, 0.5)

(0, 0.5)
show bool

Whether to display the figure, defaults to False

False
backend str

Matplotlib backend to use, defaults to "agg"

'agg'
save_location str

Path to save the figure, if None the figure is not saved

None

Returns:

Type Description
None

The figure is either displayed, saved, or both based on parameters

soil_moisture_coloured_figure

soil_moisture_coloured_figure(data_frame, station_name, sm_column_name=str(SOIL_MOISTURE_VOL_FINAL), lower_bound=0, save_location=None)

Soil moisture plot which fills below the line colours between blue and brown to represent wet vs dry periods.

Parameters:

Name Type Description Default
data_frame DataFrame

time series data

required
station_name str

name of the station

required
sm_column_name str

column name containing soil moisture data, by default str(ColumnInfo.Name.SOIL_MOISTURE_FINAL)

str(SOIL_MOISTURE_VOL_FINAL)
lower_bound float

lower bound of y-axis, by default 0

0
save_location str

location to save data if desired, by default None

None

atmospheric_conditions_figure

atmospheric_conditions_figure(data_frame, station_name, pressure_col=str(AIR_PRESSURE), temperature_col=str(AIR_TEMPERATURE), rel_humidity_col=str(AIR_RELATIVE_HUMIDITY), temperature_range=(-20.0, 40.0), show=False, backend='agg', save_location=None)

Creates a three-panel figure showing atmospheric conditions affecting CRNS measurements.

Parameters:

Name Type Description Default
data_frame DataFrame

DataFrame containing the atmospheric measurements

required
station_name str

Name of the CRNS station for the title

required
pressure_col str

Column name for air pressure data (hPa)

str(AIR_PRESSURE)
temperature_col str

Column name for air temperature data (°C)

str(AIR_TEMPERATURE)
rel_humidity_col str

Column name for relative humidity data (%)

str(AIR_RELATIVE_HUMIDITY)
abs_humidity_col str

Column name for absolute humidity data (g/m³)

required
temperature_range Tuple[float, float]

Temperature axis range (min, max) in °C

(-20.0, 40.0)
show bool

Whether to display the figure

False
backend str

Matplotlib backend to use

'agg'
save_location str

Path to save the figure

None
Notes

The function handles missing data gracefully - panels with no data will be left blank with an appropriate message. This is particularly useful for stations that may not record all atmospheric variables.

correction_factors_figure

correction_factors_figure(data_frame, station_name, pressure_corr_col=str(PRESSURE_CORRECTION), humidity_corr_col=str(HUMIDITY_CORRECTION), intensity_corr_col=str(INTENSITY_CORRECTION), biomass_corr_col=str(ABOVEGROUND_BIOMASS_CORRECTION), show=False, backend='agg', save_location=None)

Creates a figure showing correction factors applied to CRNS data.

Parameters:

Name Type Description Default
data_frame DataFrame

DataFrame containing the correction factors and soil properties

required
station_name str

Name of the CRNS station for the title

required
pressure_corr_col str

Column name for pressure correction factor

str(PRESSURE_CORRECTION)
humidity_corr_col str

Column name for humidity correction factor

str(HUMIDITY_CORRECTION)
intensity_corr_col str

Column name for incoming neutron intensity correction

str(INTENSITY_CORRECTION)
show bool

Whether to display the figure

False
backend str

Matplotlib backend to use

'agg'
save_location str

Path to save the figure

None