pyradtran.utils.RadiosondeFinder#

class pyradtran.utils.RadiosondeFinder(base_path: Path | None)[source]#

Bases: object

Locate the radiosonde file closest in time to a target datetime.

On construction the base_path directory tree is scanned for files matching the pattern YYYYMMDD_SSSSSSOD.dat (date + seconds-of-day). Subsequent calls to find_closest() perform a fast binary search on the pre-sorted file list.

Parameters:

base_path (pathlib.Path or None) – Root directory to scan. If None, no scanning is performed and all look-ups return None.

Examples

>>> finder = RadiosondeFinder(Path("/data/radiosondes"))
>>> finder.find_closest(datetime(2022, 3, 28, 12, 0))
PosixPath('/data/radiosondes/2022/20220328_43200SOD.dat')

See also

pyradtran.io.RadiosondeAtmosphereGenerator

Fetch soundings from IGRA.

__init__(base_path: Path | None)[source]#

__init__(base_path)

find_closest(target_dt)

Return the radiosonde file closest in time to target_dt.

find_radiosonde_file(dt, latitude, longitude)

Find the radiosonde file closest to dt.

find_closest(target_dt: datetime) Path | None[source]#

Return the radiosonde file closest in time to target_dt.

Parameters:

target_dt (datetime) – Target time (UTC assumed if timezone-naive).

Returns:

Absolute path to the best-matching file, or None when no files have been indexed.

Return type:

pathlib.Path or None

find_radiosonde_file(dt: datetime, latitude: float, longitude: float) Path | None[source]#

Find the radiosonde file closest to dt.

Parameters:
  • dt (datetime) – Target time.

  • latitude (float) – Reserved for future spatial matching; currently unused.

  • longitude (float) – Reserved for future spatial matching; currently unused.

Return type:

pathlib.Path or None