Along time diagnostics
Along time diagnostics are added using the
add_time_stat()
method.Requested statistics will be computed at the provided frequency.
Add an along time diagnostic computing requested statistics at the
provided frequency.
Parameters
----------
name
Name of the diagnostic.
field
Field on which to compute statistics.
freq
Frequency (day, pass, cycle or any pandas offset aliases [1]_)
stats
List of statistics to compute (count, max, mean, median, min, std, var, mad)
stat_selection
Selection clip used to invalidate (set to NaN) some bins.
Valid conditions are:
* count
* min
* max
* mean
* median
* std
* var
* mad
These clips are Python vector clips.
Examples:
* count :>= 10 && max :< 100
* min :> 3
* median :> 10 && mean :> 9
freq_kwargs
Additional parameters to pass to pandas.date_range underlying function.
References
----------
.. [1] https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html #timeseries-offset-aliases
.. [2] https://pandas.pydata.org/pandas-docs/stable/reference/api/ pandas.date_range.html
This kind of diagnostic is plotted as an along time plot.
An optional parameter,
freq_kwargs
, is also available.It is a dictionary of additional parameters to pass to the pandas.date_range
underlying function.
For instance:
ad.add_time_stat(
name="Sigma 0 by day",
freq="1H",
freq_kwargs={"normalize": True},
field=sig0,
stats=["mean", "std", "var"],
)
Diagnostic setting
In the following example we are setting an along time diagnostic computing 3 statistics
(mean, standard deviation and variance) at a daily frequency for the
SIGMA0.ALTI
field.sig0 = ad.fields["SIGMA0.ALTI"]
ad.add_time_stat(
name="Sigma 0 by day",
freq="day",
field=sig0,
stats=["mean", "std", "var"],
)
ad.compute()
Diagnostic plotting
Along time statistics are plotted as along time plots.
CasysPlot
requires a stat
parameter to
be given in order to know which statistic to display.from casys import CasysPlot
plot = CasysPlot(
data=ad,
data_name="Sigma 0 by day",
stat="mean",
)
plot.show()
