Viz
Viz (base class)
- class onwards.vizs.Viz(farm: Farm)
Bases:
object
Inits a Viz object
Prototype class for user defined Viz objects. Viz objects facilitate the export and plot of the OnWaRDS simulations results.
- Parameters
farm (Farm) – Parent Farm object.
See also
- _data_clean()
Clean the Viz data (should be implemented by the child class)
- _export()
Exports the Viz data (should be implemented by the child class)
- _plot()
Plots the Viz data (should be implemented by the child class)
- data_get(*args, **kwargs)
Wrapper for
_data_get
- export()
Exports de the Viz data (wrapper for
_export
)Note
export
is automatically triggered when callingfarm.__exit__
method.
- plot()
Plots the Viz data (wrapper for
_plot
)
- reset()
Resets the Viz data
- update()
Updates the Viz data
- viz_type = None
Viz_centerline
- class onwards.vizs.centerline.Centerline(file, mask_type: str = '', time_zero_origin=True)
Bases:
object
Centerline object
- Parameters
file (str) – Filepath to the .bin centerline file.
mask_type ((str, optional)) – Mask type (eg:
gaussian
), by default, None.time_zero_origin ((bool, optional)) – If true, time vector is shifted so that
self.time[0]=0
by default, False.
Note
This class is only loaded if no local implementation is found.
- class onwards.vizs.centerline.Viz_centerline(farm: Farm, bf_dir: str = None, i_mask: int = None)
Bases:
onwards.vizs.viz.Viz
Extracts the position of the wake centerline from the Lagrangian flow model and from the LES reference data.
- Parameters
- Raises
Exception – If any of the wake centerline origin does not match the associated Turbine location.
ValueError – If bf_dir is not compatible with previous Viz_centerline initialization.
Note
This class does not implement any plot method. It only exports the wake centerline data so that it can be postprocessed afterwards.
See also
- viz_type = 'centerline'
- class onwards.vizs.centerline_xloc.Viz_centerline_xloc(farm: Farm, x_loc: List[float], bf_dir: str = None, i_mask: int = None, xlim: List[float] = None, ylim: List[float] = None, u_norm: float = None, diag: bool = True)
Bases:
onwards.vizs.centerline.Viz_centerline
Extracts the position of the wake centerline at the
x_loc
location and compares it to the LES reference data.- Parameters
bf_dir (str) – Path to the reference LES data.
i_mask (int, optional) – Index of the mask used for the wake centerline tracking for the LES reference data, if None (by default), all available masks are imported.
xlim (List[float], optional) – User defined time bounds for plotting, by default None.
ylim (List[float], optional) – User defined streamwise position bounds for plotting, by default None.
u_norm (float, optional) – Velocity used for data normalization T_C = D/u_norm, if no u_norm (by default) is provided, no normalization is applied.
diag (bool, optional) – If True (by default), the correlation, error and MAPE are evaluated.
See also
Viz_estimators
- class onwards.vizs.estimators.Viz_estimators(farm: Farm, states: List[str], measurements: List[str], labels: List[str], units: List[str], offset: List[float] = None, ylim: List[List[float, float]] = None, xlim: List[float, float] = None, diag: bool = True)
Bases:
onwards.vizs.viz.Viz
Extracts the Turbine states and compares them to the reference data.
Allows to assess the performances of the estimator by comparing the estimated turbine state to its reference state. The reference value is extracted from the associated Sensor object (ie: Sensors object can store reference data that is never used as part of the state estimation and hence only serves as validation data).
- Parameters
farm (Farm) – Parent Farm Object
states (List[str]) – List containing the turbine states, s_wt, that should be extracted.
measurements (List[str]) – List containing the turbine measurements that should be extracted.
labels (List[str]) – List containing the name/label of the fields extracted.
units (List[str]) – List containing the unit (eg:
'[ms-1]'
) of the fields extracted.offset (List[float], optional) – List containing the temporal offset applied to the measurments.
ylim (List[List[float, float]], optional) – List containing the user defined bounds associated to each field, by default None
xlim (List[float, float], optional) – User defined time bounds for plotting, by default None.
diag (bool, optional) – If True, the correlation, error and MAPE are evaluated, by default True.
- Raises
ValueError – If the length of states, measurements, labels, units, offset and ylim is not consistent.
ValueError – The requested field / measurement is not available.
ValueError – The requested field / turbine state is not available.
- viz_type = 'estimators'
Viz_particles
- class onwards.vizs.particles.Viz_particles(farm: Farm, *args, **kwargs)
Bases:
onwards.vizs.viz.Viz
Plots the position of the wake and ambient flow particles
- Parameters
farm (Farm) – Parent Farm Object
- viz_type = 'particles'
Viz_rews
- class onwards.vizs.rews.Viz_rews(farm: Farm, x_interp: float, t_ref: List(float) = None, u_ref: List(float) = None, fs_flag: bool = False, wt: Turbine = None, xlim: List[float] = None, ylim: List[float] = None, u_norm: float = None, diag: bool = True)
Bases:
onwards.vizs.viz.Viz
Extracts the Rotor Effective Wind Speed (REWS) at the
x_interp
streamwise location and compares it to the LES reference data.- Parameters
t_ref (List) – Time vector of the reference LES data in [s]
u_ref (List) – Time series of the reference REWS velocity extracted from the LES data in [ms-1]
x_interp (float) – Downstream streamwise (x) position where the REWS should be evaluated.
fs_flag (bool, optional) – True if the ambient (ie: no wake) REWS should also be computed, by default False
wt (Turbine, optional) – Index of the reference turbine: if a turbine is provided, the position the REWS is evaluated at will be
wt.x + x_interp
, by default Done.xlim (List[float], optional) – User defined time bounds for plotting, by default None.
ylim (List[float], optional) – User defined REWS bounds for plotting, by default None.
u_norm (float, optional) – Velocity used for data normalization T_C = D/u_norm, if no u_norm (by default) is provided, no normalization is applied.
diag (bool, optional) – If True (by default), the correlation, error and MAPE are evaluated.
See also
- viz_type = 'rews'
Viz_velfield
- class onwards.vizs.velfield.Field_bf(data_path: str, farm: Farm, comp: int)
Bases:
object
- class onwards.vizs.velfield.Field_npz(data_path: str, farm: Farm, comp: int)
Bases:
object
- class onwards.vizs.velfield.Viz_velfield(farm: Farm, vel_bnds: list, comp: int = 0, data_fid: str = False, mp4_export: bool = True, skip: int = 1, t_start: float = None, skeleton: bool = False, show: bool = True, slice_export: bool = False)
Bases:
onwards.vizs.viz.Viz
Extracts and plots the 2D farm flow velocity velocity and compares it against the reference data.
- Parameters
vel_bnds (list) – User defined velocity bounds for plotting [ms-1].
comp (int) – Velocity field component to be plotted if None, magnitude is plotted, by default 0.
data_fid (str, optional) – Path to the LES 2D fields data.
mp4_export (bool, optional) – If True (by default), one png is exported at every time step.
skip (int, optional) – Slices are plotted every
skip
timesteps, by default 1t_start (float, optional) – Data is only plotted after
t_start
[s], by default Falseskeleton (bool, optional) – If True, the model isocontours are overlaid to the BF data for easy comparison, by default False.
show (bool, optional) – If True (by default), the figure GUI is updated at every timestep.
slice_export (bool, optional) – If true export hub height slices as .npy files, by default False.
- viz_type = 'velfield'