ajdawson / windspharm

A Python library for spherical harmonic computations on vector winds.
http://ajdawson.github.io/windspharm
MIT License
82 stars 36 forks source link

Issue attempting to import Windspharm in script #112

Open Jking255 opened 4 years ago

Jking255 commented 4 years ago

Hi,

Looking forward to using this package, thanks for developing! As a first run through to check everything works (having installed Windspharm in my Conda environment), I'm attempting to run the example standard interface streamfunction/velocity potential script with some of my own data. An error is thrown up which looks like a problem in the interaction with Xarray:

Traceback (most recent call last):
  File "windspharm_example.py", line 21, in <module>
    from windspharm.standard import VectorWind
  File "/ouce-home/students/sedm4616/.conda/envs/jk_venv/lib/python2.7/site-packages/windspharm/__init__.py", line 49, in <module>
    from . import xarray
  File "/ouce-home/students/sedm4616/.conda/envs/jk_venv/lib/python2.7/site-packages/windspharm/xarray.py", line 24, in <module>
    import xarray as xr
  File "/ouce-home/students/sedm4616/.conda/envs/jk_venv/lib/python2.7/site-packages/xarray/__init__.py", line 10, in <module>
    from .core.alignment import align, broadcast, broadcast_arrays
  File "/ouce-home/students/sedm4616/.conda/envs/jk_venv/lib/python2.7/site-packages/xarray/core/alignment.py", line 11, in <module>
    from .indexing import get_indexer_nd
  File "/ouce-home/students/sedm4616/.conda/envs/jk_venv/lib/python2.7/site-packages/xarray/core/indexing.py", line 11, in <module>
    from . import duck_array_ops, nputils, utils
  File "/ouce-home/students/sedm4616/.conda/envs/jk_venv/lib/python2.7/site-packages/xarray/core/duck_array_ops.py", line 22, in <module>
    from . import dask_array_compat
  File "/ouce-home/students/sedm4616/.conda/envs/jk_venv/lib/python2.7/site-packages/xarray/core/dask_array_compat.py", line 47, in <module>
    AxisError = np.AxisError
AttributeError: 'module' object has no attribute 'AxisError'

Any advice on this would be very much appreciated.

Best,

James

ajdawson commented 4 years ago

Windspharm tries to import all available interfaces when it is first loaded. It looks like you have xarray installed so it is trying to import it but failing. Are you able to import xarray on its own?

import xarray
Jking255 commented 4 years ago

Hi,

This does now seem to work, after a complete update of all the packages in my Conda environment.

Thanks,

James