diff --git a/doc/examples/monthly-means.rst b/doc/examples/monthly-means.rst index 7cc47eb2847..7d620f1bca3 100644 --- a/doc/examples/monthly-means.rst +++ b/doc/examples/monthly-means.rst @@ -83,7 +83,7 @@ the ``calendar.month_range`` function. for i, (month, year) in enumerate(zip(time.month, time.year)): month_length[i] = cal_days[month] - if leap_year(year, calendar=calendar): + if leap_year(year, calendar=calendar) and month == 2: month_length[i] += 1 return month_length diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 6bcf4b61436..6c69d8014d9 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -73,7 +73,7 @@ Bug fixes Documentation ~~~~~~~~~~~~~ - +- Fix leap year condition in example (http://xarray.pydata.org/en/stable/examples/monthly-means.html) by `Mickaƫl Lalande `_. - Fix the documentation of :py:meth:`DataArray.resample` and :py:meth:`Dataset.resample` and explicitly state that a datetime-like dimension is required. (:pull:`3400`)