def tn_days_below(tasmin, thresh="-10.0 degC", freq="YS"): r"""Number of days with tmin below a threshold in Number of days where daily minimum temperature is below a threshold. Parameters ---------- tasmin : xarray.DataArray Minimum daily temperature [℃] or [K] thresh : str Threshold temperature on which to base evaluation [℃] or [K] . Default: '-10 degC'. freq : str, optional Resampling frequency Returns ------- xarray.DataArray Number of days Tmin < threshold. Notes ----- Let :math:`TN_{ij}` be the daily minimum temperature at day :math:`i` of period :math:`j`. Then counted is the number of days where: .. math:: TX_{ij} < Threshold [℃] """ thresh = utils.convert_units_to(thresh, tasmin) f1 = utils.threshold_count(tasmin, "<", thresh, freq) return f1
def test_simple(self, tas_series): ts = tas_series(np.arange(365)) out = utils.threshold_count(ts, "<", 50, "Y") np.testing.assert_array_equal(out, [50, 0])