sup3r.qa.utilities.direct_dist

Contents

sup3r.qa.utilities.direct_dist#

direct_dist(var, bins=40, range=None, diff_max=None, scale=1, percentile=99.9, interpolate=False, period=None)[source]#

Returns the direct distribution for the given variable.

Parameters:
  • var (ndarray) – (lat, lon, temporal)

  • bins (int) – Number of bins for the direct pdf.

  • range (tuple | None) – Optional min/max range for the direct pdf.

  • diff_max (float) – Max value to keep for given variable

  • scale (int) – Factor to scale the distribution by. This is used so that distributions from data with different resolutions can be compared. For instance, if this is calculating a vorticity distribution from data with a spatial resolution of 4km then the distribution needs to be scaled by 4km to compare to another scaled vorticity distribution with a different resolution.

  • percentile (float) – Percentile to use to determine the maximum allowable value in the distribution. e.g. percentile=99 eliminates values above the 99th percentile from the histogram.

  • interpolate (bool) – Whether to interpolate over histogram counts. e.g. if a bin has count = 0 and surrounding bins have count > 0 the bin with count = 0 will have an interpolated value.

  • period (float | None) – If variable is periodic this gives that period. e.g. If the variable is winddirection the period is 360 degrees and we need to account for 0 and 360 being close.

Returns:

  • ndarray – var at bin centers

  • ndarray – var value counts

  • float – Normalization factor