meteoJS/modelviewer/resources . Resources
Source: modelviewer/
Linchpin of the modelviewer. In this class every available
resource is registered. Additionally requests about data per Variable can
be performed, like all available run times of a model or all available
fields of model, etc. The hierarchy via
Node
has to be defined before the construction of Resources.
Properties
Methods
new Resources()
Properties
availableVariablesMap Object with module:meteoJS/modelviewer/node.Node keys and Set containing module:meteoJS/modelviewer/variable.Variable properties
Map of nodes and their variables (contained in the variableCollection of the node). For each variable exists at least one resource in this Resources-object that is defined by this variable.
topNode module:meteoJS/modelviewer/variableCollection.VariableCollection
VariableCollectionNode that stand on the top of the hierarchy.
variableCollections Array of module:meteoJS/modelviewer/variableCollection.VariableCollection
Methods
_getTopMostChildWithAllVariables(variables, node, bubbleDown) → (undefined or module:meteoJS/modelviewer/node.Node)
Returns top most node for which on the way down (beginning from node) all variables are contained by the VariableCollections of the travelled nodes.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
variables |
Set containing module:meteoJS/modelviewer/variable.Variable |
|
Variables which have still to be found. |
node |
|
Node. |
|
bubbleDown |
boolean |
|
. |
- Returns
-
(undefined or module:meteoJS/modelviewer/node.Node)
Child node.
append(...resources) → module:meteoJS/modelviewer/resources.Resources
Append resources.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
resources |
|
Available resources. Value can be repeated. |
- Fires
- module:meteoJS/modelviewer/resources#change:resources
- Returns
appendImage() → module:meteoJS/modelviewer/resources.Resources
Appends an Image-resource. Alias for append(new Image(…)).
- See also
- module:meteoJS/modelviewer/resource/image.Image
- Returns
getAvailableVariables(variableCollection, options) → Set containing module:meteoJS/modelviewer/variable.Variable
Returns the Variable
-Objects
from the collection
with content. With this method
you can deactive for example the other variables, so the user can't select
a variable with no resource.
This means the method returns a subset from the passed collection. For
these Variable-Objects at least one resource is available (in the
node
of the collection or one of its children). The resources are defined by
on of these Variable-Objects. If you pass 'variables', you can
additionally constrain the returned variables. E.g. you look for all
run's with resources of a model, you pass the model's Variable-Object.
Parameters
Name | Type | Optional | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
variableCollection |
module:meteoJS/modelviewer/variableCollection.VariableCollection |
|
Return Variables of this VariableCollection. |
||||||||
options |
Object |
|
Options. Values in
|
- Returns
-
Set containing module:meteoJS/modelviewer/variable.Variable
Available variables.
getNodeByVariableCollection(variableCollection) → module:meteoJS/modelviewer/node.Node
Returns node which contains the passed variableCollection
Parameter
Name | Type | Optional | Description |
---|---|---|---|
variableCollection |
module:meteoJS/modelviewer/variableCollection.VariableCollection |
|
VariableCollection. |
- Returns
getNodeByVariableCollectionId(id) → module:meteoJS/modelviewer/node.Node
Returns node which contains the variableCollection with the passed Id.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
id |
mixed |
|
Id. |
- Returns
getTimesByVariables([options]) → Array of Date
Returns all times with at least one resource. The resources are defined by the passed variable. If exact=true, then the resources are exactly defined by the variables. With NWP models, you could get all times from a model-run with at least one resource when you pass the model and run variable object. If you want to know all available times for a set of variables (e.g. all available image-plots for the EU-region, from the temperature in a specific level), then pass exact=true and all the variables.
Parameters
Name | Type | Optional | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Yes |
Options. Values in
|
- Returns
-
Array of Date
- Sorted upwardly.
getTopMostNodeWithAllVariables(...variables) → module:meteoJS/modelviewer/node.Node
Returns a node of the hierarchy, so that all parents and itself contain all the passed variables. The returned node is the most top in hierarchy as possible. If no node is found, an empty node object is returned.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
variables |
|
Variables. Value can be repeated. |
- Returns
remove(...resources) → module:meteoJS/modelviewer/resources.Resources
Removes resources.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
resources |
|
Resources. Value can be repeated. |