spedas / pyspedas

Python-based Space Physics Environment Data Analysis Software
https://pyspedas.readthedocs.io/
MIT License
149 stars 58 forks source link

ErfaWarning deprecation (astropy) #882

Closed jameswilburlewis closed 3 months ago

jameswilburlewis commented 3 months ago

We're seeing some deprecation warnings from astropy in our test logs:

12-Jun-24 00:27:33: Download complete: omni_data/hro2_1min/2015/omni_hro2_1min_20151001_v01.cdf
12-Jun-24 00:27:33: /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/site-packages/astropy/utils/exceptions.py:82: AstropyDeprecationWarning: Importing ErfaWarning from astropy.utils.exceptions was deprecated in version 6.1 and will stop working in a future version. Instead, please use
from erfa import ErfaWarning

  warnings.warn(

This is a fairly recent development (December 2023), so it's too soon to require astropy >= 6.1. But it would be good to do a version check on astropy, and make sure ErfaWarning gets imported from the right place. I think it's only used in a couple of places.

jameswilburlewis commented 3 months ago

Apparently we don't even need to catch these warnings anymore -- I guess whatever underlying issue was resolved in cdflib or cdf_to_tplot, because no warnings are generated after removing the with warnings.catch_warnings(): blocks.