dxcc

package
v0.2.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 11 Imported by: 9

Documentation

Overview

Package dxcc provides information about DXCC prefixes which are stored in a cty.dat file. The package also provides functions to download, store and update a cty.dat file. The default remote location for the cty.dat file is http://www.country-files.com/cty/cty.dat.

File Format Description

First line information, fields are separated by ":" Column Length Description 1 26 Country Name 27 5 CQ Zone 32 5 ITU Zone 37 5 2-letter continent abbreviation 42 9 Latitude in degrees, + for North 51 10 Longitude in degrees, + for West 61 9 Local time offset from GMT 70 6 Primary DXCC Prefix (A "*" preceding this prefix

indicates that the country is on the DARC WAEDC list,
and counts in CQ-sponsored contests, but not ARRL-
sponsored contests).

Following lines contain alias DXCC prefixes (including the primary one), separated by commas (,). Multiple lines are OK; a line to be continued should end with comma (,) though it's not required. A semi-colon (;) terminates the last alias prefix in the list.

If an alias prefix is preceded by "=", this indicates that the prefix is to be treated as a full callsign, i.e. must be an exact match.

The following special characters can be applied after an alias prefix: (#) Override CQ Zone [#] Override ITU Zone <#/#> Override latitude/longitude {aa} Override Continent ~#~ Override local time offset from GMT

For detailed information about the file format see http://www.country-files.com/cty-dat-format/

For detailed information about handling of prefixes and suffixes see http://www.cqwpx.com/rules.htm

Index

Constants

View Source
const DefaultLocalFilename = ".config/hamradio/cty.dat"

DefaultLocalFilename is the default name for the file that is used to store the contents of cty.dat locally in the user's home directory.

View Source
const DefaultURL = "http://www.country-files.com/cty/cty.dat"

DefaultURL is the original URL of the cty.dat file: http://www.country-files.com/cty/cty.dat

Variables

This section is empty.

Functions

func Download

func Download(remoteURL, localFilename string) error

Download downloads a cty.dat file from a remote URL and stores it locally.

func LocalFilename

func LocalFilename() (string, error)

LocalFilename returns the absolute path of the default local filename in the current user's home directory.

func Update

func Update(remoteURL, localFilename string) (bool, error)

Update updates the local copy of a cty.dat file from the given remote URL, but only if an update is needed.

Types

type CQZone

type CQZone int

CQZone represents a CQ zone.

func ParseCQZone

func ParseCQZone(s string) (CQZone, error)

ParseCQZone parses the CQ zone information from a string.

type ITUZone

type ITUZone int

ITUZone represents an ITU zone.

func ParseITUZone

func ParseITUZone(s string) (ITUZone, error)

ParseITUZone parses the ITU zone information from a string.

type Prefix

type Prefix struct {
	Prefix           string
	Name             string
	CQZone           CQZone
	ITUZone          ITUZone
	Continent        string
	LatLon           latlon.LatLon
	TimeOffset       TimeOffset
	PrimaryPrefix    string
	NeedsExactMatch  bool
	NotARRLCompliant bool
}

Prefix contains the information for one specific DXCC prefix. The information from the cty.dat file is denormalized: each specific prefix carries all the information associated with its primary prefix.

type Prefixes

type Prefixes struct {
	// contains filtered or unexported fields
}

Prefixes contains all DXCC prefixes.

func DefaultPrefixes added in v0.2.5

func DefaultPrefixes(updateOnDemand bool) (*Prefixes, bool, error)

DefaultPrefixes returns the default Prefixes instance. It optionally loads the latest update on demand.

func LoadLocal

func LoadLocal(localFilename string) (*Prefixes, error)

LoadLocal loads a cty.dat file from the local file system.

func LoadRemote

func LoadRemote(remoteURL string) (*Prefixes, error)

LoadRemote loads a cty.dat file from a remote URL.

func NewPrefixes

func NewPrefixes() *Prefixes

NewPrefixes creates a new instance of prefixes.

func Read

func Read(in io.Reader) (*Prefixes, error)

Read parses a set of DXCC entires from a reader

func (Prefixes) Find

func (prefixes Prefixes) Find(s string) ([]Prefix, bool)

Find returns the best matching prefixes for a given string. Since a prefix might be ambiguous, a slice of prefixes that match is returned.

type TimeOffset

type TimeOffset float64

TimeOffset represents a time offset to UTC.

func ParseTimeOffset

func ParseTimeOffset(s string) (TimeOffset, error)

ParseTimeOffset parses the time offset information from a string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL