You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by am...@apache.org on 2021/05/25 13:15:54 UTC
[sis] 01/01: fix(NetCDF): Ignore unrecognized dimensions early
instead of allowing creatiion of a dimensionless Feature set
This is an automated email from the ASF dual-hosted git repository.
amanin pushed a commit to branch fix/unrecognized_dimension
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 89719737cf54d5895822d863bd60d0a42645dbcf
Author: Alexis Manin <al...@geomatys.com>
AuthorDate: Tue May 25 15:13:40 2021 +0200
fix(NetCDF): Ignore unrecognized dimensions early instead of allowing creatiion of a dimensionless Feature set
---
.../src/main/java/org/apache/sis/internal/netcdf/FeatureSet.java | 9 +++++++++
.../src/main/java/org/apache/sis/internal/netcdf/Resources.java | 5 +++++
.../java/org/apache/sis/internal/netcdf/Resources.properties | 1 +
.../java/org/apache/sis/internal/netcdf/Resources_fr.properties | 1 +
4 files changed, 16 insertions(+)
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/FeatureSet.java b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/FeatureSet.java
index fbc5bd4..5b1505c 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/FeatureSet.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/FeatureSet.java
@@ -435,6 +435,15 @@ final class FeatureSet extends DiscreteSampling {
}
}
}
+
+ if (coordinates.isEmpty() && trajectory.isEmpty()) {
+ decoder.listeners.warning(decoder.resources().getString(
+ Resources.Keys.NoSupportedAxisForDimension_2,
+ featureName, decoder.getFilename()
+ ));
+ return;
+ }
+
/*
* Choose whether coordinates are taken in static or dynamic properties. Current implementation does not
* support mixing both modes (e.g. X and Y coordinates as static properties and T as dynamic property).
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.java b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.java
index 2cba062..4a5a395 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.java
@@ -163,6 +163,11 @@ public final class Resources extends IndexedResourceBundle {
public static final short MissingVariableAttribute_3 = 23;
/**
+ * Cannot find any valid axis for dimension {0} in file {1}.
+ */
+ public static final short NoSupportedAxisForDimension_2 = 27;
+
+ /**
* Variable “{1}” or netCDF file “{0}” has a different size than its coordinate system, but no
* resampling interval is specified.
*/
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.properties b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.properties
index f3ebbb8..4a63004 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.properties
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.properties
@@ -45,3 +45,4 @@ UnexpectedDimensionForVariable_4 = Variable \u201c{1}\u201d in file \u201c{0}\u
UnknownProjectionParameters_2 = Unknown projection parameters in file \u201c{0}\u201d: {1}
UnmappedDimensions_4 = Variable \u201c{1}\u201d in file \u201c{0}\u201d has {2,number} dimensions but only {3,number} can be associated to a coordinate reference system.
UnsupportedDataType_3 = NetCDF file \u201c{0}\u201d uses unsupported data type {2} for variable \u201c{1}\u201d.
+NoSupportedAxisForDimension_2 = Cannot find any valid axis for dimension {0} in file {1}.
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources_fr.properties b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources_fr.properties
index 10add51..d464723 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources_fr.properties
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources_fr.properties
@@ -50,3 +50,4 @@ UnexpectedDimensionForVariable_4 = La variable \u00ab\u202f{1}\u202f\u00bb dans
UnknownProjectionParameters_2 = Param\u00e8tres de projection inconnus dans le fichier \u00ab\u202f{0}\u202f\u00bb\u00a0: {1}
UnmappedDimensions_4 = La variable \u00ab\u202f{1}\u202f\u00bb dans le fichier \u00ab\u202f{0}\u202f\u00bb a {2,number} dimensions mais seulement {3,number} peuvent \u00eatre associ\u00e9es \u00e0 un syst\u00e8me de r\u00e9f\u00e9rence des coordonn\u00e9es.
UnsupportedDataType_3 = Le fichier netCDF \u00ab\u202f{0}\u202f\u00bb utilise un type de donn\u00e9es non-support\u00e9 {2} pour la variable \u00ab\u202f{1}\u202f\u00bb.
+NoSupportedAxisForDimension_2 = Aucun axe valide trouvé pour la dimension {0} dans le fichier {1}