From commits-return-11881-apmail-sis-commits-archive=sis.apache.org@sis.apache.org Tue Apr 9 14:43:52 2019 Return-Path: X-Original-To: apmail-sis-commits-archive@www.apache.org Delivered-To: apmail-sis-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by minotaur.apache.org (Postfix) with SMTP id 4A8A018CEC for ; Tue, 9 Apr 2019 14:43:52 +0000 (UTC) Received: (qmail 29621 invoked by uid 500); 9 Apr 2019 14:24:14 -0000 Delivered-To: apmail-sis-commits-archive@sis.apache.org Received: (qmail 29608 invoked by uid 500); 9 Apr 2019 14:24:14 -0000 Mailing-List: contact commits-help@sis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: sis-dev@sis.apache.org Delivered-To: mailing list commits@sis.apache.org Received: (qmail 29599 invoked by uid 99); 9 Apr 2019 14:24:14 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Apr 2019 14:24:14 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id A9EC980B24; Tue, 9 Apr 2019 14:43:51 +0000 (UTC) Date: Tue, 09 Apr 2019 14:43:51 +0000 To: "commits@sis.apache.org" Subject: [sis] branch geoapi-4.0 updated: Resolve name collision in RasterResource.identifier when two netCDF variables use the same "standard_name" attribute value. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <155482103164.24338.17655985465253042557@gitbox.apache.org> From: desruisseaux@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: sis X-Git-Refname: refs/heads/geoapi-4.0 X-Git-Reftype: branch X-Git-Oldrev: 8a7a5d8d1aee453d88acefa317cb70b03fd39fc5 X-Git-Newrev: fdf30a0e8133ac5f67f4d1d1e033623bfaf4f5db X-Git-Rev: fdf30a0e8133ac5f67f4d1d1e033623bfaf4f5db X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated 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 fdf30a0 Resolve name collision in RasterResource.identifier when two netCDF variables use the same "standard_name" attribute value. fdf30a0 is described below commit fdf30a0e8133ac5f67f4d1d1e033623bfaf4f5db Author: Martin Desruisseaux AuthorDate: Tue Apr 9 16:42:58 2019 +0200 Resolve name collision in RasterResource.identifier when two netCDF variables use the same "standard_name" attribute value. --- .../apache/sis/internal/netcdf/RasterResource.java | 46 +++++++++++++++++++--- .../org/apache/sis/internal/netcdf/Variable.java | 6 ++- 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/RasterResource.java b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/RasterResource.java index 96259f8..e384680 100644 --- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/RasterResource.java +++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/RasterResource.java @@ -18,6 +18,7 @@ package org.apache.sis.internal.netcdf; import java.util.Map; import java.util.List; +import java.util.HashMap; import java.util.ArrayList; import java.io.IOException; import java.nio.file.Path; @@ -87,11 +88,16 @@ public final class RasterResource extends AbstractGridResource implements Resour }; /** - * The identifier of this grid resource. This is the variable name. + * The identifier of this grid resource. This is {@link Variable#getStandardName()}. We prefer netCDF standard name instead + * than variable name because the former is controlled vocabulary. The use of controlled vocabulary for identifiers increases + * the chances of stability or consistency between similar products. + * + *

The value set by constructor may be updated by {@link #resolveNameCollision(RasterResource, Decoder)}, + * but should not be modified after that point.

* * @see #getIdentifier() */ - private final GenericName identifier; + private GenericName identifier; /** * The grid geometry (size, CRS…) of the {@linkplain #data} cube. @@ -187,8 +193,9 @@ public final class RasterResource extends AbstractGridResource implements Resour public static List create(final Decoder decoder, final Object lock) throws IOException, DataStoreException { assert Thread.holdsLock(lock); final Variable[] variables = decoder.getVariables().clone(); // Needs a clone because may be modified. - final List siblings = new ArrayList<>(4); - final List resources = new ArrayList<>(); + final List siblings = new ArrayList<>(4); // Usually has only 1 element, sometime 2. + final List resources = new ArrayList<>(variables.length); // The raster resources to be returned. + final Map firstOfName = new HashMap<>(); // For detecting name collisions. for (int i=0; i