Package uk.ac.rdg.resc.edal.dataset
Class TrajectoryDataset
- java.lang.Object
-
- uk.ac.rdg.resc.edal.dataset.AbstractDataset
-
- uk.ac.rdg.resc.edal.dataset.AbstractContinuousDomainDataset
-
- uk.ac.rdg.resc.edal.dataset.TrajectoryDataset
-
- All Implemented Interfaces:
Serializable,ContinuousDomainDataset,Dataset
- Direct Known Subclasses:
FakeTrajectoryDatasetFactory.FakeTrajectoryDataset
public class TrajectoryDataset extends AbstractContinuousDomainDataset
ADatasetwhich contains onlyTrajectoryFeatures.- Author:
- Guy Griffiths
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class uk.ac.rdg.resc.edal.dataset.AbstractContinuousDomainDataset
featureIndexer
-
Fields inherited from class uk.ac.rdg.resc.edal.dataset.AbstractDataset
id, plugins, vars
-
-
Constructor Summary
Constructors Constructor Description TrajectoryDataset(String id, List<VariableMetadata> vars, DiscreteFeatureReader<TrajectoryFeature> featureReader, FeatureIndexer indexer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<TrajectoryFeature>extractMapFeatures(Set<String> varIds, BoundingBox bbox, Extent<Double> zExtent, Double targetZ, Extent<org.joda.time.DateTime> tExtent, org.joda.time.DateTime targetT)Extracts trajectory features which cross the given 4d area.List<? extends ProfileFeature>extractProfileFeatures(Set<String> varIds, BoundingBox bbox, Extent<Double> zExtent, Extent<org.joda.time.DateTime> tExtent, HorizontalPosition targetPos, org.joda.time.DateTime targetTime)ExtractsProfileFeature(s) from theDatasetList<? extends PointSeriesFeature>extractTimeseriesFeatures(Set<String> varIds, BoundingBox bbox, Extent<Double> zExtent, Extent<org.joda.time.DateTime> tExtent, HorizontalPosition targetPos, Double targetZ)ExtractsPointSeriesFeature(s) from theDatasetprotected BoundingBoxgetDatasetBoundingBox()protected Extent<org.joda.time.DateTime>getDatasetTimeExtent()protected Extent<Double>getDatasetVerticalExtent()Set<String>getFeatureIds()DiscreteFeatureReader<? extends DiscreteFeature<?,?>>getFeatureReader()Class<? extends DiscreteFeature<?,?>>getFeatureType(String variableId)Determines the type of feature returned by theDataset.readFeature(String)method for a particular variable (feature ID)Class<? extends DiscreteFeature<?,?>>getMapFeatureType(String variableId)Determines the type of feature returned by the extractMapFeatures() methods (defined in subclasses) for a particular variableTrajectoryFeaturereadFeature(String featureId)Reads an entire feature from underlying storagebooleansupportsProfileFeatureExtraction(String varId)booleansupportsTimeseriesExtraction(String varId)-
Methods inherited from class uk.ac.rdg.resc.edal.dataset.AbstractDataset
addVariablePlugin, getId, getTopLevelVariables, getVariableIds, getVariableMetadata, isDerivedVariable
-
-
-
-
Constructor Detail
-
TrajectoryDataset
public TrajectoryDataset(String id, List<VariableMetadata> vars, DiscreteFeatureReader<TrajectoryFeature> featureReader, FeatureIndexer indexer)
-
-
Method Detail
-
getFeatureIds
public Set<String> getFeatureIds()
- Specified by:
getFeatureIdsin interfaceDataset- Overrides:
getFeatureIdsin classAbstractContinuousDomainDataset- Returns:
- the IDs of features which are present in this Dataset
-
getFeatureType
public Class<? extends DiscreteFeature<?,?>> getFeatureType(String variableId)
Description copied from interface:DatasetDetermines 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
Features returned when calling theDataset.readFeature(java.lang.String)method for the same variable ID
-
getMapFeatureType
public Class<? extends DiscreteFeature<?,?>> getMapFeatureType(String variableId)
Description copied from interface:DatasetDetermines the type of feature returned by the extractMapFeatures() methods (defined in subclasses) for a particular variable- Parameters:
variableId- The ID of the variable- Returns:
- The class of the
Features returned when calling the extractMapFeatures method for the given variable ID
-
readFeature
public TrajectoryFeature readFeature(String featureId) throws DataReadingException, VariableNotFoundException
Description copied from interface:DatasetReads an entire feature from underlying storage- Specified by:
readFeaturein interfaceDataset- Overrides:
readFeaturein classAbstractContinuousDomainDataset- Parameters:
featureId- The ID of the feature to read- Returns:
- The resulting
Feature - Throws:
VariableNotFoundException- If the requested feature is not foundDataReadingException
-
extractMapFeatures
public List<TrajectoryFeature> extractMapFeatures(Set<String> varIds, BoundingBox bbox, Extent<Double> zExtent, Double targetZ, Extent<org.joda.time.DateTime> tExtent, org.joda.time.DateTime targetT)
Extracts trajectory features which cross the given 4d area. Note that this just detects overlaps in the bounding boxes. There is no guarantee that any of the returned features are actually within the area, just that their bounding boxes cross.- Specified by:
extractMapFeaturesin interfaceContinuousDomainDataset- Overrides:
extractMapFeaturesin classAbstractContinuousDomainDataset- Parameters:
varIds- The required variable IDsbbox- TheBoundingBoxwhich features should crosszExtent- The vertical extent which features should be partially contained withintExtent- The time extent which features should be partially contained within- Returns:
- A
Collectionof the desiredTrajectoryFeatures
-
extractProfileFeatures
public List<? extends ProfileFeature> extractProfileFeatures(Set<String> varIds, BoundingBox bbox, Extent<Double> zExtent, Extent<org.joda.time.DateTime> tExtent, HorizontalPosition targetPos, org.joda.time.DateTime targetTime) throws DataReadingException, UnsupportedOperationException, VariableNotFoundException
Description copied from interface:DatasetExtractsProfileFeature(s) from theDataset- Specified by:
extractProfileFeaturesin interfaceDataset- Overrides:
extractProfileFeaturesin classAbstractContinuousDomainDataset- Parameters:
varIds- The variable IDs to extract. If this isnullthen all variable IDs will be plotted. Any non-scalar parent variables will have all of their child variables extracted.bbox-- If this
BoundingBoxis non-null, all measurements falling within it will be returned. - If it is
null, only measurements which match the horizontal position given bytargetPoswill be extracted. - If both
bboxandtargetPosarenullno constraint is placed on horizontal positions - e.g. for a gridded field a profile will be returned for every horizontal grid point.
- If this
zExtent-- If this is non-
null, allProfileFeatures whose domains have any intersection with this vertical extent will be extracted. The domains of the extractedProfileFeatures will be the entire available domains, not just the intersection. - If this is
null, no constraint will be placed on the vertical domain of theProfileFeatures to extract.
- If this is non-
tExtent-- If this is non-
null, all measurements which fall entirely within its extent will be extracted - If it is
nullonly profiles matching the time specified bytargetTwill be extracted. - If
tExtentandtargetTare bothnull,ProfileFeatures for all available time values will be extracted.
- If this is non-
targetPos-- If the
bboxargument isnull, only measurements which match this horizontal position will be extracted. In the case of a gridded feature, this will be the profile of the grid cell which the position falls into, but for a dataset with a continuousHorizontalDomainonly exact matches will be extracted - If both
bboxandtargetPosarenullno constraint is placed on horizontal positions - e.g. for a gridded field a profile will be returned for every horizontal grid point. - If this is non-
null, the resultingCollectionwill be sorted according to distance (in co-ordinate units) from the target position
- If the
targetTime-- If
tExtentisnullonly profiles matching the time specified by this parameter will be extracted. In the case of a gridded dataset a time is considered to match if the methodTimeAxis#contains(DateTime)on its time axis returnstruefor the target time. For a non-gridded dataset, the feature time must exactly match the target time. - If
tExtentandtargetTare bothnull,ProfileFeatures for all available time values will be extracted.
- If
- Returns:
- A
CollectionofProfileFeatures, sorted by their distance from the target horizontal position, if it exists. - Throws:
DataReadingException- if there is a problem reading the underlying dataUnsupportedOperationException- if not all of the requested variables have a vertical domainVariableNotFoundException- if one or more of the specified variables are not present in this dataset
-
supportsProfileFeatureExtraction
public boolean supportsProfileFeatureExtraction(String varId)
- Parameters:
varId- The ID of the variable to extract- Returns:
trueif this dataset supports the extraction of the given variable toProfileFeatures via theDataset.extractProfileFeatures(Set, BoundingBox, Extent, Extent, HorizontalPosition, DateTime)method
-
extractTimeseriesFeatures
public List<? extends PointSeriesFeature> extractTimeseriesFeatures(Set<String> varIds, BoundingBox bbox, Extent<Double> zExtent, Extent<org.joda.time.DateTime> tExtent, HorizontalPosition targetPos, Double targetZ) throws DataReadingException, UnsupportedOperationException, VariableNotFoundException
Description copied from interface:DatasetExtractsPointSeriesFeature(s) from theDataset- Specified by:
extractTimeseriesFeaturesin interfaceDataset- Overrides:
extractTimeseriesFeaturesin classAbstractContinuousDomainDataset- Parameters:
varIds- The variable IDs to extract. If this isnullthen all variable IDs will be plotted. Any non-scalar parent variables will have all of their child variables extracted.bbox-- If this
BoundingBoxis non-null, all measurements falling within it will be returned. - If it is
null, only measurements which match the horizontal position given bytargetPoswill be extracted. - If both
bboxandtargetPosarenullno constraint is placed on horizontal positions - e.g. for a gridded field a profile will be returned for every horizontal grid point.
- If this
zExtent-- If this is non-
null, all measurements which fall entirely within its extent will be extracted - If it is
nullonly timeseries matching the depth specified bytargetZwill be extracted. - If
zExtentandtargetZare bothnull,PointSeriesFeatures for all available depth values will be extracted.
- If this is non-
tExtent-- If this is non-
null, allPointSeriesFeatures whose domains have any intersection with this time extent will be extracted. The domains of the extractedPointSeriesFeatures will be the entire available domains, not just the intersection. - If this is
null, no constraint will be placed on the time domain of thePointSeriesFeatures to extract.
- If this is non-
targetPos-- If the
bboxargument isnull, only measurements which match this horizontal position will be extracted. In the case of a gridded feature, this will be the profile of the grid cell which the position falls into, but for a dataset with a continuousHorizontalDomainonly exact matches will be extracted - If both
bboxandtargetPosarenullno constraint is placed on horizontal positions - e.g. for a gridded field a profile will be returned for every horizontal grid point. - If this is non-
null, the resultingCollectionwill be sorted according to distance (in co-ordinate units) from the target position
- If the
targetZ-- If
zExtentisnullonly timeseries matching the depth specified by this parameter will be extracted. In the case of a gridded dataset a depth is considered to match if the methodVerticalAxis#contains(Double)on its vertical axis returnstruefor the target depth. For a non-gridded dataset, the feature depth must exactly match the target depth. - If
zExtentandtargetZare bothnull,PointSeriesFeatures for all available time values will be extracted.
- If
- Returns:
- A
CollectionofPointSeriesFeatures, sorted by their distance from the target horizontal position, if it exists. - Throws:
DataReadingException- if there is a problem reading the underlying dataUnsupportedOperationException- if not all of the requested variables have a time domainVariableNotFoundException- if one or more of the specified variables are not present in this dataset
-
supportsTimeseriesExtraction
public boolean supportsTimeseriesExtraction(String varId)
- Parameters:
varId- The ID of the variable to extract- Returns:
trueif this dataset supports the extraction of the given variable toPointSeriesFeatures via theDataset.extractTimeseriesFeatures(Set, BoundingBox, Extent, Extent, HorizontalPosition, Double)method
-
getDatasetBoundingBox
protected BoundingBox getDatasetBoundingBox()
- Specified by:
getDatasetBoundingBoxin classAbstractContinuousDomainDataset- Returns:
- The
BoundingBoxof the entire dataset
-
getDatasetVerticalExtent
protected Extent<Double> getDatasetVerticalExtent()
- Specified by:
getDatasetVerticalExtentin classAbstractContinuousDomainDataset- Returns:
- The
Extentof the vertical domain for the entire dataset
-
getDatasetTimeExtent
protected Extent<org.joda.time.DateTime> getDatasetTimeExtent()
- Specified by:
getDatasetTimeExtentin classAbstractContinuousDomainDataset- Returns:
- The
Extentof the time domain for the entire dataset
-
getFeatureReader
public DiscreteFeatureReader<? extends DiscreteFeature<?,?>> getFeatureReader()
- Specified by:
getFeatureReaderin classAbstractContinuousDomainDataset
-
-