The purpose of this class is to return data (country, latitude, longitude, CQ Zone...etc) for an Amateur Radio callsign. The class can be used with any lookup database, provided through an Instance of LookupLib. An instance of Lookuplib has to be injected on object construction.
| Parameters: |
|
|---|
Returns ADIF id of a callsign’s country
| Parameters: |
|
|---|---|
| Returns: | containing the country ADIF id |
| Return type: | int |
| Raises: | KeyError – No Country found for callsign |
Lookup a callsign and return all data available from the underlying database
| Parameters: |
|
|---|---|
| Returns: | Dictionary containing the callsign specific data |
| Return type: | dict |
| Raises: | KeyError – Callsign could not be identified |
Example
The following code returns all available information from the country-files.com database for the callsign “DH1TW”
>>> from pyhamtools import LookupLib, Callinfo
>>> my_lookuplib = LookupLib(lookuptype="countryfile")
>>> cic = Callinfo(my_lookuplib)
>>> cic.get_all("DH1TW")
{
'country': 'Fed. Rep. of Germany',
'adif': 230,
'continent': 'EU',
'latitude': 51.0,
'longitude': -10.0,
'cqz': 14,
'ituz': 28
}
Note
The content of the returned data depends entirely on the injected LookupLib (and the used database). While the country-files.com provides for example the ITU Zone, Clublog doesn’t. Consequently, the item “ituz” would be missing with Clublog (API or XML) LookupLib.
Returns the continent Identifier of a callsign
| Parameters: |
|
|---|---|
| Returns: | continent identified |
| Return type: | str |
| Raises: | KeyError – No Continent found for callsign |
Note
The following continent identifiers are used:
Returns the country name where the callsign is located
| Parameters: |
|
|---|---|
| Returns: | name of the Country |
| Return type: | str |
| Raises: | KeyError – No Country found for callsign |
Note
Don’t rely on the country name when working with several instances of py:class:Callinfo. Clublog and Country-files.org use slightly different names for countries. Example:
Returns CQ Zone of a callsign
| Parameters: |
|
|---|---|
| Returns: | containing the callsign’s CQ Zone |
| Return type: | int |
| Raises: | KeyError – no CQ Zone found for callsign |
Strips off country prefixes (HC2/**DH1TW) and activity suffixes (DH1TW/P**).
| Parameters: | callsign (str) – Amateur Radio callsign |
|---|---|
| Returns: | callsign without country/activity pre/suffixes |
| Return type: | str |
| Raises: | ValueError – No callsign found in string |
Example
The following code retrieves the home call for “HC2/DH1TW/P”
>>> from pyhamtools import LookupLib, Callinfo
>>> my_lookuplib = LookupLib(lookuptype="countryfile")
>>> cic = Callinfo(my_lookuplib)
>>> cic.get_homecall("HC2/DH1TW/P")
DH1TW
Returns ITU Zone of a callsign
| Parameters: |
|
|---|---|
| Returns: | containing the callsign’s CQ Zone |
| Return type: | int |
| Raises: | KeyError – No ITU Zone found for callsign |
Note
Currently, only Country-files.com lookup database contains ITU Zones
Returns Latitude and Longitude for a callsign
| Parameters: |
|
|---|---|
| Returns: | Containing Latitude and Longitude |
| Return type: | dict |
| Raises: | KeyError – No data found for callsign |
Example
The following code returns Latitude & Longitude for “DH1TW”
>>> from pyhamtools import LookupLib, Callinfo
>>> my_lookuplib = LookupLib(lookuptype="countryfile")
>>> cic = Callinfo(my_lookuplib)
>>> cic.get_lat_long("DH1TW")
{
'latitude': 51.0,
'longitude': -10.0
}
Note
Unfortunately, in most cases the returned Latitude and Longitude are not very precise. Clublog and Country-files.com use the country’s capital coordinates in most cases, if no dedicated entry in the database exists.
Checks if a callsign is valid
| Parameters: |
|
|---|---|
| Returns: | True / False |
| Return type: | bool |
Example
The following checks if “DH1TW” is a valid callsign
>>> from pyhamtools import LookupLib, Callinfo
>>> my_lookuplib = LookupLib(lookuptype="countryfile")
>>> cic = Callinfo(my_lookuplib)
>>> cic.is_valid_callsign("DH1TW")
True