- DataSet.tstdev(over='time', align='right', window=None)#
tstdev: Calculate the temporal standard deviation of all variables Useful for: monthly standard deviation, annual/yearly standard deviation, seasonal standard deviation, daily standard deviation, daily climatology, monthly climatology, seasonal climatology
over (str or list) – Time periods to average over. Options are ‘year’, ‘month’, ‘day’. This operates in a similar way to the groupby method in pandas or the tidyverse in R, with over acting as the grouping.
align (str) – This determines whether the output time is at the left, centre or right hand side of the time window. Options are “left”, “centre” and “right”
window (int) – This determines the number of time steps to calculate the standard deviation over to calculate over, on a non-rolling basis. This is useful if you need to calculate the standard deviation every 5 days, for example.
If you want to calculate standard deviation over all time steps. Do the following:
If you want to calculate the standard deviation for each year in a dataset, do this:
If you want to calculate the standard deviation for each month in a dataset, do this:
If you want to calculate the standard deviation for each month in each year in a dataset, do this:
>>> ds.tstdev(["year", "month"])
This method will also let you easily calculate climatologies. So, if you wanted to calculate a monthly climatological var, you would do this:
A daily climatological standard deviation would be the following: