lair.air.air#
Miscellaneous functions for atmospheric data.
Functions
|
Bin data into polar coordinates. |
Circularize radial data for polar plots. |
|
|
Rotate winds from grid to earth coordinates. |
|
Calculate the u and v components of the wind. |
|
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.
Note
Based on https://rapidrefresh.noaa.gov/faq/HRRR.faq.html Modified from https://gist.github.com/fischcheng/411d0bafe7762e6b5d7b1233b625a2bb
- 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