Package uk.ac.rdg.resc.edal.dataset
Class DiscreteLayeredDataset<DS extends DataSource,VM extends DiscreteLayeredVariableMetadata>
- java.lang.Object
-
- uk.ac.rdg.resc.edal.dataset.AbstractDataset
-
- uk.ac.rdg.resc.edal.dataset.HorizontallyDiscreteDataset<DS>
-
- uk.ac.rdg.resc.edal.dataset.DiscreteLayeredDataset<DS,VM>
-
- Type Parameters:
DS
- The type ofDataSource
which will read the underlying dataVM
- The type ofDiscreteLayeredVariableMetadata
which will describe the non-derived variables in thisDataset
- All Implemented Interfaces:
Serializable
,Dataset
- Direct Known Subclasses:
GriddedDataset
,HorizontalMesh4dDataset
public abstract class DiscreteLayeredDataset<DS extends DataSource,VM extends DiscreteLayeredVariableMetadata> extends HorizontallyDiscreteDataset<DS> implements Serializable
A partial implementation of anHorizontallyDiscreteDataset
based on a 4D dataset where the z- and t-dimensions are discrete axes. The horizontal dimension is not necessarily separable into 2 axes. This class is a parent class for bothGriddedDataset
(a full 4d grid) andHorizontalMesh4dDataset
(a 4d grid where the horizontal layers are unstructured)- Author:
- Guy Griffiths, Jon Blower
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class uk.ac.rdg.resc.edal.dataset.HorizontallyDiscreteDataset
HorizontallyDiscreteDataset.PointSeriesLocation, HorizontallyDiscreteDataset.ProfileLocation
-
-
Field Summary
-
Fields inherited from class uk.ac.rdg.resc.edal.dataset.AbstractDataset
id, plugins, vars
-
-
Constructor Summary
Constructors Constructor Description DiscreteLayeredDataset(String id, Collection<VM> vars)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Array2D<Number>
extractHorizontalData(VM metadata, int tIndex, int zIndex, HorizontalGrid targetGrid, DS dataSource)
Extracts data corresponding to aHorizontalGrid
protected abstract Number
extractPoint(VM metadata, int t, int z, HorizontalPosition hPos, DS dataSource)
Extract data at a pointprotected abstract Array1D<Number>
extractProfileData(VM metadata, List<Integer> zs, int tIndex, HorizontalPosition hPos, DS dataSource)
Extracts data corresponding to a vertical profileprotected abstract Array1D<Number>
extractTimeseriesData(VM metadata, List<Integer> ts, int zIndex, HorizontalPosition hPos, DS dataSource)
Extracts data corresponding to a time seriesClass<MapFeature>
getMapFeatureType(String variableId)
Determines the type of feature returned by the extractMapFeatures() methods (defined in subclasses) for a particular variableVM
getVariableMetadata(String variableId)
Returns theVariableMetadata
associated with a particular variable IDprotected Array2D<Number>
readUnderlyingHorizontalData(String varId, MapDomain domain, DS dataSource)
Reads horizontal data for a non-derived variableprotected Number
readUnderlyingPointData(String varId, HorizontalPosition hPos, Double zVal, org.joda.time.DateTime time, DS dataSource)
Reads a single point for a non-derived variableprotected Map<HorizontallyDiscreteDataset.PointSeriesLocation,Array1D<Number>>
readUnderlyingTemporalData(String varId, TimeAxis tAxis, BoundingBox bbox, Double targetZ, Extent<Double> zExtent, DS dataSource)
Reads timeseries data for a given non-derived variableprotected Map<HorizontallyDiscreteDataset.ProfileLocation,Array1D<Number>>
readUnderlyingVerticalData(String varId, VerticalAxis zAxis, BoundingBox bbox, org.joda.time.DateTime targetT, Extent<org.joda.time.DateTime> tExtent, DS dataSource)
Reads profile data for a given non-derived variable-
Methods inherited from class uk.ac.rdg.resc.edal.dataset.HorizontallyDiscreteDataset
extractMapFeatures, extractPointCollection, extractProfileFeatures, extractTimeseriesFeatures, extractTrajectoryFeature, getFeatureIds, getTimeIndex, getVerticalIndex, openDataSource, readSinglePoint, supportsProfileFeatureExtraction, supportsTimeseriesExtraction
-
Methods inherited from class uk.ac.rdg.resc.edal.dataset.AbstractDataset
addVariablePlugin, getId, getTopLevelVariables, getVariableIds, isDerivedVariable
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface uk.ac.rdg.resc.edal.dataset.Dataset
getFeatureType, readFeature
-
-
-
-
Constructor Detail
-
DiscreteLayeredDataset
public DiscreteLayeredDataset(String id, Collection<VM> vars)
-
-
Method Detail
-
readUnderlyingHorizontalData
protected final Array2D<Number> readUnderlyingHorizontalData(String varId, MapDomain domain, DS dataSource) throws DataReadingException, VariableNotFoundException
Description copied from class:HorizontallyDiscreteDataset
Reads horizontal data for a non-derived variable- Specified by:
readUnderlyingHorizontalData
in classHorizontallyDiscreteDataset<DS extends DataSource>
- Parameters:
varId
- The ID of the variable to readdomain
- TheMapDomain
on which to read datadataSource
- TheHorizontallyDiscreteDataset
to read data from- Returns:
- An
Array2D
containing the data corresponding to the suppliedMapDomain
- Throws:
DataReadingException
- If there is a problem reading the dataVariableNotFoundException
- If the requested variable is not present in theDataset
-
readUnderlyingVerticalData
protected final Map<HorizontallyDiscreteDataset.ProfileLocation,Array1D<Number>> readUnderlyingVerticalData(String varId, VerticalAxis zAxis, BoundingBox bbox, org.joda.time.DateTime targetT, Extent<org.joda.time.DateTime> tExtent, DS dataSource) throws DataReadingException, VariableNotFoundException
Description copied from class:HorizontallyDiscreteDataset
Reads profile data for a given non-derived variable- Specified by:
readUnderlyingVerticalData
in classHorizontallyDiscreteDataset<DS extends DataSource>
- Parameters:
varId
- The of the variable to read data forzAxis
- The desired vertical axis of the databbox
- TheBoundingBox
within which to read profilestargetT
- The target time at which to read profilestExtent
- The timeExtent
within which to read profilesdataSource
- TheDataSource
to read from- Returns:
- A
Map
of unique profile locations to data for each - Throws:
DataReadingException
- If there was a problem reading data from theDataSource
VariableNotFoundException
- If the requested variable is not present in theDataset
-
readUnderlyingTemporalData
protected final Map<HorizontallyDiscreteDataset.PointSeriesLocation,Array1D<Number>> readUnderlyingTemporalData(String varId, TimeAxis tAxis, BoundingBox bbox, Double targetZ, Extent<Double> zExtent, DS dataSource) throws DataReadingException, VariableNotFoundException
Description copied from class:HorizontallyDiscreteDataset
Reads timeseries data for a given non-derived variable- Specified by:
readUnderlyingTemporalData
in classHorizontallyDiscreteDataset<DS extends DataSource>
- Parameters:
varId
- The of the variable to read data fortAxis
- The desired time axis of the databbox
- TheBoundingBox
within which to read timeseriestargetZ
- The target depth to read timeseries atzExtent
- The verticalExtent
within which to read timeseriesdataSource
- TheDataSource
to read from- Returns:
- A
Map
of unique profile locations to data for each - Throws:
DataReadingException
- If there was a problem reading data from theDataSource
VariableNotFoundException
- If the requested variable is not present in theDataset
-
readUnderlyingPointData
protected final Number readUnderlyingPointData(String varId, HorizontalPosition hPos, Double zVal, org.joda.time.DateTime time, DS dataSource) throws DataReadingException, VariableNotFoundException
Description copied from class:HorizontallyDiscreteDataset
Reads a single point for a non-derived variable- Specified by:
readUnderlyingPointData
in classHorizontallyDiscreteDataset<DS extends DataSource>
- Parameters:
varId
- The ID of the variable to readhPos
- TheHorizontalPosition
at which to read the datazVal
- The z-position to read attime
- The time to read atdataSource
- TheDataSource
to read from- Returns:
- The value of the data, or
null
if there is no data there - Throws:
DataReadingException
- If there is a problem reading the dataVariableNotFoundException
- If the requested variable is not present in theDataset
-
getMapFeatureType
public Class<MapFeature> getMapFeatureType(String variableId)
Description copied from interface:Dataset
Determines the type of feature returned by the extractMapFeatures() methods (defined in subclasses) for a particular variable- Specified by:
getMapFeatureType
in interfaceDataset
- Parameters:
variableId
- The ID of the variable- Returns:
- The class of the
Feature
s returned when calling the extractMapFeatures method for the given variable ID
-
getVariableMetadata
public VM getVariableMetadata(String variableId) throws VariableNotFoundException
Description copied from interface:Dataset
Returns theVariableMetadata
associated with a particular variable ID- Specified by:
getVariableMetadata
in interfaceDataset
- Overrides:
getVariableMetadata
in classAbstractDataset
- Parameters:
variableId
- The variable ID to search for- Returns:
- The desired
VariableMetadata
- Throws:
VariableNotFoundException
- If the requested variable is not available
-
extractHorizontalData
protected abstract Array2D<Number> extractHorizontalData(VM metadata, int tIndex, int zIndex, HorizontalGrid targetGrid, DS dataSource) throws DataReadingException
Extracts data corresponding to aHorizontalGrid
- Parameters:
metadata
- TheDiscreteLayeredVariableMetadata
object representing the variable to extract data fortIndex
- The time index at which to extract datazIndex
- The z index at which to extract datatargetGrid
- TheHorizontalGrid
to extract data ontodataSource
- TheDataSource
used to extract data- Returns:
- An
Array2D
containing data which should map onto the requestedHorizontalGrid
- Throws:
DataReadingException
- If there is a problem reading the underlying data
-
extractProfileData
protected abstract Array1D<Number> extractProfileData(VM metadata, List<Integer> zs, int tIndex, HorizontalPosition hPos, DS dataSource) throws DataReadingException
Extracts data corresponding to a vertical profile- Parameters:
metadata
- TheDiscreteLayeredVariableMetadata
object representing the variable to extract data forzs
- AList
of integer z-indices at which to extract datatIndex
- The time index at which to extract datahPos
- TheHorizontalPosition
at which to extract datadataSource
- TheDataSource
used to extract data- Returns:
- An
Array1D
containing data which should map onto the requested list of indices - Throws:
DataReadingException
- If there is a problem reading the underlying data
-
extractTimeseriesData
protected abstract Array1D<Number> extractTimeseriesData(VM metadata, List<Integer> ts, int zIndex, HorizontalPosition hPos, DS dataSource) throws DataReadingException
Extracts data corresponding to a time series- Parameters:
metadata
- TheDiscreteLayeredVariableMetadata
object representing the variable to extract data forts
- AList
of integer t-indices at which to extract datazIndex
- The z-index at which to extract datahPos
- TheHorizontalPosition
at which to extract datadataSource
- TheDataSource
used to extract data- Returns:
- An
Array1D
containing data which should map onto the requested list of indices - Throws:
DataReadingException
- If there is a problem reading the underlying data
-
extractPoint
protected abstract Number extractPoint(VM metadata, int t, int z, HorizontalPosition hPos, DS dataSource) throws DataReadingException
Extract data at a point- Parameters:
metadata
- TheDiscreteLayeredVariableMetadata
object representing the variable to extract data fort
- The t-index at which to extract dataz
- The z-index at which to extract datahPos
- TheHorizontalPosition
at which to extract datadataSource
- TheDataSource
used to extract data- Returns:
- The value of the data at the specified point
- Throws:
DataReadingException
- If there is a problem reading the underlying data
-
-