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 ofDataSourcewhich will read the underlying dataVM- The type ofDiscreteLayeredVariableMetadatawhich 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 anHorizontallyDiscreteDatasetbased 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 aHorizontalGridprotected abstract NumberextractPoint(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 variableVMgetVariableMetadata(String variableId)Returns theVariableMetadataassociated with a particular variable IDprotected Array2D<Number>readUnderlyingHorizontalData(String varId, MapDomain domain, DS dataSource)Reads horizontal data for a non-derived variableprotected NumberreadUnderlyingPointData(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:HorizontallyDiscreteDatasetReads horizontal data for a non-derived variable- Specified by:
readUnderlyingHorizontalDatain classHorizontallyDiscreteDataset<DS extends DataSource>- Parameters:
varId- The ID of the variable to readdomain- TheMapDomainon which to read datadataSource- TheHorizontallyDiscreteDatasetto read data from- Returns:
- An
Array2Dcontaining 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:HorizontallyDiscreteDatasetReads profile data for a given non-derived variable- Specified by:
readUnderlyingVerticalDatain classHorizontallyDiscreteDataset<DS extends DataSource>- Parameters:
varId- The of the variable to read data forzAxis- The desired vertical axis of the databbox- TheBoundingBoxwithin which to read profilestargetT- The target time at which to read profilestExtent- The timeExtentwithin which to read profilesdataSource- TheDataSourceto read from- Returns:
- A
Mapof unique profile locations to data for each - Throws:
DataReadingException- If there was a problem reading data from theDataSourceVariableNotFoundException- 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:HorizontallyDiscreteDatasetReads timeseries data for a given non-derived variable- Specified by:
readUnderlyingTemporalDatain classHorizontallyDiscreteDataset<DS extends DataSource>- Parameters:
varId- The of the variable to read data fortAxis- The desired time axis of the databbox- TheBoundingBoxwithin which to read timeseriestargetZ- The target depth to read timeseries atzExtent- The verticalExtentwithin which to read timeseriesdataSource- TheDataSourceto read from- Returns:
- A
Mapof unique profile locations to data for each - Throws:
DataReadingException- If there was a problem reading data from theDataSourceVariableNotFoundException- 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:HorizontallyDiscreteDatasetReads a single point for a non-derived variable- Specified by:
readUnderlyingPointDatain classHorizontallyDiscreteDataset<DS extends DataSource>- Parameters:
varId- The ID of the variable to readhPos- TheHorizontalPositionat which to read the datazVal- The z-position to read attime- The time to read atdataSource- TheDataSourceto read from- Returns:
- The value of the data, or
nullif 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:DatasetDetermines the type of feature returned by the extractMapFeatures() methods (defined in subclasses) for a particular variable- Specified by:
getMapFeatureTypein interfaceDataset- Parameters:
variableId- The ID of the variable- Returns:
- The class of the
Features returned when calling the extractMapFeatures method for the given variable ID
-
getVariableMetadata
public VM getVariableMetadata(String variableId) throws VariableNotFoundException
Description copied from interface:DatasetReturns theVariableMetadataassociated with a particular variable ID- Specified by:
getVariableMetadatain interfaceDataset- Overrides:
getVariableMetadatain 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- TheDiscreteLayeredVariableMetadataobject representing the variable to extract data fortIndex- The time index at which to extract datazIndex- The z index at which to extract datatargetGrid- TheHorizontalGridto extract data ontodataSource- TheDataSourceused to extract data- Returns:
- An
Array2Dcontaining 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- TheDiscreteLayeredVariableMetadataobject representing the variable to extract data forzs- AListof integer z-indices at which to extract datatIndex- The time index at which to extract datahPos- TheHorizontalPositionat which to extract datadataSource- TheDataSourceused to extract data- Returns:
- An
Array1Dcontaining 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- TheDiscreteLayeredVariableMetadataobject representing the variable to extract data forts- AListof integer t-indices at which to extract datazIndex- The z-index at which to extract datahPos- TheHorizontalPositionat which to extract datadataSource- TheDataSourceused to extract data- Returns:
- An
Array1Dcontaining 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- TheDiscreteLayeredVariableMetadataobject representing the variable to extract data fort- The t-index at which to extract dataz- The z-index at which to extract datahPos- TheHorizontalPositionat which to extract datadataSource- TheDataSourceused to extract data- Returns:
- The value of the data at the specified point
- Throws:
DataReadingException- If there is a problem reading the underlying data
-
-