dmsp-ssm
dmsp-ssm is a Python library for reading, validating, and converting DMSP SSM binary data files.
The package accepts single .dat files, gzip-compressed .gz files, and directories of supported files. It returns a ParseResult with parsed records and a validation report. The default output is an xarray.Dataset.
Installation
pip install dmsp-ssm
For local development:
pip install -e .[dev]
Quick Start
from dmsp_ssm import Reader
reader = Reader()
result = reader.parse("path/to/file_or_directory")
dataset = result.records
report = result.report
print(dataset)
print(report.summary)
Output Profiles
Select an output profile with ParseOptions:
from dmsp_ssm import ParseOptions, Reader
reader = Reader()
result = reader.parse(
"path/to/data",
options=ParseOptions(output_profile="xarray"),
)
Supported profiles:
xarray: returns anxarray.Datasetwithrecordandseconddimensions.numpy: returns adict[str, numpy.ndarray].table: returns long-format trace rows aslist[dict[str, object]].
xarray Output
The default xarray profile contains:
- dimensions:
record,second - coordinates:
record_time,second_index - second-level variables:
time,bx,by,bz,valid - record-level variables:
flight_number,year,day_of_year,minute_start_sec_of_day,latitude_deg,longitude_deg,altitude_km
Data variables include units attributes when units are defined by the internal format definition.
Missing second-level measurements are detected by the time == -1000.0 marker. For those positions, time, bx, by, and bz are normalized to NaN, and valid is set to False.
Validation Report
ParseResult.report contains validation status, incidents, and summary counters:
result = Reader().parse("path/to/data")
print(result.report.status)
print(result.report.outcome)
print(result.report.summary)
To include compact missing-minute ranges:
result = Reader().parse(
"path/to/data",
include_missing_minute_ranges=True,
)
For directory inputs, the summary can also include per-file missing-minute diagnostics in missing_minute_ranges_by_file.
API Overview
Reader
Reader(
error_policy="resync",
pre_parse_size_warning_threshold_bytes=256 * 1024 * 1024,
)
Use Reader.parse(path, ...) to parse a file or directory.
ParseOptions
ParseOptions(
recursive=True,
error_policy=None,
include_missing_minute_ranges=False,
output_profile="xarray",
)
output_profile must be one of xarray, numpy, or table.
ParseResult
ParseResult.records contains the selected output artifact.
ParseResult.report contains validation diagnostics.
ParseResult.metadata and ParseResult.extensions are reserved for optional metadata.
Supported Input
.datfiles.gzfiles containing DMSP SSM binary data- directories containing only one supported file type
- recursive directory traversal when
recursive=True
Directories containing mixed .dat and .gz files are rejected.
License
This project is licensed under the MIT License.
Metadata
Release files for dmsp-ssm 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dmsp_ssm-1.0.1.tar.gz | 35.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dmsp_ssm-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 89.2 kB
Release files / dmsp_ssm-1.0.1.tar.gz
| Download URL | dmsp_ssm-1.0.1.tar.gz |
|---|---|
| Size | 35.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1bb7126e64ca92bd80ac679bbf2953e935f554db0fa080699779d92e45a9b2ca
|
|
BLAKE2b-256 checksum How to use checksums |
15ad7f91815e5151cdb6ba4f983be1e08be7e1b5d5456b47c06997032e0ec000
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Release files / dmsp_ssm-1.0.1-py3-none-any.whl
| Download URL | dmsp_ssm-1.0.1-py3-none-any.whl |
|---|---|
| Size | 53.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9b378f7a79616320e4da07f50e035bcceb8d4e57f28f3169e84ed3498c26c244
|
|
BLAKE2b-256 checksum How to use checksums |
8dfbb65b6527d994445a90c2fdec2913ff389a26cb78b5486c26ba034a8d516c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|