Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -430,11 +430,18 @@ public boolean test(HMStacAsset asset) { // Assuming for now that "eo:bands" wou
HMRaster.MergeMode mergeMode = chooseMergeMode(targetSemantics, scope.getMonitor());
Envelope env = new Envelope(envelope.getMinX(), envelope.getMaxX(), envelope.getMinY(), envelope.getMaxY());
Polygon poly = GeometryUtilities.createPolygonFromEnvelope(env);
collection.setGeometryFilter(poly);
//collection.setGeometryFilter(poly);
// collection.setTimestampFilter(new Date(start.getMilliseconds()), new
// Date(end.getMilliseconds())); --> Filter later :)

GridCoverage2D coverage = null;

collection.setBboxFilter(new double[] {
bbox.get(0),
bbox.get(2),
bbox.get(1),
bbox.get(3)
});

// Allow transform ensures the process to finish, but I would not bet on the resulting
// data
Expand All @@ -456,7 +463,6 @@ public boolean test(HMStacAsset asset) { // Assuming for now that "eo:bands" wou
return;
}


List<HMStacItem> items = collection.searchItems();
if (items.isEmpty()) {
manager.close();
Expand Down Expand Up @@ -487,7 +493,7 @@ public boolean test(HMStacAsset asset) { // Assuming for now that "eo:bands" wou
// temporal filtering :( like ECDC
items = items.stream()
.filter(item -> isWithinRange(item, time.getStart().getMilliseconds(), time.getEnd().getMilliseconds()))
.collect(Collectors.toList());
.collect(Collectors.toList());

if (items.size() == 0) {
manager.close();
Expand Down Expand Up @@ -631,7 +637,8 @@ private boolean isWithinRange(HMStacItem item, long startMillis, long endMillis)
long itemEnd = LocalDateTime.parse(item.getEndTimestamp(), formatter).atZone(ZoneOffset.UTC).toInstant()
.toEpochMilli();

return startMillis >= itemStart && endMillis <= itemEnd;
return (startMillis >= itemStart || Math.abs(startMillis - itemStart) < 10000)
&& (endMillis <= itemEnd || Math.abs(endMillis - itemEnd) < 10000); // Allow some small tolerance

} catch (Exception e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ public Builder validate(String urn, URL url, IParameters<String> userData, IMoni
userData.put("s3EndpointUrl", "https://s3.waw3-1.cloudferro.com");
} else if (href.contains("waw4")) {
userData.put("s3EndpointUrl", "https://s3.waw4-1.cloudferro.com");
} else if (collectionUrl.contains("https://stac.dataspace.copernicus.eu/")){
userData.put("s3EndpointUrl", "https://eodata.dataspace.copernicus.eu/");
} else {
userData.put("s3EndpointUrl", "unknown");
}
Expand Down Expand Up @@ -143,6 +145,12 @@ private void generateCodeList(Builder builder, String assetId, JSONObject asset)
}

private Type readRasterDataType(JSONObject asset) {

if (asset.has("type")) {
if(asset.get("type").toString().contains("image/tiff")) { // Numbers
return Type.NUMBER;
}
}
if (!asset.has("raster:bands")) {
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<java.version>17</java.version>
<!-- Careful here: geotools must be right for hortonmachine to work; JTS
should be the same one that geotools and HM needs. -->
<geotools.version>34.0</geotools.version>
<geotools.version>34.4</geotools.version>
<hortonmachine.version>0.11.3-SNAPSHOT</hortonmachine.version>
<jts.version>1.20.0</jts.version>
<h2gis.version>1.5.0</h2gis.version>
Expand Down
Loading