climpred.classes.HindcastEnsemble.plot_alignment#

HindcastEnsemble.plot_alignment(alignment: Optional[Union[str, List[str]]] = None, reference: Optional[Union[str, List[str]]] = None, date2num_units: str = 'days since 1960-01-01', return_xr: bool = False, cmap: str = 'viridis', edgecolors: str = 'gray', **plot_kwargs: Any) Any[source]#

Plot initialized valid_time where matching verification time.

Depends on alignment. Plots days since reference date controlled by date2num_units. NaN / white space shows where no verification is done.

Parameters
  • alignment – which inits or verification times should be aligned?

    • "maximize": maximize the degrees of freedom by slicing initialized and verif to a common time frame at each lead.

    • "same_inits": slice to a common init frame prior to computing metric. This philosophy follows the thought that each lead should be based on the same set of initializations.

    • "same_verif": slice to a common/consistent verification time frame prior to computing metric. This philosophy follows the thought that each lead should be based on the same set of verification dates.

    • None defaults to the three above.

  • reference – Type of reference forecasts with which to verify against. One or more of ["uninitialized", "persistence", "climatology"]. Defaults to None meaning no reference.

  • date2num_units – passed to cftime.date2num as units

  • return_xr – if True return xarray.DataArray else plot

  • cmap – color palette

  • edgecolors – color of the edges in the plot

  • **plot_kwargs – arguments passed to plot.

Returns

xarray.DataArray if return_xr else plot

Example

>>> HindcastEnsemble.plot_alignment(alignment=None, return_xr=True)
<xarray.DataArray 'valid_time' (alignment: 3, lead: 10, init: 61)>
array([[[-1826., -1461., -1095., ...,    nan,    nan,    nan],
        [-1461., -1095.,  -730., ...,    nan,    nan,    nan],
        [-1095.,  -730.,  -365., ...,    nan,    nan,    nan],
        ...,
        [  731.,  1096.,  1461., ...,    nan,    nan,    nan],
        [ 1096.,  1461.,  1827., ...,    nan,    nan,    nan],
        [ 1461.,  1827.,  2192., ...,    nan,    nan,    nan]],

       [[   nan,    nan,    nan, ..., 19359., 19724., 20089.],
        [   nan,    nan,    nan, ..., 19724., 20089.,    nan],
        [   nan,    nan,    nan, ..., 20089.,    nan,    nan],
        ...,
        [   nan,    nan,  1461., ...,    nan,    nan,    nan],
        [   nan,  1461.,  1827., ...,    nan,    nan,    nan],
        [ 1461.,  1827.,  2192., ...,    nan,    nan,    nan]],

       [[-1826., -1461., -1095., ..., 19359., 19724., 20089.],
        [-1461., -1095.,  -730., ..., 19724., 20089.,    nan],
        [-1095.,  -730.,  -365., ..., 20089.,    nan,    nan],
        ...,
        [  731.,  1096.,  1461., ...,    nan,    nan,    nan],
        [ 1096.,  1461.,  1827., ...,    nan,    nan,    nan],
        [ 1461.,  1827.,  2192., ...,    nan,    nan,    nan]]])
Coordinates:
  * init        (init) object 1954-01-01 00:00:00 ... 2014-01-01 00:00:00
  * lead        (lead) int32 1 2 3 4 5 6 7 8 9 10
  * alignment   (alignment) <U10 'same_init' 'same_verif' 'maximize'
    valid_time  (lead, init) object 1955-01-01 00:00:00 ... 2024-01-01 00:00:00
Attributes:
    units:    days since 1960-01-01
>>> HindcastEnsemble.plot_alignment(
...     alignment="same_verifs"
... )  
<matplotlib.collections.QuadMesh object at 0x1405c1520>