Closed carleyjmartin closed 5 months ago
Did some testing,
on matplotlib-3.8.3: No issues with importing and I was able to generate RTP plots.
on matplotlib-3.7.0: No issues with importing and I was able to generate RTP plots.
However, I tried using this branch with matplotlib-3.5.0 and matplotlib-3.6.0, and in both cases I got the following error on importing pydarn.
resetting environment variable IGRF_COEFFS in python script
resetting environment variable AACGM_v2_DAT_PREFIX in python script
non-default coefficient files may be specified by running aacgmv2.wrapper.set_coeff_path before any other functions
Traceback (most recent call last):
File "/home/dgaleschuk/SuperDARN/fit/quick_script.py", line 4, in <module>
import pydarn
File "/home/dgaleschuk/SuperDARN/pydarn_testing_env/lib64/python3.11/site-packages/pydarn/__init__.py", line 69, in <module>
from .plotting.color_maps import PyDARNColormaps
File "/home/dgaleschuk/SuperDARN/pydarn_testing_env/lib64/python3.11/site-packages/pydarn/plotting/color_maps.py", line 5, in <module>
class PyDARNColormaps():
File "/home/dgaleschuk/SuperDARN/pydarn_testing_env/lib64/python3.11/site-packages/pydarn/plotting/color_maps.py", line 6, in PyDARNColormaps
PYDARN_INFERNO = cm.get_cmap('inferno')
^^^^^^^^^^^
AttributeError: 'ColormapRegistry' object has no attribute 'get_cmap'
I was running the following script:
sdarn_read = pydarn.SuperDARNRead(file)
fitacf_data = sdarn_read.read_fitacf()
pydarn.RTP.plot_range_time(fitacf_data, beam_num=fitacf_data[0]['bmnum'], range_estimation=pydarn.RangeEstimation.RANGE_GATE)
plt.title("Radar {:d}, Beam {:d}".format(fitacf_data[0]['stid'], fitacf_data[0]['bmnum']))
plt.show()
Thanks Draven, yeah I think we need to go up to 3.7.0, even thought he change notes for this are at 3.5.0 🤔
After the new change, if I have matplotlib 3.7.0 installed and install pydarn, just pydarn is installed and it works correctly.
I then downgraded matplotlib to 3.5.0 and attempted to the run the code and it broke as expected. I then tried to reinstall pydarn, and pydarn updated my version of matplotlib to 3.8.3 and everything worked again.
So I would say this is working now.
Scope
This PR increases the required version of matplotlib from 3.3.4 to 3.5.0 due to the change of the colormap module in matplotlib. (I did the fix for this when 3.6.0 came out with the depreciation warning for the color_maps module but didn't change the rtp module, or maybe that was developed later I'm not sure. Anyway, I don't think we need to have more complicated imports, we can just up the requirements as the version required is nearly 3 years old anyway)
Note that the cm library is still in use elsewhere for other purposes and only 'colormaps' was depreciated and moved from cm.
issue: #373
Approval
Number of approvals: 1
Test
matplotlib version: 3.5.0, 3.4.2, 3.8.3 Note testers: please indicate what version of matplotlib you are using
Install pydarn as you would normally, you can try to install with a matplotlib version lower than 3.5.0 and it should uninstall and install the higher version for you. Plot an rtp or