Fixed kml.py provinence; updated readme; make ctydat a pkgresource

pull/3/head
Jeff Laughlin 2014-01-07 01:55:00 -05:00
rodzic fdd840fae3
commit d55a3f3085
9 zmienionych plików z 2712 dodań i 24 usunięć

165
LGPL3.txt 100644
Wyświetl plik

@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

Wyświetl plik

@ -1,5 +1,8 @@
# N1YWB Python Ham Radio Tools #
Copyright 2014 by Jeffrey M. Laughlin
Copyright 2006 by Herrmann Hofer
This package includes several Python modules and scripts of interest to the
radio amateur.
@ -38,6 +41,11 @@ location explicity with the `-c` command line option. See the included
`geologrc_example` file. You may also use the config file to override the
default QRZ cache file location.
hamtools comes with a recent copy of the big cty.dat. If you wish to install a newer version, download from http://www.country-files.com/contest/ and in .geologrc specify
[geolog]
ctydatpath=path/to/cty.dat
## hamtools.adif ##
The adif module implements a subset of the ADIF standard for reading and
@ -65,3 +73,8 @@ Simple KML generation based on minidom.
A very trivial voice keyer script which plays an audio file while
simultaniously keying a radio via the serial port. Requires pyserial.
# License #
kml.py is released under the LGPL v3
All other files are released under the AGPL v3

Wyświetl plik

@ -1,3 +1,6 @@
[geolog]
ctydatpath=path/to/cty.dat
[qrz]
username=myusername
password=mypassword

Plik diff jest za duży Load Diff

Wyświetl plik

@ -0,0 +1,57 @@
Big CTY - 29 December 2013
Version entity is Sweden, SM
Added/changed Callsigns/prefixes:
* A91ACC/GR is Bahrain, A9
* CE9/UA4WHX is Chile, CE in ITU zone 16
* IA/IZ3SUS is Antarctica, CE9 in CQ zone 29, ITU zone 70
* EA7URA/YOTA is Spain, EA
* EA5RKB/6 is Balearic Islands, EA6
* TO6D is Guadeloupe, FG
* TX6G is Austral Islands, FO/a
* 2Z, G0FBJ, GB0BL, GB2CAS, GB2ELH, GB2ELH/LH, GB2IGS, GB2LHI, GB2QM,
GB2SB, GB2SLH, GB2SR, GB2WG, GB2ZET, GB3LER, GB3LER/B, GB4LER, GB4SI, GM0DHZ/P,
GM0GFL/P, GM0SGB/P, GM3TXF/P, GM3USR/P, GM3VLB/P, GM4AFF/P, GM4CHX/P, GS4WAB/P,
GZ, MM/F5BLC/P, MM/OK1FZM/P, MM/W5ZE/P, MM0LON/M, MM5PSL/P, MM5YLO/P, MO5PSL,
MQ5PSL, MR5PSL and MZ are all Scotland, GM
* II1RT/N, IZ0DBA/N and IZ1POA/N are all Italy, I
* AB2QH is Mariana Islands, KH0
* KC6HOX, KC7ASJ, KD0MSD, KD0QLR, KD0WVZ, KE6AXN, KF7TUU, KG6TFI, KJ6QQT,
KJ6SKC, KL1TP, N0CAN, N7TSV, N7WBX and W7NX are all Hawaii, KH6
* AF5S, KB7VFZ, KB7ZVZ, KB8SBG, KE6SYD, KF7LUA, KH2YN, KJ4ZWI, N8ZPO,
NA7WM, W6TN and WH6CYY are all Alaska, KL
* WI7C is US Virgin Islands, KP2
* AF4OU, KB3BPK, KE0SH, KE1MA and KX5DX are all Puerto Rico, KP4
* LU5XP/D and LU6FEC/T are both Argentina, LU
* OH1FJ/SA, OH1KW/S, OH1LEO/S, OH1SJ/SA, OH2BNX/SA, OH2EO/S, OH2ET/S,
OH2MEE/SA, OH2MO/SA, OH2NAS/SA, OH2PO/SA, OH2S/S, OH2XL/S, OH2ZL/SA, OH3FJQ/S,
OH3HB/SA, OH3IH/SA, OH3LS/S, OH4FSL/SA, OH5A/S, OH5EAB/S, OH5EAB/SA, OH6QR/SA,
OH7ND/S, OH9AR/S, OH9TM/S, OH9TO/S, OI4JM/SA and OI6SP/SA are all Finland, OH
* R95DOD, R95NRL, RA22, RW2F/6, UA0QGM/3, UA9KHD/3 and UE22A are all European Russia, UA
* RA22KO, RA22XA, RA22XF, RN22OG and RN22OV are all European Russia, UA in CQ zone 17, ITU zone 19
* RV22PM is European Russia, UA in CQ zone 17, ITU zone 30
* RD22FU and RJ22DX are both Kaliningrad, UA2
* R22BIA, R22SKE, R22SKJ, RA22MX, RA22QF, RT22MC, RT22MD, RU22AZ, RU22CR,
RU22LR, RW22MW, RW22QA, RW22QC, RY22MC and RY22RZ are all Asiatic Russia, UA9
* RT22TK, RT22WF, RU22WZ, RV22WB and RX22WN are all Asiatic Russia, UA9 in CQ zone 16
* R9/UN7JMO, RT22UA and RZ22WW are all Asiatic Russia, UA9 in CQ zone 18, ITU zone 31
* RN110RAEM/P and RT22SA are both Asiatic Russia, UA9 in CQ zone 18, ITU zone 32
* RW22WR and UA9KW/0 are both Asiatic Russia, UA9 in CQ zone 19, ITU zone 23
* RT22CT is Asiatic Russia, UA9 in CQ zone 19, ITU zone 33
* RW22GO is Asiatic Russia, UA9 in CQ zone 19, ITU zone 34
* RT22ZS is Asiatic Russia, UA9 in CQ zone 19, ITU zone 35
* UU4JO/LH is Ukraine, UR
* RI20ANT and RI44ANT are both South Shetland Islands, VP8/h
Retired Callsigns/prefixes:
* RI1ANT in Antarctica, CE9
* 2T in Isle of Man, GD
* 2N in Northern Ireland, GI
* 2H in Jersey, GJ
* 2P in Guernsey, GU
* 2Y in Wales, GW
* KC7RXR and KP4X in Alaska, KL
* KD0ETC/LH in Canada, VE

Wyświetl plik

@ -0,0 +1,98 @@
Big CTY.DAT
------------------------------------------------------------------------
The last release was on 2 August 2013.
This version of CTY.DAT has callsign data starting with 1 January 2000.
This is useful for people who are using contest logging software to log
their everyday QSOs, and want somewhat accurate country tracking. Here
are the features of this file:
1. Exception callsigns go back to the starting date shown above. If a
callsign was used multiple times, then only the most recent entity
is used. For example, TO5M was used from Martinique (FM) in 1993,
St. Pierre & Miquelon (FP) in 1995, and Reunion (FR) in 2004. Thus,
if you log TO5M using this file, you will get Reunion (FR)
2. Prefixes do not go back, they are current as of the day the file was
released. For example, Montenegro (4O) was added to the DXCC list
effective 28 June 2006. If you try to log a QSO with 4O1T in
Yugoslavia from 2003, it will come up as Montenegro, because that's
the current entity associated with the 4O prefix. Here is a list of
known problems <exceptions.htm>.
3. This is a complete file, meaning all prefixes that require CQ and/or
ITU zone overrides are listed. This is primarily for BY, K, UA9, VE
and VK - these entities all span multiple CQ zones. Remember that
the normal CTY.DAT has only a subset of these prefixes; many have
been implemented in software and therefore don't need to be listed.
4. Some software like CT by K1EA doesn't save the country information
in the log with the QSOs. Instead, the country for each QSO is
determined when the program is started, based on whatever country
file is in use. Thus, it may not be possible to "fix" a QSO that is
associated with the wrong country. You could use the override
method, like "FO8XYZ=FO0" to assign it to Clipperton Island.
However, if/when you over-write your country file with a new one,
those customizations will be lost. One known case of this problem is
a certain well-known IARU HQ station that uses the same callsign
from different DXCC countries, on different bands, at the same time.
It's very hard to get these cases right.
5. This file comes in only one format: using '=' to distinguish full
callsigns from prefixes.
------------------------------------------------------------------------
Installation instructions
The instructions for installing the CTY.DAT file are specific to each
logging program. However, the instructions for installing this file are
the same as the normal contest country files, so start HERE
<../cty/index.htm>. Follow the written instructions on that page, but
don't download the file from those links.
Here are some logging experiments to try to see if the larger file is
installed in the right place, and is working:
1. *VERSION* - should match the VERSION entity in the revision history
2. *OR4TN* - should be Antarctica (not Belgium)
3. *MR6TMS* - should be Scotland (not England)
4. *LW7DQQ/Y* - should be Argentina in ITU Zone 16
5. *UI9XA* - should be European Russia (not Asiatic)
6. *ZS85SARL* - should be South Africa (not Marion Island)
------------------------------------------------------------------------
Compatibility
Because of its size, this file may cause problems with your logging
software. Here are some programs that are known to work:
CT <http://www.k1ea.com/>
CT 9.92 (DOS) and CT 10.04 (Windows) both work. Once can therefore
assume that CT 9.92 (Windows) and CT 10.x (DOS) also work. It's
unknown how old a CT9 version can be and still work.
fldigi <http://www.w1hkj.com/Fldigi.html>
version 3.2.38 (Linux)
LM <http://contestsoftware.com/e/home.htm>
DL8WAA reports no problems.
MixW <http://www.mixw.net/>
version 3.1.1h and later
Xlog <http://xlog.nongnu.org/>
version 2.0.5 (Linux)
------------------------------------------------------------------------
Areas for Improvement
Here are some changes that may be coming - stay tuned for details!
1. The file contains all possible prefix mappings to determine the
correct CQ and ITU zones. If people are only tracking countries,
this may not be necessary, and would substantially reduce the number
of prefixes in the file.

Wyświetl plik

@ -23,6 +23,8 @@ import os
import sys
import traceback
from pkg_resources import resource_stream
import geojson as gj
import adif
@ -165,7 +167,7 @@ class Log(object):
folder.appendChild(callnode)
dom.writepretty(file)
def geolog(logfilepath, outfile, username, password, cachepath):
def geolog(logfilepath, outfile, username, password, cachepath, ctydatflo):
with open(logfilepath) as logfile:
line = logfile.next()
@ -177,10 +179,9 @@ def geolog(logfilepath, outfile, username, password, cachepath):
log.info("Opened ADIF format log %r" % logfile)
qsolog = Log.from_adif(logfile)
with open('/home/jeff/Downloads/ctydat/cty.dat') as ctydat:
ctydat = CtyDat(ctydat)
with qrz.Session(username, password, cachepath) as sess:
qsolog.georeference(sess, ctydat)
ctydat = CtyDat(ctydatflo)
with qrz.Session(username, password, cachepath) as sess:
qsolog.georeference(sess, ctydat)
points, lines = qsolog.geojson_dumps(sort_keys=True)
@ -238,12 +239,24 @@ created: "foo/bar_points.geojson", "foo/bar_lines.geojson", and "foo/bar.kml"
except ConfigParser.Error:
cachepath = CACHEPATH
try:
cachepath = cfg.get('qrz', 'cachepath')
except ConfigParser.Error:
cachepath = CACHEPATH
try:
ctydatpath = cfg.get('geolog', 'cachepath')
ctydatflo = open(ctydatpath)
except ConfigParser.Error:
ctydatflo = resource_stream(__name__, "ctydat/cty.dat")
log.info("QRZ cache: %s" % cachepath)
geolog(args.infile, args.outpath, un, pw, cachepath)
geolog(args.infile, args.outpath, un, pw, cachepath, ctydatflo)
return 0
if __name__ == "__main__":
sys.exit(main())

Wyświetl plik

@ -1,20 +1,23 @@
#!/usr/bin/env python
#
# Copyright 2009, 2012 by Jeffrey M. Laughlin
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"""
http://sourceforge.net/projects/pykml/
Copyright 2006 by Herrmann Hofer
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from xml.dom.minidom import getDOMImplementation

Wyświetl plik

@ -5,11 +5,12 @@ from distutils.core import setup
setup(
name='hamtools',
version='0.1',
description='N1YWB Python Ham Tools',
description='N1YWB Python Ham Radio Tools',
author='Jeff Laughlin',
author_email='n1ywb@arrl.net',
url='https://github.com/n1ywb/python-hamtools',
py_modules = ['hamtools'],
packages = ['hamtools'],
package_data={'hamtools': ['ctydat/cty.dat']},
scripts = ['geolog', 'vk'],
install_requires = ['geojson'],
long_description = (