Skip to content
/ xarray Public
forked from pydata/xarray

Commit

Permalink
Fix leap year condition in monthly means example (pydata#3464)
Browse files Browse the repository at this point in the history
* Typo correction in docs (pydata#3387)

* Update terminology.rst (pydata#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 (pydata#3464)

* Update doc/whats-new.rst

Co-Authored-By: Deepak Cherian <[email protected]>
  • Loading branch information
2 people authored and keewis committed Nov 21, 2019
1 parent d502ae2 commit 1faf67c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion doc/examples/monthly-means.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
" \n",
" for i, (month, year) in enumerate(zip(time.month, time.year)):\n",
" month_length[i] = cal_days[month]\n",
" if leap_year(year, calendar=calendar):\n",
" if leap_year(year, calendar=calendar) and month == 2:\n",
" month_length[i] += 1\n",
" return month_length"
]
Expand Down

0 comments on commit 1faf67c

Please sign in to comment.