Grouped report class

class marine_qc.qc_grouped_reports.SuperObsGrid[source]

Class for gridding data in buddy check, based on numpy arrays.

add_multiple_observations(lat, lon, value, date=None, month=None, day=None)[source]

Add a series of observations to the grid and take the grid average.

Parameters:
Raises:

TypeError – If inspect_arrays does not return np.ndarrays.

Return type:

None

Notes

The observations should be anomalies.

add_single_observation(lat, lon, month, day, anom)[source]

Add an anomaly to the grid from specified lat lon and date.

Parameters:
  • lat (float) – Latitude of the observation in degrees.

  • lon (float) – Longitude of the observation in degrees.

  • month (int) – Month of the observation.

  • day (int) – Day of the observation.

  • anom (float) – Value to be added to the grid.

Return type:

None

Returns:

None – The function performs its operations in-place and does not return anything.

get_buddy_limits_with_parameters(pentad_stdev, limits, number_of_obs_thresholds, multipliers)[source]

Get buddy limits with parameters.

Parameters:
  • pentad_stdev (Climatology) – Climatology containing the 3-dimensional latitude array containing the standard deviations.

  • limits (list[list[int]]) – List of the limits.

  • number_of_obs_thresholds (list[list[int]]) – List containing the number of obs thresholds.

  • multipliers (list[list[float]]) – List containing the multipliers to be applied.

Return type:

None

Returns:

None – The function performs its operations in-place and does not return anything.

get_buddy_mean(lat, lon, month, day)[source]

Get the buddy mean from the grid for a specified time and place.

Parameters:
  • lat (float) – Latitude of the location for which the buddy mean is desired.

  • lon (float) – Longitude of the location for which the buddy mean is desired.

  • month (int) – Month for which the buddy mean is desired.

  • day (int) – Day for which the buddy mean is desired.

Return type:

float

Returns:

float – Buddy mean at the specified location.

get_buddy_stdev(lat, lon, month, day)[source]

Get the buddy standard deviation from the grid for a specified time and place.

Parameters:
  • lat (float) – Latitude of the location for which the buddy standard deviation is desired.

  • lon (float) – Longitude of the location for which the buddy standard deviation is desired.

  • month (int) – Month for which the buddy standard deviation is desired.

  • day (int) – Day for which the buddy standard deviation is desired.

Return type:

float

Returns:

float – Buddy standard deviation at the specified location.

get_neighbour_anomalies(search_radius, xindex, yindex, pindex)[source]

Search within a specified search radius of the given point and extract the neighbours for buddy check.

Parameters:
  • search_radius (list[int]) – Three element array search radius [lon, lat, time].

  • xindex (int) – The xindex of the gridcell to start from.

  • yindex (int) – The yindex of the gridcell to start from.

  • pindex (int) – The pindex of the gridcell to start from.

Return type:

tuple[list[float], list[float]]

Returns:

tuple of list of float – Anomalies and numbers of observations in two lists.

get_new_buddy_limits(stdev1, stdev2, stdev3, limits, sigma_m, noise_scaling)[source]

Get buddy limits for new bayesian buddy check.

Parameters:
  • stdev1 (Climatology) – Field of standard deviations representing standard deviation of difference between target gridcell and complete neighbour average (grid area to neighbourhood difference).

  • stdev2 (Climatology) – Field of standard deviations representing standard deviation of difference between a single observation and the target gridcell average (point to grid area difference).

  • stdev3 (Climatology) – Field of standard deviations representing standard deviation of difference between random neighbour gridcell and full neighbour average (uncertainty in neighbour average).

  • limits (list[int, int, int]) – Three membered list of number of degrees in latitude and longitude and number of pentads.

  • sigma_m (float) – Estimated measurement error uncertainty.

  • noise_scaling (float) – Scale noise by a factor of noise_scaling used to match observed variability.

Return type:

None

Returns:

None – The function performs its operations in-place and does not return anything.

Notes

The original default values for limits, sigma_m, and noise_scaling originally defaulted to:

  • limits = (2, 2, 4)

  • sigma_m = 1.0

  • noise_scaling = 3.0

take_average()[source]

Take the average of a grid to which reps have been added using add_rep.

Return type:

None

Grouped report functions

marine_qc.qc_grouped_reports.get_threshold_multiplier(total_nobs, nob_limits, multiplier_values)[source]

Find the highest value of i such that total_nobs is greater than nob_limits[i] and return multiplier_values[i].

This routine is used by the buddy check. It’s a bit niche.

Parameters:
  • total_nobs (int) – Total number of neighbour observations.

  • nob_limits (list[int]) – List containing the limiting numbers of observations in ascending order first element must be zero.

  • multiplier_values (list[float]) – List containing the multiplier values associated..

Return type:

float

Returns:

float – The multiplier value.