bluemath_tk.predictor package
Submodules
bluemath_tk.predictor.awt module
bluemath_tk.predictor.dwt module
bluemath_tk.predictor.indices module
bluemath_tk.predictor.itca module
bluemath_tk.predictor.iwt module
Module contents
Project: BlueMath_tk Sub-Module: predictor Author: GeoOcean Research Group, Universidad de Cantabria Creation Date: 19 March 2025 Repository: https://github.com/GeoOcean/BlueMath_tk.git Status: Under development (Working)
- class bluemath_tk.predictor.XWT(steps: Dict[str, BlueMathModel])[source]
Bases:
BlueMathModel
,BlueMathPipeline
Xly Weather Types (XWT) class.
This class implements the XWT method to identify and classify weather patterns in a dataset. The XWT method is a combination of Principal Component Analysis (PCA) and K-means clustering (KMA).
- steps
The steps of the XWT method.
- Type:
Dict[str, BlueMathModel]
- num_clusters
The number of clusters.
- Type:
int
- kma_bmus
The KMA best matching units (BMUs).
- Type:
pd.DataFrame
- property clusters_annual_probs_df
- property clusters_monthly_probs_df
- property clusters_perpetual_year_probs_df
- property clusters_probs_df
- property clusters_seasonal_probs_df
- property data: Dataset
- fit(data: Dataset, fit_params: Dict[str, Dict[str, Any]] = {}, variable_to_sort_bmus: str = None) None [source]
Fit the XWT model to the data.
- Parameters:
data (xr.Dataset) – The data to fit the model to. Must be PCA formatted.
fit_params (Dict[str, Dict[str, Any]], optional) – The fitting parameters for the PCA and KMA models. Default is {}.
variable_to_sort_bmus (str, optional) – The variable to sort the BMUs. Default is None.
- Raises:
XWTError – If the data is not PCA formatted.
- property get_conditioned_probabilities
- plot_dwts_probs(vmax: float = 0.15, vmax_seasonality: float = 0.15, plot_text: bool = False) None [source]
Plot Daily Weather Types bmus probabilities.
- Parameters:
vmax (float, optional) – The maximum value of the colorbar. Default is 0.15.
vmax_seasonality (float, optional) – The maximum value of the colorbar for seasonality. Default is 0.15.
plot_text (bool, optional) – Whether to plot the text in each cell. Default is False.
- Raises:
ValueError – If the kma_bmus time sampling is not daily.
- plot_map_features(ax: Axes, land_color: str = array([0.9375, 0.9375, 0.859375])) None [source]
Plot map features on an axis.
- Parameters:
ax (Axes) – The axis to plot the map features on.
land_color (str, optional) – The color of the land. Default is cfeature.COLORS[“land”].
- plot_perpetual_year() Axes [source]
Plot perpetual year bmus probabilities.
- Returns:
The plot with the perpetual year bmus probabilities.
- Return type:
Axes
- plot_xwts(var_to_plot: str, anomaly: bool = False, map_center: tuple = None) Collection [source]
Plot the XWTs for a variable.
- Parameters:
var_to_plot (str) – The variable to plot.
anomaly (bool, optional) – Whether to plot the anomaly of the variable. Default is False.
map_center (tuple, optional) – The center of the map. Default is None.
- Returns:
The grid specification with the XWTs plot.
- Return type:
GridSpec