SODAR#
SODAR wind profiles from the Horel group MesoWest archive.
Reads SODAR (SOnic Detection And Ranging) wind-profile data that the Horel
group archives as monthly HDF5 files under
horel-group/oper/mesowest/sodar_data/hdf5archive:
{SID}_full_metadata_log.h5 station metadata + variable scale factors
{SID}_{YYYY}_{MM}_sodar.h5 one month of profiles
The archive is located through the Horel group space
(uataq.filesystem.groupspaces.horel.MESOWEST_DIR); pass
mesowest_dir=... to read a copy elsewhere.
SODAR stations are MesoWest stations, not UATAQ sites, so they are not part of
the configuration and are read directly with Sodar
rather than through uataq.read_data(). Profiles are returned as an
xarray.Dataset with dimensions (Time_UTC, level).
Examples
>>> from uataq.sodar import Sodar
>>> sodar = Sodar("USDR1")
>>> data = sodar.read_data(time_range=["2019-01-01", "2019-01-31"])
>>> winds = Sodar.get_winds_at_height(data, height=100)
- uataq.sodar.list_stations(mesowest_dir=None)[source]#
List the SODAR station IDs available in the archive.
A station is available if it has a
{SID}_full_metadata_log.h5file.- Parameters:
mesowest_dir (str, optional) – MesoWest data directory. Defaults to
uataq.filesystem.groupspaces.horel.MESOWEST_DIR.- Returns:
Sorted station IDs.
- Return type:
- class uataq.sodar.Sodar(SID, mesowest_dir=None)[source]#
Horel group SODAR wind profiler.
- Parameters:
SID (str) – Station identifier, e.g.
"USDR1"(case-insensitive).mesowest_dir (str, optional) – MesoWest data directory containing
sodar_data/hdf5archive. Defaults touataq.filesystem.groupspaces.horel.MESOWEST_DIR.
- meta#
Station metadata log (location, name, changes).
- Type:
- variables#
Variable metadata indexed by
SHORTNAME; theMULTcolumn holds the integer scale factor applied inparse().- Type:
- Raises:
FileNotFoundError – If the archive directory or the station’s metadata log does not exist.
- model = 'sodar'#
- species_measured = ('wind',)#
- get_files(lvl='raw', time_range=None)[source]#
List archived SODAR HDF5 files for this station within a time range.
- static parse(file, variables)[source]#
Parse a single SODAR HDF5 file into an xarray Dataset.
NoData (
-9999) becomes NaN and each variable listed invariablesis divided by itsMULTscale factor.- Parameters:
file (str) – Path to a
{SID}_{YYYY}_{MM}_sodar.h5file.variables (pandas.DataFrame) – Variable metadata indexed by
SHORTNAMEwith aMULTcolumn (Sodar.variables).
- Returns:
STATION_IDonTime_UTCand one(Time_UTC, level)variable per profile field (e.g.HEIGHT,WD,WS).- Return type:
- read_data(lvl='raw', time_range=None, num_processes=1)[source]#
Read and combine SODAR profiles over a time range.
- Parameters:
lvl (str, optional) – Processing level. Only
'raw'is available.time_range (TimeRange | TimeRangeTypes, optional) – Time range to read,
start <= Time_UTC < stop(seeuataq.timerange.TimeRange). A date string as the stop includes that whole day. Default is None which reads all data.num_processes (int | 'max', optional) – Number of processes used to parse files. Default is 1.
- Returns:
Profiles with dimensions
(Time_UTC, level), sorted by time.- Return type:
- Raises:
FileNotFoundError – If no files overlap
time_range.
- static get_winds_at_height(data, height)[source]#
Extract wind direction and speed at a given height.
The level is matched against
HEIGHTat every timestamp, so the result is correct even if the range gates change withindata. Timestamps without a level atheightare dropped.- Parameters:
data (xarray.Dataset) – SODAR profiles from
read_data()orparse().height (float) – Height of the range gate, in the units of
HEIGHT(m AGL).
- Returns:
directionandspeedcolumns indexed byTime_UTC.- Return type:
- Raises:
ValueError – If no level is at
heightanywhere indata.