sup3r.bias.bias_transforms.monthly_local_linear_bc

monthly_local_linear_bc(input, lat_lon, feature_name, bias_fp, time_index, lr_padded_slice=None, temporal_avg=True, out_range=None, smoothing=0)[source]

Bias correct data using a simple monthly *scalar +adder method on a site-by-site basis.

Parameters:
  • input (np.ndarray) – Sup3r input data to be bias corrected, assumed to be 3D with shape (spatial, spatial, temporal) for a single feature.

  • lat_lon (ndarray) – Array of latitudes and longitudes for the domain to bias correct (n_lats, n_lons, 2)

  • feature_name (str) – Name of feature that is being corrected. Datasets with names “{feature_name}_scalar” and “{feature_name}_adder” will be retrieved from bias_fp.

  • bias_fp (str) – Filepath to bias correction file from the bias calc module. Must have datasets “{feature_name}_scalar” and “{feature_name}_adder” that are the full low-resolution shape of the forward pass input that will be sliced using lr_padded_slice for the current chunk.

  • time_index (pd.DatetimeIndex) – DatetimeIndex object associated with the input data temporal axis (assumed 3rd axis e.g. axis=2). Note that if this method is called as part of a sup3r resolution forward pass, the time_index will be included automatically for the current chunk.

  • lr_padded_slice (tuple | None) – Tuple of length four that slices (spatial_1, spatial_2, temporal, features) where each tuple entry is a slice object for that axes. Note that if this method is called as part of a sup3r forward pass, the lr_padded_slice will be included automatically in the kwargs for the active chunk. If this is None, no slicing will be done and the full bias correction source shape will be used.

  • temporal_avg (bool) – Take the average scalars and adders for the chunk’s time index, this will smooth the transition of scalars/adders from month to month if processing small chunks. If processing the full annual time index, set this to False.

  • out_range (None | tuple) – Option to set floor/ceiling values on the output data.

  • smoothing (float) – Value to use to smooth the scalar/adder data. This can reduce the effect of extreme values within aggregations over large number of pixels. This value is the standard deviation for the gaussian_filter kernel.

Returns:

out (np.ndarray) – out = input * scalar + adder