pywasp.wasp.align_direction_crs#
- pywasp.wasp.align_direction_crs(wind_climate, target_wind_dir_crs, source_wind_dir_crs=None, conf=None)[source]#
Align a wind climate to a target wind-direction CRS.
Wind directions may be expressed relative to true north or relative to the grid north of a projected CRS. This helper rotates the directional part of a wind climate from
source_wind_dir_crsintotarget_wind_dir_crsat the climate locations and stores the target frame in thewind_dir_crsattribute.The simpler the wind climate, the harder this operation is to perform without information loss. TSWC direction values are rotated directly and therefore retain the original time-series information. BWC sector histograms are resampled, so information is limited by sector and wind-speed bin resolution. WWC and GWC contain only sectoral Weibull parameters and frequencies, so rotation is the most compressed approximation and relies on conserving moments during sector rotation.
- Parameters:
wind_climate (
xarray.Dataset) – TSWC, BWC, WWC, or GWC dataset. GeoWC is not supported because it contains additional directional variables that cannot be rotated by the WWC sector-rotation routine.target_wind_dir_crs (
CRS-like) – Coordinate reference system whose grid north should define the output wind-direction frame.source_wind_dir_crs (
CRS-like, optional) – Coordinate reference system whose grid north defines the input wind-direction frame. If omitted, the function readswind_climate.attrs["wind_dir_crs"]. All supported wind climates require explicit source-frame metadata.conf (
pywasp.wasp.Config, optional) – Configuration object passed towwc_rotatefor WWC and GWC input.
- Returns:
xarray.Dataset– Wind climate with directions aligned totarget_wind_dir_crsand awind_dir_crsattribute containing the target CRS WKT. The spatial CRS metadata is preserved from the input.- Raises:
ValueError – If
wind_climateis unsupported, if source-frame metadata is missing, or if a GeoWC is passed.