Skip to content

Commit

Permalink
Fix leap year condition in monthly means example (#3464)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
mickaellalande and dcherian committed Oct 30, 2019
1 parent f115ad1 commit 59f88f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/examples/monthly-means.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Bug fixes

Documentation
~~~~~~~~~~~~~

- Fix leap year condition in example (http://xarray.pydata.org/en/stable/examples/monthly-means.html) by `Mickaël Lalande <https://github.com/mickaellalande>`_.
- 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`)
Expand Down

0 comments on commit 59f88f7

Please sign in to comment.