pleasantone / adif_merge

Ham Radio ADIF Logbook format merge/resolution program written in Python
GNU Affero General Public License v3.0
6 stars 1 forks source link

ValueError: could not convert string to float: 'NA-052' #1

Closed cwawak closed 7 months ago

cwawak commented 3 years ago

adif_merge 1.1.2 Python 3.8.5

Problem When trying to merge two ADIF files together, I got the following error:

$ .local/bin/adif_merge -o mergelog.adif -c log.log -p problem.json Log4OM_ADIF_20201231232432.adi qdure-123120-log_KC2IEB.adi
Traceback (most recent call last):
  File ".local/bin/adif_merge", line 8, in <module>
    sys.exit(main())
  File "/home/cwawak/.local/lib/python3.8/site-packages/adif_merge/__init__.py", line 543, in main
    qsos.append(fixup_qso(qso, filename))
  File "/home/cwawak/.local/lib/python3.8/site-packages/adif_merge/__init__.py", line 177, in fixup_qso
    qso[field] = int(float(qso[field]))
ValueError: could not convert string to float: 'NA-052'

It looks like it's choking on parsing an IOTA reference:

<ANT_AZ:1>0 <ANT_EL:1>0 <STATE:2>FL <BAND:3>30m <BAND_RX:3>30m <CALL:4>N1UL <CONT:2>NA
<COUNTRY:13>United States <CNTY:11>FL, Collier <CQZ:1>5 <DISTANCE:4>1672 <DXCC:3>291 
<EMAIL:14>xxx<EQSL_QSL_RCVD:1>R <EQSL_QSL_SENT:1>R <FREQ:9>10.137200 <FREQ_RX:9>10.137200 
<GRIDSQUARE:4>EL95 <ITUZ:1>6 <LOTW_QSLSDATE:8>20201112 <LOTW_QSL_RCVD:1>N <LOTW_QSL_SENT:1>Y 
<MODE:3>FT8 <MY_CITY:15>xxxx <MY_CNTY:10>xxxx <MY_COUNTRY:13>United States 
<MY_CQ_ZONE:1>5 <MY_DXCC:3>291 <MY_GRIDSQUARE:4>FM29 <MY_ITU_ZONE:1>8 <MY_NAME:19>xxxx 
<MY_STATE:2>xxxx <NAME:19>xxxx <STATION_CALLSIGN:6>xxxx <PROGRAMID:7>LOG4OM2 
<PROGRAMVERSION:8>2.10.0.0 <QSL_RCVD:1>N <QSL_RCVD_VIA:1>E <QSL_SENT:1>N <QSL_SENT_VIA:1>E 
<QSL_VIA:46>ARRL, BETTER DIRECT, RETURN CARD ALSO DIRECT ! <QSO_COMPLETE:1>Y <QSO_DATE:8>20201111 
<QSO_DATE_OFF:8>20201111 <QTH:12>xxxx <RST_RCVD:3>-01 <RST_SENT:3>+15 <SWL:1>N 
<TIME_OFF:6>120800 <TIME_ON:6>120800 <TX_PWR:3>100 <QSO_RANDOM:1>Y <SFI:1>0 
<QRZCOM_QSO_UPLOAD_DATE:8>20201112 <QRZCOM_QSO_UPLOAD_STATUS:1>Y <IOTA:6>NA-052 
<IOTA_ISLAND_ID:6>NA-052 <APP_L4ONG_SATELLITE_QSO:1>N <APP_L4ONG_CONTEST:1>N 
<APP_L4ONG_QSO_CONFIRMATIONS:578>[{"CT":"LOTW","S":"Yes","R":"No","SV":"Electronic","RV":"Electronic","SD":"2020-11-12T00:00:00Z"},{"CT":"QSL","S":"No","R":"No","SV":"Electronic","RV":"Electronic"},
{"CT":"QRZCOM","S":"Yes","R":"No","SV":"Electronic","RV":"Electronic","SD":"2020-11-12T00:00:00Z"},
{"CT":"EQSL","S":"Requested","R":"Requested","SV":"Electronic","RV":"Electronic"},
{"CT":"HAMQTH","S":"Requested","R":"No","SV":"Electronic","RV":"Electronic"},
{"CT":"HRDLOG","S":"Requested","R":"No","SV":"Electronic","RV":"Electronic"},
{"CT":"CLUBLOG","S":"Requested","R":"No","SV":"Electronic","RV":"Electronic"}] <APP_L4ONG_QSO_AWARD_REFERENCES:280>[{"AC":"IOTA","R":"NA-052","G":"NA-052","SUB":[],"GRA":[]},
{"AC":"DXCC","R":"291","G":"NA","SUB":[],"GRA":[]},{"AC":"USA-CA","R":"FL-COLLIER","SUB":[],"GRA":[]},
{"AC":"WAC","R":"NA","SUB":[],"GRA":[]},{"AC":"WAS","R":"FL","SUB":[],"GRA":[]},{"AC":"WAZ","R":"5","SUB":[],"GRA":[]}] 
<EOR>

Expected Behavior I'd expect to be able to merge these files without errors.

pleasantone commented 3 years ago

I agree. The problem is that IOTA_ISLAND_ID is supposed to be an 8 digit number per the ADIF spec, not continent-xxxx which is the definition for IOTA.

Is it possible your logging program corrupted it?

In any case it’s a trivial “fix” to ignore and allow the corruption. While I’m in there I should make these errors a bit more user friendly. On Jan 1, 2021, 9:44 AM -0800, Christopher Wawak notifications@github.com, wrote:

adif_merge 1.1.2 Python 3.8.5 Problem When trying to merge two ADIF files together, I got the following error: $ .local/bin/adif_merge -o mergelog.adif -c log.log -p problem.json Log4OM_ADIF_20201231232432.adi qdure-123120-log_KC2IEB.adi Traceback (most recent call last): File ".local/bin/adif_merge", line 8, in sys.exit(main()) File "/home/cwawak/.local/lib/python3.8/site-packages/adif_merge/init.py", line 543, in main qsos.append(fixup_qso(qso, filename)) File "/home/cwawak/.local/lib/python3.8/site-packages/adif_merge/init.py", line 177, in fixup_qso qso[field] = int(float(qso[field])) ValueError: could not convert string to float: 'NA-052' It looks like it's choking on parsing an IOTA reference:

0 0 FL 30m 30m N1UL NA United States FL, Collier 5 1672 291 xxxR R 10.137200 10.137200 EL95 6 20201112 N Y FT8 xxxx xxxx United States 5 291 FM29 8 xxxx xxxx xxxx xxxx LOG4OM2 2.10.0.0 N E N E ARRL, BETTER DIRECT, RETURN CARD ALSO DIRECT ! Y 20201111 20201111 xxxx -01 +15 N 120800 120800 100 Y 0 20201112 Y NA-052 NA-052 N N [{"CT":"LOTW","S":"Yes","R":"No","SV":"Electronic","RV":"Electronic","SD":"2020-11-12T00:00:00Z"},{"CT":"QSL","S":"No","R":"No","SV":"Electronic","RV":"Electronic"}, {"CT":"QRZCOM","S":"Yes","R":"No","SV":"Electronic","RV":"Electronic","SD":"2020-11-12T00:00:00Z"}, {"CT":"EQSL","S":"Requested","R":"Requested","SV":"Electronic","RV":"Electronic"}, {"CT":"HAMQTH","S":"Requested","R":"No","SV":"Electronic","RV":"Electronic"}, {"CT":"HRDLOG","S":"Requested","R":"No","SV":"Electronic","RV":"Electronic"}, {"CT":"CLUBLOG","S":"Requested","R":"No","SV":"Electronic","RV":"Electronic"}] [{"AC":"IOTA","R":"NA-052","G":"NA-052","SUB":[],"GRA":[]}, {"AC":"DXCC","R":"291","G":"NA","SUB":[],"GRA":[]},{"AC":"USA-CA","R":"FL-COLLIER","SUB":[],"GRA":[]}, {"AC":"WAC","R":"NA","SUB":[],"GRA":[]},{"AC":"WAS","R":"FL","SUB":[],"GRA":[]},{"AC":"WAZ","R":"5","SUB":[],"GRA":[]}] Expected Behavior I'd expect to be able to merge these files without errors. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
cwawak commented 7 months ago

@pleasantone Sorry for the multi year delay!

There's two options for ADIF export in Log4OM - "Standard ADIF" and whatever Log4OM speaks. When I export "standard ADIF", the IOTA_ISLAND_ID field is not included and the merge works perfectly.

I should file a bug with Log4OM to see if they're interested in outputting the correct field per adif spec on their non-standard ADIF export. Thank you so much for the help!

73 Chris