Object
MergeStrategy
Algorithm to apply when more than one grid coverage can be found at the same grid index.
A merge may happen if an aggregated coverage is created with
CoverageAggregator
,
and the extent of some source coverages are overlapping in the dimension to aggregate.
Example
A collection ofGridCoverage
instances may represent the same phenomenon
(for example Sea Surface Temperature) over the same geographic area but at different dates and times.
CoverageAggregator
can be used for building a single data cube with a time axis.
But if two coverages have overlapping time ranges, and if a user request data in the overlapping region,
then the aggregated coverages have more than one source coverages capable to provide the requested data.
This enumeration specify how to handle this multiplicity.
Default behavior
If no merge strategy is specified, then the default behavior is to throwSubspaceNotSpecifiedException
when the GridCoverage.render(GridExtent)
method
is invoked and more than one source coverage (slice) is found for a specified grid index.- Since:
- 1.3
-
Method Summary
Modifier and TypeMethodDescriptionReturns a resource with same data than specified resource but using this merge strategy.static MergeStrategy
selectByTimeThenArea
(Duration timeGranularity) Selects a single slice using criteria based first on temporal extent, then on geographic area.Returns a string representation of this strategy for debugging purposes.
-
Method Details
-
selectByTimeThenArea
Selects a single slice using criteria based first on temporal extent, then on geographic area. This strategy applies the following rules, in order:- Slice having largest intersection with the time of interest (TOI) is selected.
- If two or more slices have the same intersection with TOI, then the one with less "overtime" (time outside TOI) is selected.
- If two or more slices are considered equal after above criteria, then the one best centered on the TOI is selected.
Rational: the "smallest time outside" criterion (rule 2) is before "best centered" criterion (rule 3) because of the following scenario: if a user specifies a "time of interest" (TOI) of 1 day and if there is two slices intersecting the TOI, with one slice being a raster of monthly averages the other slice being a raster of daily data, we want the daily data to be selected even if by coincidence the monthly averages is better centered.If thetimeGranularity
argument is non-null, then intersections with TOI will be rounded to an integer amount of the specified granularity and the last criterion in above list is relaxed. This is useful when data are expected at an approximately regular time interval (for example one remote sensing image per day) and we want to ignore slight variations in the temporal extent declared for each image.If there is no time of interest, or the slices do not declare time range, or some slices are still at equality after application of above criteria, then the selection continues on the basis of geographic criteria:
- Largest intersection with the area of interest (AOI) is selected.
- If two or more slices have the same intersection area with AOI, then the one with the less "irrelevant" material is selected. "Irrelevant" material are area outside the AOI.
- If two or more slices are considered equal after above criteria, the one best centered on the AOI is selected.
- If two or more slices are considered equal after above criteria, then the first of those candidates is selected.
Limitations
Current implementation does not check the vertical dimension. This check may be added in a future version.- Parameters:
timeGranularity
- the temporal granularity of the Time of Interest (TOI), ornull
if none.- Returns:
- a merge strategy for selecting a slice based on temporal criteria first.
-
apply
Returns a resource with same data than specified resource but using this merge strategy. If the given resource is an instance created byCoverageAggregator
and uses a different strategy, then a new resource using this merge strategy is returned. Otherwise the given resource is returned as-is. The returned resource will share the same resources and caches than the given resource.- Parameters:
resource
- the resource for which to update the merge strategy, ornull
.- Returns:
- resource with updated merge strategy, or
null
if the given resource was null.
-
toString
Returns a string representation of this strategy for debugging purposes.
-