xarray.DataArray.pr.coverage

xarray.DataArray.pr.coverage#

DataArray.pr.coverage(*dims: Hashable) DataFrame | Series#

Summarize how many data points exist for a dimension combination.

For each combinations of values in the given dimensions, count the number of non-NaN data points in the array. The result is returned as an N-dimensional pandas DataFrame.

If the array’s dtype is bool, count the number of True values instead. This makes it possible to easily apply preprocessing. For example, to count the number of valid time series use da.notnull().any("time").coverage(...).

Parameters:
*dims: str

Names or aliases of the dimensions to be used for summarizing. You can specify any number of dimensions, but the readability of the result is best for one or two dimensions.

Returns:
coverage: pandas.DataFrame or pandas.Series

N-dimensional dataframe (series for N=1) summarizing the number of non-NaN data points for each combination of values in the given dimensions.