:py:mod:`src.verify` ==================== .. py:module:: src.verify Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: src.verify.rXY src.verify.ri src.verify.msss src.verify.crpss src.verify.Fisher_z src.verify._calculate_metric_from_timeseries src.verify.calculate_metric src.verify.verify src.verify.main Attributes ~~~~~~~~~~ .. autoapisummary:: src.verify.N_BOOTSTRAP_ITERATIONS src.verify.PROJECT_DIR src.verify.DATA_DIR src.verify.log_fmt .. py:data:: N_BOOTSTRAP_ITERATIONS :annotation: = 1000 .. py:data:: PROJECT_DIR .. py:data:: DATA_DIR .. py:function:: rXY(hcst, obsv, correlation='pearson_r') Return the anomaly cross correlation between two timeseries :Parameters: **hcst** : xarray Dataset The forecast timeseries **obsv** : xarray Dataset The observed timeseries .. !! processed by numpydoc !! .. py:function:: ri(hcst, obsv, hist) Return the initialised component of Pearson anomaly cross correlation between a forecast and observations :Parameters: **hcst** : xarray Dataset The forecast timeseries **obsv** : xarray Dataset The observed timeseries **hist** : xarray Dataset The historical simulation timeseries .. !! processed by numpydoc !! .. py:function:: msss(hcst, obsv, ref, ensemble_mean=True) Return the mean squared skill score between a forecast and observations relative to a reference dataset :Parameters: **hcst** : xarray Dataset The forecast timeseries **obsv** : xarray Dataset The observed timeseries **ref** : xarray Dataset The reference timeseries **ensemble_mean: boolean, optional** If true, take the mean across the "member" dimension of hcst and ref (if it exists) prior to calculating the MSSS .. !! processed by numpydoc !! .. py:function:: crpss(hcst, obsv, ref) Return the Continuous rank probability skill score between a forecast and observations relative to a reference dataset :Parameters: **hcst** : xarray Dataset The forecast timeseries **obsv** : xarray Dataset The observed timeseries **ref** : xarray Dataset The reference timeseries .. !! processed by numpydoc !! .. py:function:: Fisher_z(ds) Return the Fisher-z transformation of ds :Parameters: **ds** : xarray Dataset The data to apply the Fisher-z transformation to .. !! processed by numpydoc !! .. py:function:: _calculate_metric_from_timeseries(*timeseries, metric, metric_kwargs, significance=True, bootstrap_kwargs={}, transform=None, alpha=0.1) Calculate a skill metric from the provided timeseries Statistical significance at 1-alpha is identified at all points where the sample skill metric is positive (negative) and the fraction of transformed values in the bootstrapped distribution below (above) no_skill_value--defining the p-values--is less than or equal to alpha.) .. !! processed by numpydoc !! .. py:function:: calculate_metric(hindcast, observation, metric, reference=None, metric_kwargs={}, significance=False, transform=None, alpha=0.05) Calculate a skill metric for a set of hindcasts. This function will attempt to validate over a common set of verification times at all leads and will return a warning if this is not possible. If a common set of verification times cannot be found, this function will verify over all available times at each lead :Parameters: **hindcast** : xarray Dataset The hindcast data to verify. Must have "init" and "lead" dimensions **observation** : xarray Dataset The data to verify against. Must have a "time" dimension **metric** : str The name of the metric to apply to apply to the timeseries. Will look for function in src.verify. **reference** : str or xarray Dataset, optional The skill baseline. Can be an xarray Dataset with a "time" dimension (e.g. an historical simulation) that will be passed on to the `metric` function. Alternatively, users can specify one of the following methods to automatically create the appropriate baseline timeseries to be passed on to the `metric` function: - "persistence": hindcasts skill is baselined against the most recent observation at the time of forecast initialisation - "climatology": hindcasts skill is baselined against the monthly climatological mean of the observations over the verification period **metric_kwargs** : dict kwargs to pass to the function `metric` **significance** : boolean, optional If True, also return a mask indicating points where skill estimates are significant using the non-parametric bootstrapping approach of Goddard et al. (2013). **transform** : function, optional Transform to apply prior to estimating significant points **alpha** : float, optional The level [0,1] to apply sigificance at. Statistical significance at 1-alpha is identified at all points where the sample skill metric is positive (negative) and the fraction of transformed values in the bootstrapped distribution below (above) zero--defining the p-values --is less than or equal to alpha.) .. !! processed by numpydoc !! .. py:function:: verify(config, save_dir, save=True) Prepare a skill metric according to a provided config file :Parameters: **config** : str The name of the config file **save_dir** : str The directory to save to **save** : boolean, optional If True (default), save the prepared dataset(s) in zarr format to save_dir. If False, return an xarray Dataset containing the prepared data. The latter is useful for debugging .. !! processed by numpydoc !! .. py:function:: main(config, config_dir, save_dir) Prepare skill metrics according to a provided config file :Parameters: **config** : str The name of the config file **config_dir** : str The directory containing the config file **save_dir** : str The directory to save to .. !! processed by numpydoc !! .. py:data:: log_fmt :annotation: = %(asctime)s - %(name)s - %(levelname)s - %(message)s