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

AttributeError in make_feeds worker #134

Closed
douglatornell opened this issue Dec 21, 2022 · 1 comment · Fixed by #136
Closed

AttributeError in make_feeds worker #134

douglatornell opened this issue Dec 21, 2022 · 1 comment · Fixed by #136
Assignees
Labels
bug Something isn't working Workers
Milestone

Comments

@douglatornell
Copy link
Member

After updating numpy in nowcast-env on skookum from 1.22.3 to 1.24.0:

2022-12-21 12:26:38,380 CRITICAL [make_feeds] unhandled exception:
Traceback (most recent call last):
  File "/SalishSeaCast/NEMO_Nowcast/nemo_nowcast/worker.py", line 391, in _do_work
    checklist = self.worker_func(
  File "/SalishSeaCast/SalishSeaNowcast/nowcast/workers/make_feeds.py", line 90, in make_feeds
    max_ssh_info = _calc_max_ssh_risk(feed, run_date, run_type, config)
  File "/SalishSeaCast/SalishSeaNowcast/nowcast/workers/make_feeds.py", line 210, in _calc_max_ssh_risk
    max_ssh, max_ssh_time = _calc_max_ssh(feed, ttide, run_date, run_type, config)
  File "/SalishSeaCast/SalishSeaNowcast/nowcast/workers/make_feeds.py", line 227, in _calc_max_ssh
    ssh_ts = nc_tools.ssh_timeseries_at_point(grid_T_15m, 0, 0, datetimes=True)
  File "/SalishSeaCast/tools/SalishSeaTools/salishsea_tools/nc_tools.py", line 357, in ssh_timeseries_at_point
    time = timestamp(grid_T, range(len(ssh)), time_var=time_var)
  File "/SalishSeaCast/tools/SalishSeaTools/salishsea_tools/nc_tools.py", line 270, in timestamp
    results.append(time_orig + timedelta(seconds=np.asscalar(time_counter[i])))
  File "/SalishSeaCast/nowcast-env/lib/python3.10/site-packages/numpy/__init__.py", line 284, in __getattr__
    raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'asscalar'
@douglatornell douglatornell added bug Something isn't working Workers labels Dec 21, 2022
@douglatornell douglatornell added this to the v22.1 milestone Dec 21, 2022
@douglatornell douglatornell self-assigned this Dec 21, 2022
@douglatornell
Copy link
Member Author

numpy.asscalar() was deprecated in numpy=1.16 and removed in numpy=1.23. numpy.ndarray.item() is the replacement method to use.

The traceback above leads to instances of numpy.asscalar() in SalishSeaTools. Those were fixed in SalishSeaCast/tools#71. There are also instances in make_feeds._calc_wind_4h_avg() which are fixed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Workers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant