lair.air.air#

Miscellaneous functions for atmospheric data.

Functions

bin_polar(data[, x, wd, xbins])

Bin data into polar coordinates.

circularize_radial_data(agg)

Circularize radial data for polar plots.

rotate_winds(u, v, lon)

Rotate winds from grid to earth coordinates.

wind_components(speed, wind_direction)

Calculate the u and v components of the wind.

wind_direction(u, v)

Convert u and v components to wind direction.

lair.air.air.bin_polar(data: DataFrame, x: str = 'ws', wd: str = 'wd', xbins: int = 30) DataFrame[source]#

Bin data into polar coordinates.

Parameters:
datapd.DataFrame

Data to bin.

xstr, optional

Variable to bin. Default is ‘ws’.

wdstr, optional

Wind direction column name. Default is ‘wd’.

xbinsint, optional

Number of bins for x. Default is 30.

Returns:
pd.DataFrame

Data with binned wind direction and speed.

lair.air.air.circularize_radial_data(agg: DataFrame)[source]#

Circularize radial data for polar plots.

Parameters:
aggpd.DataFrame

Aggregated data. Index is theta, columns are r.

Returns:
tuple[np.ndarray, np.ndarray, np.ndarray]

Theta, r, and c for polar

lair.air.air.wind_components(speed, wind_direction) tuple[Any, Any][source]#

Calculate the u and v components of the wind.

Parameters:
speedfloat

Wind speed in m/s.

wind_directionfloat

Wind direction in degrees clockwise from North (specified as blowing from).

Returns:
tuple[float, float]

u and v components of the wind.

lair.air.air.wind_direction(u, v)[source]#

Convert u and v components to wind direction.

Parameters:
unp.array

u component of wind

vnp.array

v component of wind

Returns:
np.array

wind direction in degrees

lair.air.air.rotate_winds(u, v, lon) tuple[Any, Any][source]#

Rotate winds from grid to earth coordinates.

Parameters:
unp.array

u component of wind

vnp.array

v component of wind

lonfloat

longitude of point

Returns:
tuple[np.array, np.array]

u and v components of wind in earth coordinates