Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
O ORCHESTRA-SST
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 4
    • Issues 4
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • brivas
  • ORCHESTRA-SST
  • Issues
  • #7

Closed
Open
Created Aug 20, 2021 by brivas@brecinosrivasMaintainer

migrate to the latest xarray version

When installing the new version of xarray I got the following error:

/usr/local/Caskroom/miniconda/base/envs/sst_env/bin/python /Users/brivas/ORCHESTRA_sst/sst_differences.py
{'long_name': 'analysed sea surface temperature', 'standard_name': 'sea_water_temperature', 'units': 'kelvin', 'description': 'CCI-SST interpolated to ICOADS drifting buoy location and averaged on a 1.0 degree resolution cell'}
Traceback (most recent call last):
  File "/Users/brivas/ORCHESTRA_sst/sst_differences.py", line 52, in <module>
    grid_boxes_with_data = xr.apply_ufunc(non_zero_data,
  File "/usr/local/Caskroom/miniconda/base/envs/sst_env/lib/python3.8/site-packages/xarray/core/computation.py", line 1174, in apply_ufunc
    return apply_dataarray_vfunc(
  File "/usr/local/Caskroom/miniconda/base/envs/sst_env/lib/python3.8/site-packages/xarray/core/computation.py", line 293, in apply_dataarray_vfunc
    result_var = func(*data_vars)
  File "/usr/local/Caskroom/miniconda/base/envs/sst_env/lib/python3.8/site-packages/xarray/core/computation.py", line 767, in apply_variable_ufunc
    raise ValueError(
ValueError: applied function returned data with unexpected number of dimensions. Received 0 dimension(s) but expected 1 dimensions with names: ('time',)

According to stackoverflow this is because the new version of the xarray.apply_ufunc requires the latitudes to be sorted in an ascending way.

see the following xarray documentation and blog post link.

This issue is not a problem in xarray version 0.16.0

The error can be fix by sorting the latitudes first here and than running the xr.apply_ufunc()

See lines L49 onwards

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking