tephpy.io.igra#
Integrated Global Radiosonde Archive (IGRA) version 2 reader (spec §3.4).
read() takes one ascent from an IGRA v2 per-station file — the
as-distributed .zip or the extracted .txt, sniffed with
zipfile.is_zipfile rather than by suffix — parsing the fixed-width
records per NCEI’s igra2-data-format.txt: pressure in Pa, temperature
and dewpoint depression in tenths of °C, wind in degrees and tenths of
m s⁻¹, with the missing-value sentinels reading as NaN and dewpoint
derived as temperature minus depression. Unreadable, malformed, or
ambiguous input raises TephpyIOError; the
returned sounding passes the ordinary ingest validation (spec §6).
Functions#
|
Read one sounding from an IGRA v2 per-station file. |
Module Contents#
- tephpy.io.igra.read(path: str | os.PathLike[str], *, time: datetime.datetime | str | None = None) tephpy.sounding.Sounding[source]#
Read one sounding from an IGRA v2 per-station file.
- Parameters:
- path
stroros.PathLike The station file: the as-distributed
.zipor the extracted.txt.- time
datetime.datetimeorstr, optional The nominal launch time selecting the ascent; a string is read with
datetime.datetime.fromisoformat(), and a naive value is read as UTC. May be omitted only when the file holds exactly one sounding (trimmed research subsets, fixtures).
- path
- Returns:
SoundingThe validated sounding, with the IGRA station identifier and the nominal time as metadata.
- Raises:
TephpyIOErrorFor an unreadable or malformed file, a time matching no ascent (the nearest nominal times are reported, when the file records any), or an ambiguous read — several soundings with no
time=selector (the file’s count and span are reported).TypeErrorIf time is neither a datetime nor a string.
ValueErrorIf a time string is not ISO 8601.