SuperDARN / pydarn

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

Fix: Embargo open bracket typo #390

Closed billetd closed 1 month ago

billetd commented 1 month ago

Scope

Somehow, there was a missing right bracket in fan.py causing pydarn to fail on import. This fixes.

Approval

Number of approvals: 1

carleyjmartin commented 1 month ago

A more robust fix and changes are in Rem's most recent PR for this issue. For now I'm just commenting out that line until Rem makes some changes.

You should still get an error using cls after fixing this bracket anyway.

carleyjmartin commented 1 month ago

Can test using:

import matplotlib.pyplot as plt 
import pydarn
import datetime as dt

file ="/Users/carley/Documents/data/20230808.1406.00.pgr.a.fitacf"
SDarn_read = pydarn.SuperDARNRead(file)
fitacf_data = SDarn_read.read_fitacf()

a = pydarn.RTP.plot_time_series(fitacf_data, beam_num=5)
plt.show()
a = pydarn.RTP.plot_range_time(fitacf_data, beam_num=5)
plt.show()
a = pydarn.RTP.plot_summary(fitacf_data, beam_num=5, watermark=False)
plt.show()
a = pydarn.Fan.plot_fan(fitacf_data, coastline=True)
plt.show()

where the data file can be found in the previous PR #355

you should get a nice big 'embargoed' across each plot and a message in the console. Can try testing on not embargoed data too.

This data is a year old in three weeks so this needs testing before then.

Doreban commented 1 month ago

I did a quick test with the suggested data before it becomes over a year old.

Test was run with versions: Python 3.9.2 Numpy 1.26.4 Matplotlib 3.9.1

Using 20230808.1406.00.pgr.a.fitacf, embargo watermark appears as expected: time_series range_time summary_plot fan_plot

And the terminal output from running the test script outlined above was:

C:\Users\Dragon\PycharmProjects\pydarn_dev\.venv\Scripts\python.exe C:\Users\Dragon\PycharmProjects\pydarn_dev\test_pr390_missing_bracket.py 
C:\Users\Dragon\PycharmProjects\pydarn_dev\.venv\lib\site-packages\pydarn\utils\plotting.py: 202: UserWarning: The data you are using is under embargo. Please contact the principal investigator of the Prince George radar for authorization to use the data
C:\Users\Dragon\PycharmProjects\pydarn_dev\.venv\lib\site-packages\pydarn\utils\plotting.py: 202: UserWarning: The data you are using is under embargo. Please contact the principal investigator of the Prince George radar for authorization to use the data
C:\Users\Dragon\PycharmProjects\pydarn_dev\.venv\lib\site-packages\pydarn\plotting\rtp.py: 781: MatplotlibDeprecationWarning: The plot_date function was deprecated in Matplotlib 3.9 and will be removed in 3.11. Use plot instead.
C:\Users\Dragon\PycharmProjects\pydarn_dev\.venv\lib\site-packages\pydarn\utils\plotting.py: 202: UserWarning: The data you are using is under embargo. Please contact the principal investigator of the Prince George radar for authorization to use the data
C:\Users\Dragon\PycharmProjects\pydarn_dev\.venv\lib\site-packages\pydarn\plotting\rtp.py: 781: MatplotlibDeprecationWarning: The plot_date function was deprecated in Matplotlib 3.9 and will be removed in 3.11. Use plot instead.
C:\Users\Dragon\PycharmProjects\pydarn_dev\.venv\lib\site-packages\pydarn\utils\plotting.py: 202: UserWarning: The data you are using is under embargo. Please contact the principal investigator of the Prince George radar for authorization to use the data
C:\Users\Dragon\PycharmProjects\pydarn_dev\.venv\lib\site-packages\pydarn\plotting\rtp.py: 781: MatplotlibDeprecationWarning: The plot_date function was deprecated in Matplotlib 3.9 and will be removed in 3.11. Use plot instead.
C:\Users\Dragon\PycharmProjects\pydarn_dev\.venv\lib\site-packages\pydarn\utils\plotting.py: 202: UserWarning: The data you are using is under embargo. Please contact the principal investigator of the Prince George radar for authorization to use the data
C:\Users\Dragon\PycharmProjects\pydarn_dev\.venv\lib\site-packages\pydarn\utils\plotting.py: 202: UserWarning: The data you are using is under embargo. Please contact the principal investigator of the Prince George radar for authorization to use the data
C:\Users\Dragon\PycharmProjects\pydarn_dev\.venv\lib\site-packages\pydarn\utils\plotting.py: 202: UserWarning: The data you are using is under embargo. Please contact the principal investigator of the Prince George radar for authorization to use the data
C:\Users\Dragon\PycharmProjects\pydarn_dev\.venv\lib\site-packages\pydarn\utils\plotting.py: 202: UserWarning: The data you are using is under embargo. Please contact the principal investigator of the Prince George radar for authorization to use the data
C:\Users\Dragon\PycharmProjects\pydarn_dev\.venv\lib\site-packages\pydarn\utils\plotting.py: 202: UserWarning: The data you are using is under embargo. Please contact the principal investigator of the Prince George radar for authorization to use the data
C:\Users\Dragon\PycharmProjects\pydarn_dev\.venv\lib\site-packages\pydarn\utils\plotting.py: 202: UserWarning: The data you are using is under embargo. Please contact the principal investigator of the Prince George radar for authorization to use the data
C:\Users\Dragon\PycharmProjects\pydarn_dev\.venv\lib\site-packages\pydarn\utils\plotting.py: 202: UserWarning: The data you are using is under embargo. Please contact the principal investigator of the 6 radar for authorization to use the data

Lastly I tested with older an older data file 20220612.0600.00.cly.a.fitacf. Embargo did not appear on any of the plots and the terminal did not display any warning that the data being used was under embargo.

Looks like it is performing as expected.