Package uk.ac.rdg.resc.edal.dataset
Class GriddedDataset
- 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<GridDataSource,GridVariableMetadata>
-
- uk.ac.rdg.resc.edal.dataset.GriddedDataset
-
- All Implemented Interfaces:
Serializable
,Dataset
- Direct Known Subclasses:
HydromodelVtkGridDataset
public abstract class GriddedDataset extends DiscreteLayeredDataset<GridDataSource,GridVariableMetadata>
A partial implementation of aDataset
based on a 4D grid, using aGridDataSource
and aDataReadingStrategy
.- 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 GriddedDataset(String id, Collection<GridVariableMetadata> vars)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Array2D<Number>
extractHorizontalData(GridVariableMetadata metadata, int tIndex, int zIndex, HorizontalGrid targetGrid, GridDataSource dataSource)
Extracts data corresponding to aHorizontalGrid
protected Number
extractPoint(GridVariableMetadata metadata, int t, int z, HorizontalPosition hPos, GridDataSource dataSource)
Extract data at a pointprotected Array1D<Number>
extractProfileData(GridVariableMetadata metadata, List<Integer> zs, int tIndex, HorizontalPosition hPos, GridDataSource dataSource)
Extracts data corresponding to a vertical profileprotected Array1D<Number>
extractTimeseriesData(GridVariableMetadata metadata, List<Integer> ts, int zIndex, HorizontalPosition hPos, GridDataSource dataSource)
Extracts data corresponding to a time seriesprotected abstract DataReadingStrategy
getDataReadingStrategy()
Class<GridFeature>
getFeatureType(String variableId)
Determines the type of feature returned by theDataset.readFeature(String)
method for a particular variable (feature ID)GridFeature
readFeature(String featureId)
Reads an entire feature from underlying storageGridFeature
subsetFeatures(Set<String> variables, BoundingBox hBox, Extent<Double> zExtent, Extent<org.joda.time.DateTime> tExtent)
Extracts a 4d subset of data from the dataset.-
Methods inherited from class uk.ac.rdg.resc.edal.dataset.DiscreteLayeredDataset
getMapFeatureType, getVariableMetadata, readUnderlyingHorizontalData, readUnderlyingPointData, readUnderlyingTemporalData, readUnderlyingVerticalData
-
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
-
-
-
-
Constructor Detail
-
GriddedDataset
public GriddedDataset(String id, Collection<GridVariableMetadata> vars)
-
-
Method Detail
-
getFeatureType
public Class<GridFeature> getFeatureType(String variableId)
Description copied from interface:Dataset
Determines the type of feature returned by theDataset.readFeature(String)
method for a particular variable (feature ID)- Parameters:
variableId
- The ID of the variable- Returns:
- The class of the
Feature
s returned when calling theDataset.readFeature(java.lang.String)
method for the same variable ID
-
readFeature
public GridFeature readFeature(String featureId) throws DataReadingException, VariableNotFoundException
Description copied from interface:Dataset
Reads an entire feature from underlying storage- Parameters:
featureId
- The ID of the feature to read- Returns:
- The resulting
Feature
- Throws:
VariableNotFoundException
- If the requested feature is not foundDataReadingException
-
subsetFeatures
public GridFeature subsetFeatures(Set<String> variables, BoundingBox hBox, Extent<Double> zExtent, Extent<org.joda.time.DateTime> tExtent) throws EdalException, IOException
Extracts a 4d subset of data from the dataset. All variables must share the same underlying grid, which must be rectilinear and CRS:84/EPSG:4326. Whilst limiting scope, this is useful in a large number of situations.- Parameters:
variables
- The variable IDs to extract into a featurehBox
- TheBoundingBox
in which to extract data. If this has zero height/width, data will be extracted at a point, with a horizontal domain consisting of 2 single-valued axes. Note that any extracted feature will use the underlying grid, so at least thisBoundingBox
will be extracted, but the actual area extracted may be larger, depending on where the cell boundaries lie.zExtent
- TheExtent
in the z-direction to subset. Ifnull
, all available z-values (if there are any) will be extractedtExtent
- TheExtent
in time to subset. Ifnull
, all available time values (if there are any) will be extracted- Returns:
- A new
GridFeature
whose domain - Throws:
EdalException
IOException
-
extractHorizontalData
protected Array2D<Number> extractHorizontalData(GridVariableMetadata metadata, int tIndex, int zIndex, HorizontalGrid targetGrid, GridDataSource dataSource)
Description copied from class:DiscreteLayeredDataset
Extracts data corresponding to aHorizontalGrid
- Specified by:
extractHorizontalData
in classDiscreteLayeredDataset<GridDataSource,GridVariableMetadata>
- 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
-
extractProfileData
protected Array1D<Number> extractProfileData(GridVariableMetadata metadata, List<Integer> zs, int tIndex, HorizontalPosition hPos, GridDataSource dataSource) throws DataReadingException
Description copied from class:DiscreteLayeredDataset
Extracts data corresponding to a vertical profile- Specified by:
extractProfileData
in classDiscreteLayeredDataset<GridDataSource,GridVariableMetadata>
- 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 Array1D<Number> extractTimeseriesData(GridVariableMetadata metadata, List<Integer> ts, int zIndex, HorizontalPosition hPos, GridDataSource dataSource) throws DataReadingException
Description copied from class:DiscreteLayeredDataset
Extracts data corresponding to a time series- Specified by:
extractTimeseriesData
in classDiscreteLayeredDataset<GridDataSource,GridVariableMetadata>
- 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 Number extractPoint(GridVariableMetadata metadata, int t, int z, HorizontalPosition hPos, GridDataSource dataSource) throws DataReadingException
Description copied from class:DiscreteLayeredDataset
Extract data at a point- Specified by:
extractPoint
in classDiscreteLayeredDataset<GridDataSource,GridVariableMetadata>
- 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
-
getDataReadingStrategy
protected abstract DataReadingStrategy getDataReadingStrategy()
-
-