SuperDARN / pydarn

Python library for visualizing SuperDARN Data
GNU Lesser General Public License v3.0
31 stars 11 forks source link

EHN: Make Cartopy a full dependency #388

Closed carleyjmartin closed 1 month ago

carleyjmartin commented 1 month ago

Scope

This PR includes the newer versions (>=0.22) of cartopy as a full dependency due to their updates that allow for simple installation on most OS. Cartopy (and it's own dependencies) will be installed on the installation of pyDARN now, and logic and warnings to deal with incorrect versions, or no installation have been removed. Also removed is the geocoastline module that was designed for use without cartopy.

issue: to close #381

Approval

Number of approvals: 2

Test

matplotlib version: 3.9.1 caropty version: 0.23.0 Note testers: please indicate what version of matplotlib you are using

PLEASE NOTE THAT THERE IS A BUG IN PYDARNIO AND THE NEWEST NUMPY VERSION, PLEASE DOWNGRADE YOUR NUMPY VERSION TO 1.26.4 TO TEST THIS PR - THIS IS NOT AN ISSUE WITH THIS PR AND IS OUT OF SCOPE FOR PYDARN TO FIX.

To test please use any code, specifically that uses projections so plot fans, fov, grids, maps. Make sure installation works effectively to install cartopy and you can plot the coastlines and geographic projections.

Reminder to use a virtual environment, the easiest way to install is by pip3 install git+https://github.com/superdarn/pydarn@ehn/cartopy-dependency

or clone the repo git clone https://github.com/SuperDARN/pydarn.git , go into the repo cd pydarn, move to this branch git checkout ehn/cartopy-dependency and install pip3 install .

Doreban commented 1 month ago

Testing on windows 10, matplotlib version 3.9.1

I first tested by installing the branch in cartopy version 0.22.0, does not install a new version of cartopy.

Next I tried installing the branch with no cartopy version installed. When installing the branch cartopy version 0.23.0 was installed.

I was going to try testing if I had an older version of cartopy installed but I couldn't get any version prior to 0.22.0 to install

Got an interesting traceback when using the new mag projection on Fan.plot_fan while testing plots were working with the branch (note, other plot_fan plots were made without issue. This only occurred when using the projection pydarn.Projs.MAG):

Traceback (most recent call last):
  File "C:\Users\Dragon\PycharmProjects\pydarn_dev\basic_plots.py", line 28, in <module>
    a = pydarn.Fan.plot_fan(fitacf_data, coastline=True,
  File "C:\Users\Dragon\PycharmProjects\pydarn_dev\.venv\lib\site-packages\pydarn\plotting\fan.py", line 329, in plot_fan
    ax, ccrs = projs(date=date, ax=ax, **kwargs)
  File "C:\Users\Dragon\PycharmProjects\pydarn_dev\.venv\lib\site-packages\pydarn\plotting\projections.py", line 476, in __call__
    return self.value[0](*args, **kwargs)
  File "C:\Users\Dragon\PycharmProjects\pydarn_dev\.venv\lib\site-packages\pydarn\plotting\projections.py", line 138, in axis_geomagnetic
    if cartopyInstalled is False:
NameError: name 'cartopyInstalled' is not defined