SuperDARN / rst

Radar Software Toolkit (RST)
https://superdarn.github.io/rst/
GNU General Public License v3.0
21 stars 16 forks source link

FitDecode unable to read real-time elevation angles #586

Closed egthomas closed 9 months ago

egthomas commented 10 months ago

There is an issue where FitDecode in fitread.c of the fit library does not support reading real-time elevation angles from older radars (eg, KAP, GBR, etc) which do not send the entire fit structure.

Specifically, I think this line needs to be modified:

if ((strcmp(a->name,"phi0")==0) && (a->type==DATAFLOAT) &&
        (a->dim==1)) xcf=1;

to check against something other than phi0 (which not all radars send over real-time links). I'm not sure which field would be best, but something like this seems to work:

    if ( ((strcmp(a->name,"phi0")==0) || (strcmp(a->name,"elv")==0)) && (a->type==DATAFLOAT) &&
        (a->dim==1)) xcf=1;

For reference, these appear to be the fitted arrays sent over a real-time stream by the older QNX4-style radars (which still comprise about half of the network):

arrays:
        short   "ptab" [8]
        short   "ltab" [2][23]
        float   "pwr0" [75]
        short   "slist" [17]
        char    "gflg" [17]
        float   "p_l" [17]
        float   "w_l" [17]
        float   "v" [17]
        float   "v_e" [17]
        float   "elv" [17]
        float   "elv_low" [17]
        float   "elv_high" [17]

whereas modern radars tend to send the entire prm and fit structures.

egthomas commented 10 months ago

Major apologies to @ecbland! I was mistaken that the originally linked commit and pull request introduced this bug - it appears that this issue was present even before the change from checking x_v to phi0. Sorry!

I can confirm that the above proposed change to FitDecode allows the correct plotting of elevation angles from HOK, GBR, and KAP with fitacfclientgui. Further testing is probably needed to see if that breaks anything else.