2.3.13. vacumm.misc.stats
– Statistiques spéciales¶
2.3.13.1. Overview¶
Functions: | |||||
---|---|---|---|---|---|
Classes: |
2.3.13.2. Content¶
Statistical tools
-
class
StatAccum
(tall=False, tavail=None, tmean=None, tstd=None, smax=None, smin=None, tbias=None, trms=None, tcrms=None, tcorr=None, shist=None, tcount=None, sall=False, savail=None, smean=None, sstd=None, tmax=None, tmin=None, sbias=None, srms=None, scrms=None, scorr=None, thist=None, scount=None, bins=None, restart_file=None, restart=False, withtime=None)[source]¶ Bases:
object
Statistics accumulator
Generic params: - t/sall: Perform all the statistics by default.
- withtime, optional: Input does not contain a time dimension.
Single: - tcount/scount: Number of observations taken into account
- tavail/savail: Percentage of available observations
- tmean/smean: Temporal (t) / Spatial (s) average
- tstd/sstd: Temporal (t) / Spatial (s) std
Dual: - tall: Perform all the following statistics by default.
- tbias/sbias: Temporal (t) / Spatial (s) bias
- trms/srms: Temporal (t) / Spatial (s) RMS
- tcrms/scrms: Temporal (t) / Spatial (s) centered RMS
- tcorr/scorr: Temporal (t) / Spatial (s) Correlation
Example: >>> sa = StatAccum(tbias=True, srms=True) >>> sa += ssta1, sstb1 >>> sa += ssta2, sstb2 >>> tbias = sa.get_tbias() >>> srms = sa.get_srms()
-
all_stats
= ('mean', 'std', 'hist', 'min', 'max', 'bias', 'rms', 'crms', 'corr', 'avail', 'count')¶
-
default_restart_file
= 'stataccum_restart.nc'¶
-
dual_stats
= ('bias', 'rms', 'crms', 'corr', 'avail', 'count')¶
-
load
(restart_file=None, iterindex=None, nowtime=None)[source]¶ Load the current instance from a netcdf file
Params: - restart_file, optional: Netcdf restart file.
- iterindex, optional: If given, the restart file is not loaded if
iterindex
is greater or equal to the file’siterindex
attribute. - nowtime, optional: If given, the restart file is not loaded if
nowtime
is greater or equal to the file’slasttime
attribute.
-
single_stats
= ('mean', 'std', 'hist', 'min', 'max')¶
-
exception
StatAccumError
[source]¶ Bases:
vacumm.VACUMMError
-
args
¶
-
message
¶
-
-
corr_proba
(r, ndata, ndataset=2, dof=False)[source]¶ Probability of rejecting correlations
- r: Correlation coefficient
- ndata: Number of records use for correlations
- ndataset, optional: Number of datasets (1 for autocorrelations, else 2) [default: 2]
Todo
This must be rewritten using
scipy.stats
-
ensrank
(obs, ens, gethist=False, getnrz=False, centered=False)[source]¶ Compute the rank of a reference (observations) in an ensemble
If
nens
is the size of the ensemble, the rank may go from0
tonens
.- obs, (…): Observation array
- ens, (nens,…): Ensemble array
- getrank, optional: If True, return also the rank histogram
- getnrz, optional: If True, return also non recovery zones
- centered, optional: Center the ensemble data on the observations before computing the rank
-
qtmax
(var, qt=95.0)[source]¶ Get max using quantiles
This is useful for very asymmetic distributions
Params: - var: A numeric array.
- qt, optional: Percentile used to define max