Class VectorPlugin
- java.lang.Object
-
- uk.ac.rdg.resc.edal.dataset.plugins.VariablePlugin
-
- uk.ac.rdg.resc.edal.dataset.plugins.VectorPlugin
-
public class VectorPlugin extends VariablePlugin
A plugin to generate magnitude and direction fields from x- and y-components, and to group them logically. Direction fields are always generated as headings, in degrees, in WGS84 (i.e. lat-lon), regardless of the CRS of the original data.- Author:
- Guy Griffiths
-
-
Field Summary
Fields Modifier and Type Field Description static String
DIR_ROLE
static String
GROUP
static String
MAG_ROLE
-
Fields inherited from class uk.ac.rdg.resc.edal.dataset.plugins.VariablePlugin
prefixLength, uses
-
-
Constructor Summary
Constructors Constructor Description VectorPlugin(String xComponentId, String yComponentId, String commonName, boolean eastNorthComps)
Construct a newVectorPlugin
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected VariableMetadata[]
doProcessVariableMetadata(VariableMetadata... metadata)
Subclasses should override this method to modify theVariableMetadata
tree, and return any new objects added to it.protected Number
generateValue(String varSuffix, HorizontalPosition position, Number... sourceValues)
Subclasses should override this method to generate values based on source variable values-
Methods inherited from class uk.ac.rdg.resc.edal.dataset.plugins.VariablePlugin
combineIds, generateArray1D, generateArray2D, getFullId, getValue, newVariableMetadataFromDomains, newVariableMetadataFromMetadata, processVariableMetadata, providesVariables, usesVariables
-
-
-
-
Field Detail
-
MAG_ROLE
public static final String MAG_ROLE
- See Also:
- Constant Field Values
-
DIR_ROLE
public static final String DIR_ROLE
- See Also:
- Constant Field Values
-
GROUP
public static final String GROUP
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
VectorPlugin
public VectorPlugin(String xComponentId, String yComponentId, String commonName, boolean eastNorthComps)
Construct a newVectorPlugin
- Parameters:
xComponentId
- The ID of the variable representing the x-componentyComponentId
- The ID of the variable representing the y-componentcommonName
- The common part of the standard name of the quantity which the components represent. For example, for components with standard names eastward_sea_water_velocity and northward_sea_water_velocity this would most likely be "sea_water_velocity"eastNorthComps
-true
if the components supplied are eastwards/northwards (which may not necessarily be x/y components in the native grid system)
-
-
Method Detail
-
doProcessVariableMetadata
protected VariableMetadata[] doProcessVariableMetadata(VariableMetadata... metadata) throws EdalException
Description copied from class:VariablePlugin
Subclasses should override this method to modify theVariableMetadata
tree, and return any new objects added to it. This allows subclasses to arbitrarily restructure the metadata tree by calling theVariableMetadata.setParent(VariableMetadata, String)
methods. Note that the IDs in the newly-createdVariableMetadata
objects should be generated by callingVariablePlugin.getFullId(String)
with the variable's suffix. If the plugin is designed to group several child variables, the first child will be used to automatically estimate the scale range of the parent. This is guaranteed to only be called once.- Specified by:
doProcessVariableMetadata
in classVariablePlugin
- Parameters:
metadata
- An array ofVariableMetadata
of the source variables in the order they were supplied to the constructor- Returns:
- The derived
VariableMetadata
- Throws:
EdalException
- If there is a problem generating new metadata
-
generateValue
protected Number generateValue(String varSuffix, HorizontalPosition position, Number... sourceValues)
Description copied from class:VariablePlugin
Subclasses should override this method to generate values based on source variable values- Specified by:
generateValue
in classVariablePlugin
- Parameters:
varSuffix
- The suffix ID of the variable to generateVariableMetadata
for. This will be one of the provided suffixes in the constructor, but not the actual variable ID (which subclasses do not need to worry about)position
- TheHorizontalPosition
at which the value is generated. This may affect the returned valuesourceValues
- An array ofNumber
s representing the source values in the order they were supplied to the constructor- Returns:
- The derived value
-
-