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(→ tephpy.sounding.Sounding)

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:
pathstr or os.PathLike

The station file: the as-distributed .zip or the extracted .txt.

timedatetime.datetime or str, 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).

Returns:
Sounding

The validated sounding, with the IGRA station identifier and the nominal time as metadata.

Raises:
TephpyIOError

For 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).

TypeError

If time is neither a datetime nor a string.

ValueError

If a time string is not ISO 8601.