Skip to content

Commit 59f88f7

Browse files
Fix leap year condition in monthly means example (#3464)
* Typo correction in docs (#3387) * Update terminology.rst (#3455) Fixed broken link * Error in leap year? I've tried this script; however, it adds +1 to all months of the leap years. It sounds like an error, or I am wrong? So I wrote the condition "and month == 2" line 86 so that only the month of February gets +1. * Fix leap year (#3464) * Update doc/whats-new.rst Co-Authored-By: Deepak Cherian <[email protected]>
1 parent f115ad1 commit 59f88f7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

doc/examples/monthly-means.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ the ``calendar.month_range`` function.
8383
8484
for i, (month, year) in enumerate(zip(time.month, time.year)):
8585
month_length[i] = cal_days[month]
86-
if leap_year(year, calendar=calendar):
86+
if leap_year(year, calendar=calendar) and month == 2:
8787
month_length[i] += 1
8888
return month_length
8989

doc/whats-new.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Bug fixes
6767

6868
Documentation
6969
~~~~~~~~~~~~~
70-
70+
- Fix leap year condition in example (http://xarray.pydata.org/en/stable/examples/monthly-means.html) by `Mickaël Lalande <https://github.com/mickaellalande>`_.
7171
- Fix the documentation of :py:meth:`DataArray.resample` and
7272
:py:meth:`Dataset.resample` and explicitly state that a
7373
datetime-like dimension is required. (:pull:`3400`)

0 commit comments

Comments
 (0)