SuperDARN / pydarn

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

EHN: Add embargo watermark and message to FITACF plotting methods #355

Closed carleyjmartin closed 3 months ago

carleyjmartin commented 11 months ago

Scope

This PR adds a watermark to data that is less than a year old and has a negative CPID (run in discretionary time) to methods that plot FITACF data (RTP and Fan). The code also checks to see if there is already an embargoed watermark or not so we don't keep plotting it over the top of the original one on summary plots or on multi-fan plots. It is noted that for the first year or so while we move from all discretionary time having -cpid to only embargoed data having -cpid this might pop up quite a lot. The wording of the watermark or message may be changed to align with RST when it's decided, this PR is to check that the logic is working. I was unable to include the file name to the warning message as the plotting methods do not have access to the file reading methods.

issue: will close #330

Approval

Number of approvals: 2 (but make sure either Carley or Bharat merges to make sure the wording is finalized!)

Test

matplotlib version: 3.7.2 Note testers: please indicate what version of matplotlib you are 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()

You will need data from the last year with -ve CPID to test the watermark and message. Below is a PGR discretionary time data from last month to test if need be. Please test with your own data that is older or +ve CPID and you should find it plots as normal with no watermark or message. The above code will produce: Screenshot 2023-09-14 at 10 32 03 AM Screenshot 2023-09-14 at 10 32 13 AM Screenshot 2023-09-14 at 10 32 26 AM Screenshot 2023-09-14 at 10 32 40 AM

With the message in command line reading: 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

20230808.1406.00.pgr.a.fitacf.bz2.zip