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 2019/03/22 10:53:47 UTC

[sis] branch geoapi-4.0 updated: Bug fix: force initialization of UCAR coordinate systems.

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


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new 41ccf9c  Bug fix: force initialization of UCAR coordinate systems.
41ccf9c is described below

commit 41ccf9ccb3df4300a65e282842412b39fc8bc136
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Mar 22 11:52:30 2019 +0100

    Bug fix: force initialization of UCAR coordinate systems.
---
 .../java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java    | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java
index 0505744..74de8e9 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java
@@ -251,11 +251,12 @@ final class VariableWrapper extends Variable {
          * the file. Note that those coordinate systems may have been set by the user.
          */
         if (variable instanceof Enhancements) {
+            final Grid[] grids = decoder.getGrids();    // Must be first for forcing some UCAR CS constructions.
             final List<CoordinateSystem> systems = ((Enhancements) variable).getCoordinateSystems();
-            if (!systems.isEmpty()) {           // For avoiding useless call to decoder.getGrids().
+            if (!systems.isEmpty()) {
                 GridWrapper grid = null;
                 final String[] axisNames = decoder.convention().namesOfAxisVariables(this);
-                for (final Grid candidate : decoder.getGrids()) {
+                for (final Grid candidate : grids) {
                     final GridWrapper ordered = ((GridWrapper) candidate).forVariable(variable, systems, axisNames);
                     if (ordered != null && (grid == null || ordered.getSourceDimensions() > grid.getSourceDimensions())) {
                         grid = ordered;