cdm/src/main/java/ucar/nc2/dataset/conv/CSMConvention.java
protected boolean addParameter2(CoordinateTransform rs, String paramName, NetcdfFile ds, AttributeContainer v, String attName, boolean readData) {
    String varName;
    if (null == (varName = v.findAttValueIgnoreCase(attName, null))) {
      parseInfo.format("CSMConvention No Attribute named %s%n", attName);
      return false;
    }
    varName = varName.trim();

    Variable dataVar;
    if (null == (dataVar = ds.findVariable(varName))) {
      parseInfo.format("CSMConvention No Variable named %s%n", varName);
      return false;
    }

    if (readData) {
      Array data;
      try {
        data = dataVar.read();
      } catch (IOException e) {
        parseInfo.format("CSMConvention failed on read of %s err= %s%n", varName, e.getMessage());
        return false;
      }
      double[] vals = (double []) data.get1DJavaArray(DataType.DOUBLE);
      rs.addParameter(new Parameter(paramName, vals));

    } else
      rs.addParameter(new Parameter(paramName, varName));

    return true;
  }
protected boolean addParameter2(CoordinateTransform rs, String paramName, NetcdfFile ds, AttributeContainer v, String attName, boolean readData) {
    String varName;
    if (null == (varName = v.findAttValueIgnoreCase(attName, null))) {
      parseInfo.format("CSMConvention No Attribute named %s%n", attName);
      return false;
    }
    varName = varName.trim();

    Variable dataVar;
    if (null == (dataVar = ds.findVariable(varName))) {
      parseInfo.format("CSMConvention No Variable named %s%n", varName);
      return false;
    }

    if (readData) {
      Array data;
      try {
        data = dataVar.read();
      } catch (IOException e) {
        parseInfo.format("CSMConvention failed on read of %s err= %s%n", varName, e.getMessage());
        return false;
      }
      double[] vals = (double []) data.get1DJavaArray(DataType.DOUBLE);
      rs.addParameter(new Parameter(paramName, vals));

    } else
      rs.addParameter(new Parameter(paramName, varName));

    return true;
  }
protected boolean addParameter2 ( CoordinateTransform rs , String paramName , NetcdfFile ds , AttributeContainer v , String attName , boolean readData ) { String varName ; if ( null == ( varName = v . findAttValueIgnoreCase ( attName , null ) ) ) { parseInfo . format ( "CSMConvention No Attribute named %s%n" , attName ) ; return false ; } varName = varName . trim ( ) ; Variable dataVar ; if ( null == ( dataVar = ds . findVariable ( varName ) ) ) { parseInfo . format ( "CSMConvention No Variable named %s%n" , varName ) ; return false ; } if ( readData ) { Array data ; try { data = dataVar . read ( ) ; } catch ( IOException e ) { parseInfo . format ( "CSMConvention failed on read of %s err= %s%n" , varName , e . getMessage ( ) ) ; return false ; } double [ ] vals = ( double [ ] ) data . get1DJavaArray ( DataType . DOUBLE ) ; rs . addParameter ( new Parameter ( paramName , vals ) ) ; } else rs . addParameter ( new Parameter ( paramName , varName ) ) ; return true ; }
Add a Parameter to a CoordinateTransform. The variable attribute points to a another variable that has the data in it.
Make sure that atrribute and variable exist. Id readData is true, read the data and use it as the value of the
parameter, otherwise use the name as the value of the parameter.

@param rs        the CoordinateTransform
@param paramName the parameter name
@param ds        dataset
@param v         variable
@param attName   variable attribute name
@param readData  if true, read data and use a  s parameter value
@return true if success, false is failed
Add a Parameter to a CoordinateTransform . The variable attribute points to a another variable that has the data in it . Make sure that atrribute and variable exist . Id readData is true read the data and use it as the value of the parameter otherwise use the name as the value of the parameter .