- class foxes.core.Algorithm(foxes.core.Model)[source]
Abstract base class for algorithms.
Algorithms collect required objects for running calculations, and contain the calculation functions which are meant to be called from top level code.
Attributes¶
- verbosity: int
The verbosity level, 0 means silent
Public members¶
- property farm
The wind farm
- property mbook
The model book
- property dbook
The data book
- property idata_mem
The current idata memory
- property chunk_store
The current chunk store
-
print_deco(func_name=
None
, n_points=None
)[source] Helper function for printing model names
- initialize()[source]
Initializes the algorithm.
-
store_model_data(model, idata, force=
False
)[source] Store model data
- get_model_data(model)[source]
Gets model data from memory
- del_model_data(model)[source]
Remove stored model data
- update_n_turbines()[source]
Reset the number of turbines, according to self.farm
- get_models_idata()[source]
Returns idata object of models
-
get_models_data(idata=
None
, sel=None
, isel=None
)[source] Creates xarray from model input data.
-
new_point_data(points, states_indices=
None
, n_states=None
)[source] Creates a point data xarray object, containing only points.
-
find_chunk_in_store(mdata, tdata=
None
, prev_s=0
, prev_t=0
, ...)[source] Finds indices in chunk store
-
reset_chunk_store(new_chunk_store=
None
)[source] Resets the chunk store
- block_convergence(**kwargs)[source]
Switch on convergence block during iterative run
- eval_conv_block()[source]
Evaluate convergence block, removing blocks on the fly
-
set_running(algo, data_stash, sel=
None
, isel=None
, verbosity=0
)[source] Sets this model status to running, and moves all large data to stash.
-
unset_running(algo, data_stash, sel=
None
, isel=None
, verbosity=0
)[source] Sets this model status to not running, recovering large data from stash
- property model_id
Unique id based on the model type.
- property initialized
Initialization flag.
- sub_models()[source]
List of all sub-models
- property running
Flag for currently running models
-
get_data(variable, target, lookup=
'smfp'
, mdata=None
, ...)[source] Getter for a data entry in the model object or provided data sources