nctoolkit.DataSet.tmedian¶
-
DataSet.
tmedian
(self, over='time')¶ Calculate the temporal median of all variables :param over: Time periods to average over. Options are ‘year’, ‘month’, ‘day’. :type over: str or list
Examples
If you want to calculate median over all time steps. Do the following:
>>> data.tmedian()
If you want to calculate the median for each year in a dataset, do this:
>>> data.tmedian("year")
If you want to calculate the median for each month in a dataset, do this:
>>> data.tmedian("month")
If you want to calculate the median for each month in each year in a dataset, do this:
>>> data.tmedian(["year", "month"])
This method will also let you easily calculate climatologies. So, if you wanted to calculate a monthly climatological median, you would do this:
>>> data.tmedian( "month")
A daily climatological median would be the following:
>>> data.tmedian( "day")