Cleaning MMVARI ADIF

Tagged:

My dad use old good MMVARI for digi modes and he has his logbook there too. I like simple straightforward user interface with possibility of user scripting. Only difficulty of that old version of MMVARI is that output ADIF file which does not meet standards of ADIF file.

I made simple python script to correct it. PSK MODE is transformed into PSK31 (no other modes used). When there is not BAND specified, it does mean, it is 4m band. In this case it tries grab frequency from COMMENT field.

For open, parse and save I use own adif module, so final code is very simple.

  1. import adif
  2. import re
  3.  
  4. log = adif.parse('logy\\OK2BX_fm300112.adi')
  5.  
  6. for qso in log:
  7.     ## PSK mode to PSK31
  8.     if qso["mode"] == "PSK":
  9.         qso["mode"] = "PSK31"
  10.  
  11.     ## 4m band
  12.     if not qso.get("band"):        
  13.         qso.setdefault("band", "4m")
  14.         if qso.get("comment"):
  15.             # grab QRG from comment if available
  16.             qrg = re.search("(70.\d+)", qso.get("comment"))  
  17.             if qrg:
  18.                 qso.setdefault("freq", qrg.group(1))
  19.             else:
  20.                 qso.setdefault("freq", "70.200")
  21.                
  22.     ## remove strange "midnight" time off
  23.     if qso.get("time_off") == "000000":
  24.         qso.pop("time_off", None)
  25.        
  26. adif.save('ok2bx_mmvari_corr.adi', log)