nctoolkit.DataSet.first_above
- DataSet.first_above(x=None)
first_above: Identify the time step when a value is first above a threshold.
This will do the comparison with either a number, a Dataset or a netCDF file.
- Parameters:
x (int, float, DataSet or netCDF file) – An int, float, single file dataset or netCDF file to use for the threshold(s). If comparing with a dataset or single file there must only be a single variable in it. The grids must be the same.
Examples
If you wanted to calculate the first time step where the value in a grid cell goes above 10, you would do the following
>>> ds.first_above(10)
If you wanted to calculate the first time step where the value in a grid cell goes above that in another dataset, the following will work. Note that both datasets must have the same grid, and can only have single variables. The second dataset can, of course, only have one timestep.
>>> ds.first_above(ds1)