DK AIS [dkais]
This Python package streamlines the download and processing of historical Automatic Identification System (AIS) data provided by the Danish Maritime Authority (DMA).
AIS is a maritime navigation safety communications system standardised by the International Telecommunication Union (ITU) and adopted by the International Maritime Organization (IMO). AIS is a VHF-based navigation and anti-collision tool making it possible to exchange information between ships.
For more information about AIS, including its history, functionality and applications - see Wikipedia.
https://github.com/user-attachments/assets/b809ad7f-fca4-404a-9a1e-20e29a72d7e8
Usage
dkais mirrors the public bucket to a data directory and converts each daily CSV to Parquet.
Set the directory once with DKAIS_DATA_DIR (or pass --data-dir to any command).
dkais list --start 2026-10 # archives & local state
dkais download --start 2026-10 --end 2026-10-07 # zips to <data-dir>/raw
dkais process --start 2026-10 --end 2026-10-07 # to <data-dir>/parquet
dkais <command> --help lists a command's options and examples. list --json emits
machine-readable output, download -j N sets concurrent downloads (default 4) and
process --force re-converts days that already have Parquet output. download -n and
process -n (--dry-run) print what they would do to STDERR and stop, changing nothing.
list prints a table on a terminal and, when piped, one tab-separated row per archive - the
--json keys in order, without a header. Add -d before or after any command for debug logging.
Exit codes are 0 for success, 1 for a failure (e.g. a failed download), 2 for a usage error,
70 for an unexpected error - a bug, please report it - and 130 for Ctrl-C.
Dates are YYYY, YYYY-MM or YYYY-MM-DD and inclusive. download and process need --start
or --all - the full bucket is ~4.2 TB compressed. download --all names the archive count and
size and asks before it starts; --force skips the question. Scripts must pass --force, since
without a terminal on STDIN download --all exits 2 rather than ask. download fetches whole
archives (monthly up to 2024-02, daily since), while process converts only the days in range.
Both skip completed work, so an interrupted run resumes where it stopped. process works offline
from <data-dir>/raw.
<data-dir>/
raw/YYYY/aisdk-YYYY-MM[-DD].zip
parquet/YEAR=2026/MONTH=10/aisdk-2026-10-18.parquet
tmp/
process unzips the next day while converting the current one. A day's CSV is held in memory when
five times its size is available (a 3 GB daily CSV needs ~15 GB), otherwise it is extracted to
<data-dir>/tmp. Unzipping uses zlib-ng, either from the zlib-ng package or the standard
library where it is built in (CPython 3.14+ on Windows).
Each Parquet file holds one day: all 26 DMA columns renamed to UPPER_SNAKE and typed, sorted by
MMSI and DATETIME. AIS "not available" values (latitude 91, longitude 181, heading 511,
Unknown IMO/callsign/destination) become null, and no rows are dropped. The three historical CSV
dialects (comma with 22 columns, header-less semicolon with decimal commas, comma with 26 columns)
share one output schema.
import polars as pl
ais = pl.scan_parquet("<data-dir>/parquet", hive_partitioning=True)
october = ais.filter(pl.col("YEAR") == 2026, pl.col("MONTH") == 10)
Dataset
Metadata
- Identifiers - ship name, call sign or IMO number & MMSI number
- Navigation - position, course & speed
- Voyage - destination, ETA & actual draught
Veracity
Information received by AIS originates from the ships' own instruments. There can be errors in the information inserted or technical defects that may give an erroneous impression of the ship's speed or position.
AIS contributes to safety of navigation and has, in many ways, made it easier to navigate safely. However, AIS also has some limitations that it is important to take account of. If you trust your AIS data uncritically, it may be risky.
Features
See the table below, for the original DMA dataset features and the new feature names in the
typed Parquet files after dkais processing.
| Original | Processed | Type | Comment |
|---|---|---|---|
| Timestamp | DATETIME | datetime[μs] | dd/mm/yyyy HH:MM:SS |
| Type of mobile | MOBILE_TYPE | cat | Vessel class |
| MMSI | MMSI | i32 | Maritime Mobile Service Identity (unique 9-digit number) |
| Latitude | LATITUDE | f64 | Decimal degrees, null if 91 (not available) |
| Longitude | LONGITUDE | f64 | Decimal degrees, null if 181 (not available) |
| Navigational Status | NAV_STATUS | cat | Navigational status (AIS metadata) |
| ROT | ROT | f32 | Rate of Turn (AIS metadata) |
| SOG | SOG | f32 | Speed Over Ground (AIS metadata) |
| COG | COG | f32 | Course Over Ground (AIS metadata) |
| Heading | HEADING | i16 | Heading (AIS metadata), null if 511 (not available) |
| IMO | IMO | i32 | International Maritime Organization number, null if Unknown |
| Callsign | CALLSIGN | str | Callsign of the vessel, null if Unknown |
| Name | NAME | str | Name of the vessel |
| Ship type | SHIP_TYPE | cat | Type of ship (AIS metadata) |
| Cargo type | CARGO_TYPE | cat | Type of cargo (AIS metadata) |
| Width | WIDTH | i16 | Width of the vessel |
| Length | LENGTH | i16 | Length of the vessel |
| Type of position fixing device | POSITION_DEVICE | cat | e.g. GPS, GLONASS, Galileo, Surveyed |
| Draught | DRAUGHT | f32 | Draught of the vessel (AIS metadata) |
| Destination | DESTINATION | str | Destination of the vessel (AIS metadata), null if Unknown |
| ETA | ETA | datetime[μs] | Estimated Time of Arrival, dd/mm/yyyy HH:MM:SS |
| Data source type | DATA_SOURCE | cat | e.g. AIS |
| A | SIZE_A | i16 | Length from GPS to the bow, null in 22-column files |
| B | SIZE_B | i16 | Length from GPS to the stern, null in 22-column files |
| C | SIZE_C | i16 | Length from GPS to starboard side, null in 22-column files |
| D | SIZE_D | i16 | Length from GPS to port side, null in 22-column files |
Metadata
Release files for dkais 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dkais-0.2.0.tar.gz | 27.7 kB | Without provenance | Details for dkais-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dkais-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for dkais-0.2.0-py3-none-any.whl |
Total release size: 57.7 kB
Release files / dkais-0.2.0.tar.gz
| Download URL | dkais-0.2.0.tar.gz |
|---|---|
| Size | 27.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0e6f126b9a55aa6b850b6c443b718216c5ad5379a0bf99a6f835a728cf3c4215
|
|
BLAKE2b-256 checksum How to use checksums |
65bde6b8f5fbc6f0bb4745712d576fcb28df26661f38b0c7e176938f4b4d13a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / dkais-0.2.0-py3-none-any.whl
| Download URL | dkais-0.2.0-py3-none-any.whl |
|---|---|
| Size | 30.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a0b76a703c494aa560cb401da72f9f39f3dd40178ad04b3877e46c5bc370a26d
|
|
BLAKE2b-256 checksum How to use checksums |
f926189abb08e2bdbae98a7aa0ebfb28112b86d135b4e8b052dab0a185dff333
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for dkais 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.