i7aof.biascorr

Bias-correction utilities and workflows. See i7aof.biascorr for developer details.

class i7aof.biascorr.timeslice.Timeslice(config, thetao, so, basinmask, basinNumber, yidx=None)

Bases: object

A class for a time slice containing T and S

config

Configuration options.

Type:

mpas_tools.config.MpasConfigParser

thetao

name of file containing thetao

Type:

str

so

name of file containing so

Type:

str

Public
------
V

gridded volume in 3D space

Type:

float([nz, ny, nx])

T

gridded temperature in 3D space

Type:

float([nz, ny, nx])

S

gridded salinity in 3D space

Type:

float([nz, ny, nx])

Vb

binned volume in S, T space per basin

Type:

float([Nbasins, Nbins, Nbins])

Sb

Evenly spaced salinity bins per basin

Type:

float([Nbasins, Nbins + 1])

Tb

Evenly spaced temperature bins per basin

Type:

float([Nbasins, Nbins + 1])

deltaSf

Filled delta S between this time slice and the model reference, in S, T space per basin

Type:

float([Nbasins, Nbins, Nbins))

deltaTf

Filled delta T between this time slice and the model reference, in S, T space per basin

Type:

float([Nbasins, Nbins, Nbins))

S_corrected

Bias-corrected salinity in 3D space

Type:

float([nz, ny, nx])

T_corrected

Bias-corrected temperature in 3D space

Type:

float([nz, ny, nx])

Sperc

Requested percentile of salinity, usually 99th

Type:

float([Nbasins])

Tperc

Requested percentile of temperature, usually 99th

Type:

float([Nbasins])

Sscaling

Scaling factor of salinity, effectively stretching or compressing the model salinity distribution to best fit the reference distribution whilst fixing Sperc. Only values between 0.5 and 1.5 are allowed.

Type:

float([Nbasins])

Tscaling

Scaling factor of temperature, effectively stretching or compressing the model temperature distribution to best fit the reference distribution whilst fixing the minimum temperature value (usually freezing point).

Type:

float([Nbasins])

apply_anomaly(base)

Determine model anomaly with respect to reference period and apply anomaly to the base T and S to get the corrected values

Parameters:

base (Timeslice) – base timeslice on which to add T- and S-anomalies. This should usually be the timeslice of the same model over the reference period (same as modref), but with the extrapolated fields, so that T_corrected and S_corrected are also extrapolated over the full domain

compute_delta(modref)

Compute difference between timeslice and modref, binned on the modelref bins

Parameters:

modref (Timeslice) – Timeslice of the same model as this Timeslice over the reference period. This should usually be the non-extrapolated fields

fill_delta(deltavar)

Fill deltavar (either deltaT or deltaS) in full normalised T,S space

Parameters:

deltavar (array([Nbins, Nbins])) – deltaT or deltaS in S,T space

get_T_and_S()

Extract T and S data

get_all_data()

Extract all data from time slice

get_bins()

Get 2D histogram of volume Vb as a function of binned salinity (Sb) and temperature (Tb)

get_volume()

Extract volume per grid cell

class i7aof.biascorr.projection.Projection(config, logger)

Bases: object

A main class for projections

config

Configuration options.

Type:

mpas_tools.config.MpasConfigParser

logger

Logger for the class.

Type:

logging.Logger

Public
------
ref

Reference timeslice to which a model will be bias-corrected. This should usually be an observational dataset

Type:

Timeslice

modref

Model reference timeslice. This should be a model Timeslice averaged over the reference period. The input fields (T,S) should not be extrapolated, to prevent biases in the volume of certain water masses.

Type:

Timeslice

base

Base timeslice to which anomalies are added. This should be a model Timeslice over the reference period, similar to modref. Usually, the base Timeslice should contain extrapolated T, S fields though, to ensure the output bias-corrected fields are also extrapolated.

Type:

Timeslice

basinNumber

Gridded product denoting the individual basins by integer values Usually, this should be the 16 IMBIE basins, though a modification of these is required to ensure each contains a finite volume over the continental shelf. This same modification is required for the basic extrapolation of T and S.

Type:

int([ny, nx])

basinmask

Mask containing 0s and 1s, denoting which horizontal grid cell is part of which basin. 1: True, 0: False

Type:

int([Nbasins, ny, nx])

compute_S_bias(**kwargs)
compute_T_bias(**kwargs)
compute_bias()

Compute the bias of the model T and S with respect to the reference. This will create corrected T and S bins (Tc and Sc)

create_basin_masks(**kwargs)
get_model_info()

Extract model info from config file

plot_TS_diagrams(**kwargs)
read_model()

Read whole model period

read_model_timeslice(thetao_file, so_file, yidx)

Read a timeslice from the future period

read_reference(**kwargs)
i7aof.biascorr.projection.status(process_name)