You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2022/04/03 16:09:37 UTC
[sis] 01/03: Store ASCII Grid data as single (instead of double) precision floating point values.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 7d3a1bcb9f3316bd45c52183334b0a748bc7e7c4
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Sun Apr 3 15:51:33 2022 +0200
Store ASCII Grid data as single (instead of double) precision floating point values.
---
.../main/java/org/apache/sis/internal/storage/ascii/Store.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ascii/Store.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ascii/Store.java
index 4b119fe..d67738f 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ascii/Store.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ascii/Store.java
@@ -22,7 +22,7 @@ import java.util.Optional;
import java.util.StringJoiner;
import java.io.IOException;
import java.nio.file.StandardOpenOption;
-import java.awt.image.DataBufferDouble;
+import java.awt.image.DataBufferFloat;
import org.opengis.geometry.Envelope;
import org.opengis.metadata.Metadata;
import org.opengis.metadata.maintenance.ScopeCode;
@@ -378,7 +378,7 @@ cellsize: if (value != null) {
final CharactersView view = input();
final String filename = view.input.filename;
final Statistics stats = new Statistics(filename);
- final double[] data = new double[width * height];
+ final float[] data = new float[width * height];
for (int i=0; i < data.length; i++) {
final String token = view.readToken();
double value;
@@ -395,7 +395,7 @@ cellsize: if (value != null) {
Resources.Keys.CanNotReadPixel_3, i % width, i / width, filename), e);
}
}
- data[i] = value;
+ data[i] = (float) value;
stats.accept(value); // Need to invoke even for NaN values (because we count them).
}
/*
@@ -422,7 +422,7 @@ cellsize: if (value != null) {
coverage = new GridCoverageBuilder()
.addRange(band)
.setDomain(gridGeometry)
- .setValues(new DataBufferDouble(data, data.length), null)
+ .setValues(new DataBufferFloat(data, data.length), null)
.addImageProperty(PlanarImage.STATISTICS_KEY, new Statistics[] {stats})
.build();
} catch (DataStoreException e) {