Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mods needed for cftime PR #202 #51

Closed
wants to merge 6 commits into from
Closed

Conversation

jswhit2
Copy link

@jswhit2 jswhit2 commented Oct 1, 2020

see discussion at Unidata/cftime#198

Small backwards compatibile change to one of the tests needed so that they pass with Unidata/cftime#202

@coveralls
Copy link

coveralls commented Oct 1, 2020

Coverage Status

Coverage decreased (-1.7%) to 90.751% when pulling 0f94586 on jswhit:cftime_pr202 into 05aad75 on SciTools:master.

@jswhit
Copy link

jswhit commented Nov 7, 2020

commented out a test in test_NetCDFTimeDateLocator.py that removes year zero. Year zero in a reference date is now explicity checked for in cftime.datetime (an error is raised if it is used).

Copy link
Contributor

@trexfeathers trexfeathers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jswhit thanks for you vigilance, and sorry that the support for nc-time-axis is so sporadic. I will keep trying my best to carve out time when I can.

Having read around the issues discussed here, I've suggested some alternatives for dealing with them. Hopefully they sound sensible to you.

Also: please can you sign the SciTools CLA (see the Governance notes for more detail), otherwise this PR cannot be merged even after it has been reviewed.

nc_time_axis/tests/integration/test_plot.py Outdated Show resolved Hide resolved
nc_time_axis/tests/integration/test_plot.py Outdated Show resolved Hide resolved
Comment on lines 146 to 156
""" def test_yearly_yr0_remove(self):
for calendar in self.all_calendars:
# convert values to dates, check that none of them has year 0
num2date = cftime.utime(self.date_unit, calendar).num2date
ticks = self.check(5, 0, 100 * 365, calendar)
year_ticks = [num2date(t).year for t in ticks]
if calendar in self.yr0_remove_calendars:
self.assertNotIn(0, year_ticks)
else:
self.assertIn(0, year_ticks)
"""
Copy link
Contributor

@trexfeathers trexfeathers Jan 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_yearly_yr0_remove erroring is a symptom of a deeper problem that Unidata/cftime#202 has caused. The fix is a small one and would be safer than just commenting out an erroring test:

nc_time_axis.NetCDFTimeDateLocator.tick_values() relies on a non-calendar-aware instance of cftime.datetime on L156 and L165. Adding a calendar=None argument to both of these will allow tick_values() to function as before - it will remove invalid tick values where year=0 on certain calendars, rather than raising a ValueError.

@jswhit
Copy link

jswhit commented Jan 16, 2021

CLA signed and comments addressed.

@trexfeathers
Copy link
Contributor

@jswhit are you happy with my suggested change to nc_time_axis.NetCDFTimeDateLocator.tick_values()? That should get the tests passing

@spencerkclark
Copy link
Member

spencerkclark commented Mar 7, 2021

@jswhit @trexfeathers, I made a PR to @jswhit's branch (jswhit#1) making @trexfeathers's suggested fix. Let me know if that looks good; it would be great to get this PR merged so that a new release of nc-time-axis can be issued (#54).

@bjlittle
Copy link
Member

Closed by #66

@bjlittle bjlittle closed this Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

small change to tests needed for upcoming cftime 1.3.0 release
7 participants