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

BUG: loading cdf data with numpy 1.24 #142

Closed
jklenzing opened this issue Dec 21, 2022 · 5 comments
Closed

BUG: loading cdf data with numpy 1.24 #142

jklenzing opened this issue Dec 21, 2022 · 5 comments
Milestone

Comments

@jklenzing
Copy link
Member

jklenzing commented Dec 21, 2022

Describe the bug
When data is loaded with the latest numpy, some instruments (de2_lang, iss_fpmu) encounter new errors.

Update: see root cause in comments below.

To Reproduce

import datetime as dt
import pysat

if dt.datetime(1982, 1, 1) not in lang.files.files.index:
    lang.download(dt.datetime(1982, 1, 1))
lang = pysat.Instrument('de2', 'lang', use_cdflib=True)
lang.load(1982, 1)

Under numpy 1.23, this runs fine. With 1.24, I get

File ~/code/core/pysat/pysat/_instrument.py:3178, in Instrument.load(self, yr, doy, end_yr, end_doy, date, end_date, fname, stop_fname, verifyPad, use_header, **kwargs)
   3175     message = ' '.join((message, 'Loaded data is not',
   3176                        'monotonically increasing. '))
   3177 if self.strict_time_flag:
-> 3178     raise ValueError(' '.join((message, 'To continue to use data,'
   3179                                'set inst.strict_time_flag=False',
   3180                                'before loading data')))
   3181 else:
   3182     warnings.warn(message, stacklevel=2)

ValueError:  Loaded data is not unique. To continue to use data,set inst.strict_time_flag=False before loading data

Expected behavior
Data should load consistently.

Screenshots
n/a

Desktop (please complete the following information):

  • OS: Monterrey
  • python 3.8.11
  • numpy 1.24.0

Also seen for all ubuntu configs in Github Actions

Additional context
Note there are additional issues with the pysatCDF implementation. These are documented in pysat/pysatCDF#46

@jklenzing jklenzing mentioned this issue Dec 21, 2022
11 tasks
@jklenzing
Copy link
Member Author

Noting that failure also occurs for numpy 1.24.1

@jklenzing
Copy link
Member Author

Reviewing the code, this is not directly caused by the numpy version. Both datasets do not have unique data, and this will break when testing against older numpy versions as well. The primary source of failure is in pysatCDF for numpy<1.24.

Ordinarily in the unit tests, if the loading of a data set fails due to non-unique data, the code will try again with the strict time flag set to False. The error messages above appear as "additional errors occurred" when pysatCDF fails on the first go due to chained indices. Needs fix at pysat/pysatCDF#47

@jklenzing jklenzing added this to the 0.0.5 Release milestone Mar 31, 2023
@jklenzing
Copy link
Member Author

jklenzing commented Mar 31, 2023

Plan forward:

  • 0.0.5: Restructure CI tests to skip pysatCDF tests until the latest version is released.
  • 0.0.5: remove numpy version cap
  • 0.0.5: include user feedback / documentation for trying to use pysatCDF with numpy 1.24
  • version bump and revisit

@jklenzing
Copy link
Member Author

Bumping version. Will revisit for the 0.1.0 release.

@jklenzing jklenzing modified the milestones: 0.1.0 Release, 0.0.5 Release Apr 3, 2023
@jklenzing
Copy link
Member Author

Since the pysatCDF issue is captured at that package, closing this issue.

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

No branches or pull requests

1 participant