vtsuperdarn / davitpy

DEPRECATED The DaViT Python project
http://vtsuperdarn.github.com/davitpy/
GNU General Public License v3.0
37 stars 59 forks source link

FoV range gate bug #360

Closed aburrell closed 4 years ago

aburrell commented 6 years ago

This pull request fixes a bug that @Shirling-VT and I encountered when determining the FoV for Canadian radars.

For testing, I recommend @Shirling-VT try this out with her code and let me know if it fixes her problem.

Shirling-VT commented 6 years ago

It fixes my problem.

aburrell commented 6 years ago

Here's a test for someone not used to using this code.

import davitpy
import datetime as dt
stime = dt.datetime(2014, 1, 1)
etime = dt.datetime(2014, 1, 1, 1)
rad = 'rkn'
tband = davitpy.pydarn.radar.tdiff.rad_freqbands.radFreqBands(rad)
file_type='fitacf'
rad_ptr = davitpy.pydarn.sdio.radDataRead.radDataOpen(stime, eTime=etime, radcode=rad, fileType=file_type)

beam_dict = dict()
while bm is not None:
    tb = tband.get_tfreq_band_num(bm.prm.tfreq)
    if not tb in beam_dict.keys():
        beam_dict[tb] = dict()
    if not bm.cp in beam_dict[tb].keys():
        beam_dict[tb][bm.cp] = list()
    beam_dict[tb][bm.cp].append(bm)
    bm = rad_ptr.readRec()

tb = 8
radcp = 3503
beam_fov = davitpy.pydarn.proc.fov.update_backscatter.update_backscatter(beam_dict[tb][radcp])

When run with the develop branch you will get

IndexError: list index out of range

When run with the fix, the first beam 0 will have these values:

print beam_fov[0][0].fit.fovflg
[0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, -1, 1, -1, 1]
print beam_fov[0][0].fit.slist
[14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 74, 75, 77, 78]
print beam_fov[0][0].fit.gflg
[0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
aburrell commented 6 years ago

@asreimer or @ksterne , if one of you could look at this I'd appreciate it.

mts299 commented 6 years ago

I may have fixed this or fixed something similar in my bugfix for fanplots. I will check when I get some good internet.

Still in France! Avoir

On Thu, Jun 14, 2018, 7:20 PM Angeline Burrell notifications@github.com wrote:

@asreimer https://github.com/asreimer or @ksterne https://github.com/ksterne , if one of you could look at this I'd appreciate it.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vtsuperdarn/davitpy/pull/360#issuecomment-397372971, or mute the thread https://github.com/notifications/unsubscribe-auth/AGN-0oTR7537OCAyvwKLMEWNUQnB-br3ks5t8ptugaJpZM4UEh-E .

asreimer commented 6 years ago

@aburrell I have some time this weekend. My short contributions this morning were because I woke up at 5am.

ksterne commented 4 years ago

It looks like this is good to go, but didn't get some final final testing on it. In the spirit of being cautious, I'll keep this out for now and close the pull request due to deprecation.