HydroLangBMI

HydroLangBMI

new HydroLangBMI(configfile)

BMI implementation of the functions of HydroLang.js Creates and updates forcings and data following the models from configuration files and makes calls from other modules. If no link is added into the configuration, then an error will be raised. All instances of HydroLang will be accessible through the BMI configuration file.

Parameters:
Name Type Description
configfile Object

The configuration file object.

Properties
Name Type Attributes Description
modelName string

The name of the model.

componentName string

The name of the component.

moduleName string

The name of the module.

modelCode string

The code of the model.

functionName string

The name of the function.

args Array

The arguments for the function.

params Array

The parameters for the function.

duration Object

The duration configuration.

Properties
Name Type Attributes Description
defaultStep number <optional>

The default step duration in hours.

timeUnit string <optional>

The time unit for the default step (possible values: "s", "min", "h", "d").

startTime number <optional>

The start time for the simulation in Unix timestamp.

endTime number <optional>

The end time for the simulation in Unix timestamp.

inputVars Array

The input variables for the function.

outputVars Array

The output variables for the function.

now number <optional>

The current time in the simulation.

units Object

The units configuration.

Properties
Name Type Description
input Object

The input units.

output Object

The output units.

Source:

Extends

Methods

(static) dataTypes() → {String}

Returns the data types found within JS and used throughout a specific model run.

Source:
Returns:

type of value passed to the function

Type
String

(static) finalize() → {void}

Finalizes the requirements of a specific function.

Source:
Returns:

alert about model simulation being finalized.

Type
void

(static) generateOutputs() → {Object}

Creates an output file downloaded to local machine with the outputs of the model results.

Source:
To Do:
  • Finilize implementation
Returns:

creates a memory reporter for all the values and actions taken for the model run

Type
Object

(static) get_component_name() → {String}

Gives back a model name defined by the configuration file

Parameters:
Type Description
void
Source:
Returns:

model and modelcode as a full name

Type
String

(static) get_current_time() → {Number}

Current time of the model

Source:
Returns:
  • The current model time.
Type
Number

(static) get_end_time() → {Number}

End time of the model.

Source:
Returns:

end time specified.

Type
Number

(static) get_grid_edge_count(grid) → {Number}

Get the number of edges in the grid.

Parameters:
Name Type Description
grid Number

grid identifier

Source:
Returns:

total number of grid edges

Type
Number

(static) get_grid_edge_nodes(grid) → {Array.<Object>}

Get the edge-node connectivity.

Parameters:
Name Type Description
grid Number

A grid identifier

Source:
Returns:

number array of (2 x n-nodes) shape to place the edge-node connectivity. For each edge, connectivity is given as node at edge tail, followed by node at edge head.

Type
Array.<Object>

(static) get_grid_face_count(grid) → {Number}

Get the number of faces in the grid.

Parameters:
Name Type Description
grid Number

A grid identifier

Source:
Returns:

The total number of grid faces.

Type
Number

(static) get_grid_face_nodes(grid) → {Array.<Object>}

Returns the face-edge connectivity.

Parameters:
Name Type Description
grid Number

grid identifier

Source:
Returns:

number array to place face-edge connectivity

Type
Array.<Object>

(static) get_grid_face_nodes(grid) → {Array.<Object>}

Returns the face-node connectivity for a grid.

Parameters:
Name Type Description
grid Number

grid identifier

Source:
Returns:

number array to place face-node connectivity

Type
Array.<Object>

(static) get_grid_node_count(grid) → {Number}

Get the number of nodes in the grid.

Parameters:
Name Type Description
grid Number

grid identifier

Source:
Returns:

total number of grid nodes

Type
Number

(static) get_grid_nodes_per_face(grid) → {Array.<Object>}

Returns the number of nodes per face of grid.

Parameters:
Name Type Description
grid Number

grid identifier

Source:
Returns:

A number Array of (n-faces)shape to place the number of nodes per face.

Type
Array.<Object>

(static) get_grid_origin(grid) → {Array.<Object>}

Get the origin of a grid.

Parameters:
Name Type Description
grid Number

grid identifier

Source:
Returns:

coordinates of the origin of a specific grid

Type
Array.<Object>

(static) get_grid_shape(grid, shape)

Get dimensions of the computational grid

Parameters:
Name Type Description
grid Number

grid identifier

shape Array.<Object>

A Number Array of n-dim shape into which to place the shape of the grid.

Source:

(static) get_grid_size(grid-) → {Number}

Get the dimensions of a computational grid.

Parameters:
Name Type Description
grid- Number

grid identifier

Source:
Returns:

Grid rank

Type
Number

(static) get_grid_size(grid) → {Number}

Get the dimensions of a computational grid.

Parameters:
Name Type Description
grid Number

grid identifier

Source:
Returns:

Grid size

Type
Number

(static) get_grid_spacing(grid) → {Array.<Object>}

Get the spacing between grid nodes.

Parameters:
Name Type Description
grid Number

grid identifier

Source:
Returns:

spacing of computational grid

Type
Array.<Object>

(static) get_grid_type(grid) → {String}

Get the grid type as a string.

Parameters:
Name Type Description
grid Number

A grid identifier

Source:
Returns:

Type of grid as a string.

Type
String

(static) get_grid_x(grid) → {Array.<Object>}

Get the locations of a grid’s nodes in dimension x.

Parameters:
Name Type Description
grid Number

grid identifier

Source:
Returns:

array containing n-rows holding x-coordinates

Type
Array.<Object>

(static) get_grid_y(grid) → {Array.<Object>}

Get the locations of a grid’s nodes in dimension y.

Parameters:
Name Type Description
grid Number

grid identifier

Source:
Returns:

array containing n-rows holding y-coordinates

Type
Array.<Object>

(static) get_grid_z(grid) → {Array.<Object>}

Get the locations of a grid’s nodes in dimension z.

Parameters:
Name Type Description
grid Number

grid identifier

Source:
Returns:

array containing n-rows holding z-coordinates

Type
Array.<Object>

(static) get_input_item_count() → {Object}

Lets other models see the available variables included within the model

Parameters:
Type Description
void
Source:
Returns:

array with names as strings

Type
Object

(static) get_time_step() → {Number}

Returns the current state of the model. For HydroLangBMI is the default time step.

Source:
Returns:

default time step

Type
Number

(static) get_time_units() → {String}

Time units of the model

Source:
Returns:

unit of time. If not specified in config file, the unit used throughout HydroLang is hour

Type
String

(static) get_value_at_indices(var_name, dest, inds) → {Array.<Object>}

Parameters:
Name Type Description
var_name String

name of input variable

dest Array.<Object>

array destiny for the results

inds Array.<Object>

array containing the indices

Source:
Returns:

destiny array with objects

Type
Array.<Object>

(static) get_value_ptr(var_name, array) → {Error}

Get a reference to the values of a given variable. Tailored towards the final implementation of the

Parameters:
Name Type Description
var_name String

name of input or output variable

array Array.<Object>

array object holding result

Source:
Returns:

no implementation for HydroLangBMI/JavaScript.

Type
Error

(static) get_var_type(name) → {String}

Returns the data type of the given variable.

Parameters:
Name Type Description
name String

input or output variable name, a CSDMS Standard Name

Source:
Returns:

Variable nme depending on the type of variable.

Type
String

(static) handleConfig() → {void}

Configuration object that creates a result based on the passed configurations to the HydroLang instance requirement. It saves any results on a result variable that is attached into the class after its called. The method runs once the HydroLangBMI class is called.

Source:
Returns:
  • creates a result variable attached to the class.
Type
void

(static) initialize(configfile) → {void}

Parameters:
Name Type Description
configfile String

configuration file that contains minimum the following: model name, component name, module name, model code, function name, arguments, parameters.

Source:
Returns:

sets the variables from above to the this object.

Type
void

(static) set_value(var_name, array)

Sets a value for an exisiting variable from an array.

Parameters:
Name Type Description
var_name String

name of the input variable

array Array.<Object>

array with values to be copied

Source:

(static) set_value_at_indices(var_name, inds, dest)

Sets values at particular indices

Parameters:
Name Type Description
var_name String

name of input variable

inds Array.<Object>

array containing the indices

dest Array.<Object>

array contaiing the results

Source:

(static) update()

Update the model until a required time, Depending on the module and function required.

Source:

(static) update_until(time) → {void}

Updates a model and function call depending on the requirements of the function and module called.

Parameters:
Name Type Description
time Number

default time to be updated depending on the model

Source:
Returns:

updates the current variable to the required timestep.

Type
void

(static) visualizer(type, data) → {Object}

Parameters:
Name Type Description
type String

either column or line chart

data Array.<Object>

n-d array containing the data to render

Source:
Returns:

creates a div on screen that renders the graph using HydroLang's visualize module.

Type
Object