SuperDARN / pyDARNio

Python Library for read in SuperDARN data
GNU Lesser General Public License v3.0
8 stars 2 forks source link

Updated experiment_id type for Borealis v0.6 files. #44

Closed RemingtonRohel closed 2 years ago

RemingtonRohel commented 2 years ago

Scope

Minor change to experiment_id field of Borealis v0.6 files

Approval

Number of approvals: 1

Test

>>> import pydarnio
>>> filetypes = ['antennas_iq', 'bfiq', 'rawacf']
>>> basename = '20220915.1938.03.sas.0.{}.hdf5.site'
>>> for ftype in filetypes:
...     filename = basename.format(ftype)
...     try:
...             borealis_reader = pydarnio.BorealisRead(filename, ftype, 'site')
...     except:
...             print('Failure to read {}'.format(filename))

Verify that nothing gets printed when this code is run! Example files here: test_files.zip

kevinkrieger commented 2 years ago

Good, raises BorealisDataFormatTypeError I imagine if the CPID is more than 16 bits?

RemingtonRohel commented 2 years ago

@carleyjmartin - Yes, that's correct! I only changed the format for the versions 0.6+.

@kevinkrieger - It doesn't throw that error specifically, but it does raise something.

Testing:

>>> import pydarnio
>>> filetypes = ['antennas_iq', 'bfiq', 'rawacf']
>>> basename = '/data/sample_data/version0.5/20211006.2132.00.sas.0.{}.hdf5.site'
>>> for ftype in filetypes:
...     filename = basename.format(ftype)
...     try:
...             borealis_reader = pydarnio.BorealisRead(filename, ftype, 'site')
...             print('Success!')
...     except:
...             print('Failure')
... 
Success!
Success!
Success!

>>> basename = '/data/sample_data/version0.5/20211006.2132.00.sas.0.{}.hdf5'
>>> for ftype in filetypes:
...     filename = basename.format(ftype)
...     try:
...             borealis_reader = pydarnio.BorealisRead(filename, ftype, 'array')
...             print('Success!')
...     except:
...             print('Failure')
... 
Success!
Success!
Success!

>>> basename = '/data/sample_data/version0.6/20210815.2116.00.sas.0.{}.hdf5.site'
>>> filetypes = ['bfiq', 'rawacf']
>>> for ftype in filetypes:
...     filename = basename.format(ftype)
...     try:
...             borealis_reader = pydarnio.BorealisRead(filename, ftype, 'site')
...             print('Success!')
...     except:
...             print('Failure')
... 
In record 1629062160048 of file /data/sample_data/version0.6/20210815.2116.00.sas.0.bfiq.hdf5.site, the following parameters are not of their given correct type: {'experiment_id': "<class 'numpy.int16'>"}
Failure
In record 1629062160048 of file /data/sample_data/version0.6/20210815.2116.00.sas.0.rawacf.hdf5.site, the following parameters are not of their given correct type: {'experiment_id': "<class 'numpy.int16'>"}
Failure