compositer

Functions to prepare input for pywapor.et_look, more specifically to group various parameters in time to create composites.

add_times(ds, bins, composite_type)

Add times to the time coordinates, so that every bin has at least one datapoint.

Parameters
  • ds (xr.Dataset) – Datasat for which to check empty bins.

  • bins (list) – List of np.datetime64’s which are the boundaries of the groups into which the variables will grouped.

  • composite_type ({"min" | "max" | "mean"}) – Type of composites that will be created based on the data inside each bin.

Returns

Dataset to which time coordinates have been added to assure no empty bins exist.

Return type

xr.Dataset

time_bins(timelim, bin_length)

Based on the time limits and the bin length, create the bin boundaries.

Parameters
  • timelim (list) – Period for which to prepare data.

  • bin_length (int | "DEKAD") – Length of the bins in days or “DEKAD” for dekadal bins.

Returns

List of np.datetime64’s which are the boundaries of the groups into which the variables will grouped.

Return type

list

main(dss, sources, folder, general_enhancers, bins)

Create composites for variables contained in the ‘xr.Dataset’s in ‘dss’.

Parameters
  • dss (dict) – Keys are tuples of (‘source’, ‘product_name’), values are xr.Dataset’s which will be aligned along the time dimensions.

  • sources (dict) – Configuration for each variable and source.

  • folder (str) – Path to folder in which to store (intermediate) data.

  • general_enhancers (list) – Functions to apply to the xr.Dataset before creating the final output, by default “default”.

  • bins (list) – List of ‘np.datetime64’s which are the boundaries of the groups into which the variables will grouped.

Returns

Dataset with variables grouped into composites.

Return type

xr.Dataset