8. GLOFRIM API

8.1. Initialization

Before a coupled model can be run, the individual model have to be initialized and all exchanges between them must be defined.

Glofrim.initialize_config

Initializing the model configuration file.

Glofrim.initialize_model

Initializes the model, ie loading all files and checking for consistency.

Glofrim.initialize

Initializes the model following a two-step initialization procedure.

Glofrim.set_exchanges

Defines variable exchanges between models as well as unit and time conversions.

8.2. Execution

GLOFRIM provides a range of functions to retrieve and change time information, update models, as well as exchange content between models during execution. These exchange functions are used inside the update function to exchange variables according to the setting in the exhanges section of the GLOFRIM ini file.

Glofrim.get_current_time

Provides current model time.

Glofrim.update

Updating model for a certain time step interval (default: None).

Glofrim.update_until

Updates the model until time t is reached with an update time step dt.

Glofrim.exchange

Exchanges variable content from specified source variable in source model to a specified destination variable in the destination model.

Glofrim.exchange_same_grid

Exchanges variable content from specified source variable in source model to a specified destination variable in the destination model for the entire grid.

Glofrim.exchange_at_indices

Exchanges variable content from specified source variable in source model to a specified destination variable in the destination model for user-specified indices.

8.2.7. Variable Getter and Setter Functions

Functions to retrieve and overwrite values for either entire grid or only certain indices.

Glofrim.get_value

Gets values of a certain exposed variable.

Glofrim.get_value_at_indices

Gets values at a specific index of a certain exposed variable.

Glofrim.set_value

Overwriting of all values of a certain exposed variable with provided new values.

Glofrim.set_value_at_indices

Overwriting of value at specific entry of a certain exposed variable with provided new values.

8.3. Finalization

It is possible to change model end times and finalize model states after execution.

Glofrim.finalize

Finalizes the model.

8.4. Auxiliary functions

In addition, there are several auxiliary functions built in GLOFRIM to check states and properties of models as well as their components, variables, and attributs.

8.4.1. Model Information Functions

General information about model structure and variables.

Glofrim.get_model_type

Returns type of model.

Glofrim.get_component_name

Returns component name of specified model.

Glofrim.get_input_var_names

Returns list with all possible input variable names that can be used as exchange TO the specified model.

Glofrim.get_output_var_names

Returns list with all possible output variable names that can be used as exchange FROM the specified model.

8.4.2. Variable Information Functions

Providing information about properties of model variables.

Glofrim.get_var_type

Returns the type of a user-specified model variable exposed via BMI.

Glofrim.get_var_units

Provides units of variable.

Glofrim.get_var_rank

Provides number of dimensions of variable.

Glofrim.get_var_size

Providestotal number of values contained in variable.

Glofrim.get_var_shape

Provides shape of variable.

Glofrim.get_var_nbytes

Provides number of bytes of variable.

Glofrim.get_time_units

Provides time unit of model.

8.4.3. Grid Information Functions

Information about model grid.

Glofrim.get_grid_type

Provides grid type of model.

8.4.4. Attribute/ Config Information Functions

Functions providing insights in settings of model configuration files. Note that the set functions can only be used before model initialization.

Glofrim.set_out_dir

Setting output directory of model.

Glofrim.get_time_step

Provides time step of model.

Glofrim.set_start_time

Overwriting default model start time with user-specified start time.

Glofrim.get_start_time

Provides start time of model.

Glofrim.get_end_time

Provides end time of model.

Glofrim.set_end_time

Overwriting default model end time with user-specified end time.

Glofrim.get_attribute_names

Provides list with all model attribute names from model config file.

Glofrim.get_attribute_value

gets attribute value in in underlying model.

Glofrim.set_attribute_value

sets attribute value in underlying model.