pyradtran.io.RadiosondeAtmosphereGenerator#

class pyradtran.io.RadiosondeAtmosphereGenerator[source]#

Bases: object

Fetch and format radiosonde soundings for libRadtran.

Uses the IGRA2 network (via siphon) to find the closest active station and sounding in time, then writes the profile in radiosonde format (pressure, temperature, relative humidity).

See also

ERA5AtmosphereGenerator

Alternative model-based atmosphere.

pyradtran.utils.RadiosondeFinder

Local radiosonde file look-up.

__init__()#

__init__()

create_radiosonde_atmosphere_file(time, ...)

Fetch a sounding and write it as a libRadtran atmosphere file.

find_closest_active_stations(stations_df, ...)

Return the n closest currently-active radiosonde stations.

get_closest_sounding(target_dt, lat, lon)

Retrieve the radiosonde sounding nearest in space and time.

get_station_list([url])

Download and parse the IGRA station catalogue.

static create_radiosonde_atmosphere_file(time: datetime, latitude: float, longitude: float, output_filepath: str | Path) Path[source]#

Fetch a sounding and write it as a libRadtran atmosphere file.

Parameters:
  • time (datetime) – Target time.

  • latitude (float) – Target location.

  • longitude (float) – Target location.

  • output_filepath (str or pathlib.Path) – Destination .dat file.

Return type:

pathlib.Path

Raises:

InputGenerationError – If no data can be found or the file cannot be written.

static find_closest_active_stations(stations_df: DataFrame, lat: float, lon: float, n: int = 5) DataFrame[source]#

Return the n closest currently-active radiosonde stations.

Parameters:
  • stations_df (pandas.DataFrame) – Output of get_station_list().

  • lat (float) – Target location (degrees).

  • lon (float) – Target location (degrees).

  • n (int, default 5) – Maximum number of stations to return.

Returns:

Sorted by distance_km (ascending).

Return type:

pandas.DataFrame

static get_closest_sounding(target_dt: datetime, lat: float, lon: float) tuple[DataFrame | None, DataFrame | None, str | None][source]#

Retrieve the radiosonde sounding nearest in space and time.

Requires the siphon package for IGRA2 access.

Parameters:
  • target_dt (datetime) – Target time.

  • lat (float) – Target location (degrees).

  • lon (float) – Target location (degrees).

Returns:

  • sounding_df (pandas.DataFrame or None) – Sounding profile.

  • header (pandas.DataFrame or None) – Sounding header.

  • header_text (str or None) – Human-readable summary.

static get_station_list(url: str = 'https://www.ncei.noaa.gov/pub/data/igra/igra2-station-list.txt') DataFrame | None[source]#

Download and parse the IGRA station catalogue.

Returns:

One row per station with columns id, latitude, longitude, elevation, state, name, first_year, last_year, num_obs. None on network error.

Return type:

pandas.DataFrame or None