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

Issue with DataFetcher #373

Closed
tjryankeogh opened this issue Jul 22, 2024 · 11 comments
Closed

Issue with DataFetcher #373

tjryankeogh opened this issue Jul 22, 2024 · 11 comments
Assignees
Labels
python-environment About Python environment setup

Comments

@tjryankeogh
Copy link

I've just installed argopy and working through the examples on the readthedocs website.

MCVE Code Sample

from argopy import DataFetcher

# Example 1 from readthedocs
ds = DataFetcher().region([-75, -45, 20, 30, 0, 10, '2011-01', '2011-06']).load().data

# Example 2 from readthedocs
f = DataFetcher()
f = f.float(6902746)
f.load().data

# Example 3 from GitHub home page
ArgoSet = DataFetcher().region([-85,-45,10.,20.,0,10.])
ds = ArgoSet.to_xarray()

Expected Output

According to the examples this should return an xarray dataset with all the variables available.

Problem Description

The following error messages are returned.

FutureWarning: The return type of Dataset.dims will be changed to return a set of dimension names in future, in order to be more consistent with DataArray.dims. To access a mapping from dimension names to lengths, please use Dataset.sizes.
self._dims = list(xarray_obj.dims.keys())

AttributeError: 'ScipyArrayWrapper' object has no attribute 'oindex'

I am then unable to proceed with any of the other examples of how to manipulate and work with the data.

Versions

SYSTEM

commit: None
python: 3.12.3 | packaged by conda-forge | (main, Apr 15 2024, 18:35:20) [Clang 16.0.6 ]
python-bits: 64
OS: Darwin
OS-release: 23.5.0
machine: arm64
processor: arm
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.UTF-8
libhdf5: 1.14.3
libnetcdf: 4.9.2

INSTALLED VERSIONS: CORE

aiohttp : 3.9.3
argopy : 0.1.15
erddapy : 2.2.0
fsspec : 2023.10.0
netCDF4 : 1.6.5
packaging : 24.0
requests : 2.31.0
scipy : 1.13.0
toolz : 0.12.1
xarray : 2024.3.0

INSTALLED VERSIONS: EXT.UTIL

gsw : 3.6.17
tqdm : 4.66.2
zarr : 2.18.2

INSTALLED VERSIONS: EXT.PERF

dask : 2024.4.1
distributed : 2024.4.1
h5netcdf : 1.3.0
pyarrow : 15.0.2

INSTALLED VERSIONS: EXT.PLOT

IPython : 8.22.2
cartopy : 0.23.0
ipykernel : 6.29.3
ipywidgets : 8.1.3
matplotlib : 3.8.4
pyproj : 3.6.1
seaborn : 0.13.2

INSTALLED VERSIONS: DEV

aiofiles : -
black : -
bottleneck : 1.3.8
cfgrib : -
cftime : 1.6.3
conda : -
flake8 : -
nc_time_axis: -
numpy : 1.26.4
pandas : 2.2.2
pip : 24.0
pytest : -
pytest_cov : -
pytest_env : -
pytest_localftpserver: -
setuptools : 69.5.1
sphinx : -

INSTALLED VERSIONS: PIP

pytest-reportlog: -

@gaelforget
Copy link
Member

same issue, also on arm64

@gmaze
Copy link
Member

gmaze commented Aug 19, 2024

Hi @tjryankeogh, @gaelforget
thanks for reporting this !

the issue is known and will be fix in the next release
in the mean time, a quick fix is to work with xarray < 2024.3

@gmaze
Copy link
Member

gmaze commented Aug 27, 2024

hi @tjryankeogh
We just released a new argopy version (v0.1.16) that should fix this issue by pinning xarray to versions lower than 2024.3
The problem is coming from: pydata/xarray#8909
We shall release another version to unpinned xarray when this will be fixed

New argopy version 0.1.16 is available from pypi and in a matter of hours or days on conda as well.

@gaelforget
Copy link
Member

hi @tjryankeogh We just released a new argopy version (v0.1.16) that should fix this issue by pinning xarray to versions lower than 2024.3 The problem is coming from: pydata/xarray#8909 We shall release another version to unpinned xarray when this will be fixed

New argopy version 0.1.16 is available from pypi and in a matter of hours or days on conda as well.

With 0.1.16 , I no longer get AttributeError: 'ScipyArrayWrapper' object has no attribute 'oindex'

but now I get another error :

ValueError: Unable to avoid copy while creating an array as requested.
If using `np.array(obj, copy=False)` replace it with `np.asarray(obj)` to allow a copy when needed (no behavior change in NumPy 1.x).
For more details, see https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword.

@gmaze
Copy link
Member

gmaze commented Aug 29, 2024

looks like you're on numpy > 2, is it ?
you should not
argopy works with all the environment definitions:
https://github.com/euroargodev/argopy/tree/master/ci/requirements

@gaelforget
Copy link
Member

looks like you're on numpy > 2, is it ? you should not argopy works with all the environment definitions: https://github.com/euroargodev/argopy/tree/master/ci/requirements

Thanks @gmaze!

It seems that I am using scipy 1.14.1 though :

(myenv) (base) √ ArgoData.jl % pip list
Package            Version
------------------ -----------
aiohappyeyeballs   2.4.0
aiohttp            3.10.5
aiosignal          1.3.1
anyio              4.4.0
argopy             0.1.16
async-timeout      4.0.3
attrs              24.2.0
certifi            2024.7.4
cftime             1.6.4
charset-normalizer 3.3.2
decorator          5.1.1
erddapy            2.2.0
exceptiongroup     1.2.2
frozenlist         1.4.1
fsspec             2024.6.1
h11                0.14.0
httpcore           1.0.5
httpx              0.27.2
idna               3.8
multidict          6.0.5
netCDF4            1.7.1.post2
numpy              2.1.0
packaging          24.1
pandas             2.2.2
pip                24.2
python-dateutil    2.9.0.post0
pytz               2024.1
requests           2.32.3
scipy              1.14.1
setuptools         65.5.0
six                1.16.0
sniffio            1.3.1
toolz              0.12.1
typing_extensions  4.12.2
tzdata             2024.1
urllib3            2.2.2
xarray             2024.2.0
yarl               1.9.4

@gmaze
Copy link
Member

gmaze commented Aug 29, 2024

but your numpy is 2.1.0
until xarray get along, can't move up to 2

@gaelforget
Copy link
Member

but your numpy is 2.1.0 until xarray get along, can't move up to 2

Right!! Sorry for getting confused between scipy v numpy earlier. Works now after pip install "numpy<2".

Thanks again!

@gmaze
Copy link
Member

gmaze commented Aug 30, 2024

@tjryankeogh did you manage to fix your install issue ?

@tjryankeogh
Copy link
Author

@gmaze Yes I did thank you. I've managed to get it working by making xarray < 2024.3. Thank you

@gmaze
Copy link
Member

gmaze commented Aug 30, 2024

awesome then !

@gmaze gmaze closed this as completed Aug 30, 2024
@gmaze gmaze added the python-environment About Python environment setup label Aug 30, 2024
@gmaze gmaze self-assigned this Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python-environment About Python environment setup
Projects
None yet
Development

No branches or pull requests

3 participants