sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 02/03: Rename two Convention methods for consistency with other methods.
Date Thu, 21 Feb 2019 15:03:26 GMT
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 a9bf411bafb3d2a3aaef5c253f4d83a757181668
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Thu Feb 21 15:07:21 2019 +0100

    Rename two Convention methods for consistency with other methods.
---
 .../main/java/org/apache/sis/internal/netcdf/Convention.java  | 11 +++++++----
 .../main/java/org/apache/sis/internal/netcdf/Variable.java    |  6 +++---
 .../main/java/org/apache/sis/storage/netcdf/GridResource.java |  4 ++--
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Convention.java
b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Convention.java
index 01baef3..5f0d9e3 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Convention.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Convention.java
@@ -76,7 +76,7 @@ public class Convention {
     /**
      * Names of attributes where to fetch minimum and maximum sample values, in preference
order.
      *
-     * @see #getValidValues(Variable)
+     * @see #validRange(Variable)
      */
     private static final String[] RANGE_ATTRIBUTES = {
         "valid_range",      // Expected "reasonable" range for variable.
@@ -156,6 +156,9 @@ public class Convention {
      * The given parameter is a name from <cite>CF conventions</cite> or from
<cite>Attribute Convention for Dataset Discovery
      * (ACDD)</cite>. Some of those attribute names are listed in the {@link org.apache.sis.storage.netcdf.AttributeNames}
class.
      *
+     * <p>In current version of netCDF reader, this method is invoked only for global
attributes,
+     * not for the attributes on variables.</p>
+     *
      * <p>The default implementation returns {@code name} unchanged.</p>
      *
      * @param  name  an attribute name from CF or ACDD convention.
@@ -318,7 +321,7 @@ public class Convention {
      *
      * @see Variable#getRangeFallback()
      */
-    public NumberRange<?> getValidValues(final Variable data) {
+    public NumberRange<?> validRange(final Variable data) {
         Number minimum = null;
         Number maximum = null;
         Class<? extends Number> type = null;
@@ -369,7 +372,7 @@ public class Convention {
 
     /**
      * Compares two numbers which shall be of the same class.
-     * This is a helper method for {@link #getValidValues(Variable)}.
+     * This is a helper method for {@link #validRange(Variable)}.
      */
     @SuppressWarnings("unchecked")
     private static int compare(final Number n1, final Number n2) {
@@ -390,7 +393,7 @@ public class Convention {
      *         if no information is found in the given {@code data} variable, then the return
value
      *         shall be an identity function.
      */
-    public TransferFunction getTransferFunction(final Variable data) {
+    public TransferFunction transferFunction(final Variable data) {
         /*
          * If scale_factor and/or add_offset variable attributes are present, then this is
          * a "packed" variable. Otherwise the transfer function is the identity transform.
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java
b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java
index 51d5275..4ca118c 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java
@@ -617,8 +617,8 @@ public abstract class Variable extends NamedElement {
 
     /**
      * Returns the range of values as determined by the data type or other means, or {@code
null} if unknown.
-     * This method is invoked only as a fallback if {@link Convention#getValidValues(Variable)}
did not found
-     * a range of values by application of CF conventions. The returned range may be a range
of packed values
+     * This method is invoked only as a fallback if {@link Convention#validRange(Variable)}
did not found a
+     * range of values by application of CF conventions. The returned range may be a range
of packed values
      * or a range of real values. In the later case, the range shall be an instance of
      * {@link org.apache.sis.measure.MeasurementRange}.
      *
@@ -628,7 +628,7 @@ public abstract class Variable extends NamedElement {
      *
      * @return the range of valid values, or {@code null} if unknown.
      *
-     * @see Convention#getValidValues(Variable)
+     * @see Convention#validRange(Variable)
      */
     public NumberRange<?> getRangeFallback() {
         final DataType dataType = getDataType();
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/GridResource.java
b/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/GridResource.java
index f12b354..d4b015f 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/GridResource.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/GridResource.java
@@ -286,12 +286,12 @@ final class GridResource extends AbstractGridResource implements ResourceOnFileS
          * is used only as a fallback. We give precedence to the range computed by Apache
SIS instead than the range given
          * by UCAR because we need the range of packed values instead than the range of converted
values.
          */
-        NumberRange<?> range = convention.getValidValues(data);
+        NumberRange<?> range = convention.validRange(data);
         if (range == null) {
             range = data.getRangeFallback();                                // Fallback to
UCAR library may happen here.
         }
         if (range != null) {
-            final MathTransform1D mt = convention.getTransferFunction(data).getTransform();
+            final MathTransform1D mt = convention.transferFunction(data).getTransform();
             if (!mt.isIdentity() && range instanceof MeasurementRange<?>) {
                 /*
                  * Heuristic rule defined in UCAR documentation (see EnhanceScaleMissing
interface):


Mime
View raw message