nctoolkit.DataSet.compare

DataSet.compare(expression=None)

Compare all variables to a constant

Parameters:

expression (str) – This a regular comparison such as “<0”, “>0”, “==0”

Examples

If you wanted to identify grid cells with positive values you would do the following:

>>> ds.compare(">0")

This could also be done using standard python syntax:

>>> ds > 0

This will be calculcated for each time step.

If you wanted to identify grid cells with negative values, you would do this

>>> ds.compare("<0")

This could also be done using standard python syntax:

>>> ds < 0