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

scatter_map NameError: name 'ccrs' is not defined #414

Closed
cywhale opened this issue Nov 27, 2024 · 4 comments
Closed

scatter_map NameError: name 'ccrs' is not defined #414

cywhale opened this issue Nov 27, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@cywhale
Copy link

cywhale commented Nov 27, 2024

Reproducible code using official example:

from argopy.plot import scatter_map
from argopy import DataFetcher

# import cartopy.crs as ccrs #not work whether add this or not
# import cartopy

ArgoSet = DataFetcher(mode='expert').float([6902771, 4903348]).load()
ds = ArgoSet.data.argo.point2profile()
df = ArgoSet.index

scatter_map(df)

Got NameError:
---> 11 scatter_map(df)

File ~/.pyenv/versions/py312numpy1/lib/python3.12/site-packages/argopy/plot/plot.py:525, in scatter_map(data, x, y, hue, #skip....
--> 525 subplot_kw = {"projection": ccrs.PlateCarree()}
#skip....
NameError: name 'ccrs' is not defined

scatter_map works before, so it may due to missing import for cartopy.crs (ccrs)?

Versions

python -c "import cartopy; print(cartopy.version)"
0.24.1

Output of `argopy.show_versions()` SYSTEM ------ commit: None python: 3.12.5 (main, Sep 2 2024, 14:21:15) [GCC 13.2.0] python-bits: 64 OS: Linux OS-release: 6.8.0-49-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: zh_TW.UTF-8 LOCALE: zh_TW.UTF-8 libhdf5: 1.14.2 libnetcdf: 4.9.3-development

INSTALLED VERSIONS: CORE

aiohttp : 3.10.5
argopy : 1.0.0
decorator : 5.1.1
erddapy : 2.2.0
fsspec : 2023.10.0
netCDF4 : 1.7.1.post2
...

INSTALLED VERSIONS: PIP

@gmaze gmaze added the bug Something isn't working label Nov 27, 2024
@gmaze gmaze self-assigned this Nov 27, 2024
@gmaze
Copy link
Member

gmaze commented Nov 27, 2024

Hi @cywhale
Thanks for reporting this issue (and sorry you're hitting one more !)

I can't reproduce the error though
If matplotlib and cartopy are installed this should run
If matplotlib or cartopy are not installed you should see a warning like "requires matplotlib AND cartopy installed" before the error.

The output of argopy.show_versions() was jammed in your message, can you please try to repost it ?

@cywhale
Copy link
Author

cywhale commented Nov 27, 2024

Here is the completed argopy.show_versions()

SYSTEM
------
commit: None
python: 3.12.5 (main, Sep  2 2024, 14:21:15) [GCC 13.2.0]
python-bits: 64
OS: Linux
OS-release: 6.8.0-49-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: zh_TW.UTF-8
LOCALE: zh_TW.UTF-8
libhdf5: 1.14.2
libnetcdf: 4.9.3-development

INSTALLED VERSIONS: CORE
------------------------
aiohttp     : 3.10.5      
argopy      : 1.0.0       
decorator   : 5.1.1       
erddapy     : 2.2.0       
fsspec      : 2023.10.0   
netCDF4     : 1.7.1.post2 
packaging   : 24.1        
requests    : 2.32.3      
scipy       : 1.14.1      
toolz       : 0.12.1      
xarray      : 2024.2.0    

INSTALLED VERSIONS: EXT.UTIL
----------------------------
boto3       : -           
gsw         : -           
s3fs        : -           
tqdm        : -           
zarr        : 2.18.3      

INSTALLED VERSIONS: EXT.PERF
----------------------------
dask        : 2024.10.0   
distributed : 2024.10.0   
h5netcdf    : -           
pyarrow     : 18.0.0      

INSTALLED VERSIONS: EXT.PLOT
----------------------------
IPython     : 8.29.0      
cartopy     : 0.24.1      
ipykernel   : 6.29.5      
ipywidgets  : -           
matplotlib  : 3.8.4       
pyproj      : 3.6.1       
seaborn     : -           

INSTALLED VERSIONS: DEV
-----------------------
aiofiles    : -           
black       : -           
bottleneck  : -           
cfgrib      : -           
cftime      : 1.6.4       
codespell   : -           
flake8      : -           
numpy       : 1.26.4      
pandas      : 2.2.2       
pip         : 24.3.1      
pytest      : -           
pytest_cov  : -           
pytest_env  : -           
pytest_localftpserver: -           
setuptools  : 75.4.0      
sphinx      : -           

INSTALLED VERSIONS: PIP
-----------------------
pytest-reportlog: -           

@gmaze
Copy link
Member

gmaze commented Nov 28, 2024

Hi @cywhale

I could not managed to exactly reproduce your environment, in particular I had to work with: cartopy 0.24.0

But using the environment below (based on yours) the code snippets works ok and I can't reproduce the error.
May be you could try to re-install your env , or make a test with the following:

Env. for argopy-issue414
name: argopy-issue414
channels:
  - conda-forge
dependencies:
  - python = 3.12.5

# CORE:
  - aiohttp    ==3.10.5      
  - decorator  ==5.1.1       
  - erddapy    ==2.2.0       
  - fsspec     ==2023.10.0   
  - netCDF4    ==1.7.2  #==1.7.1.post2 
  - packaging  ==24.1        
  - requests   ==2.32.3      
  - scipy      ==1.14.1      
  - toolz      ==0.12.1      
  - xarray     ==2024.2.0 

# EXT.UTIL:
  - zarr==2.18.3

# EXT.PERF:
  - dask==2024.10.0
  - distributed==2024.10.0
  - pyarrow==18.0.0

# EXT.PLOT:
  - IPython==8.29.0
  - cartopy==0.24.0   #==0.24.1
  - ipykernel==6.29.5
  - matplotlib==3.8.4
  - pyproj==3.6.1

# DEV:
  - cftime==1.6.4
  - numpy==1.26.4
  - pandas==2.2.2
  - pip==24.3.1
  - setuptools==75.6.0 #==75.4.0

@cywhale
Copy link
Author

cywhale commented Nov 29, 2024

It works after reinstalling my env. I did not expect that and should try this. Thanks. Sorry that waste your time and appreciate your help. I close the issue then.

@cywhale cywhale closed this as completed Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants