Java Code Examples for ucar.ma2.DataType#INT

The following examples show how to use ucar.ma2.DataType#INT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NcDDS.java    From tds with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private BaseType createScalarVariable(NetcdfFile ncfile, Variable v) {
  DataType dt = v.getDataType();
  if (dt == DataType.DOUBLE)
    return new NcSDFloat64(v);
  else if (dt == DataType.FLOAT)
    return new NcSDFloat32(v);
  else if (dt == DataType.INT)
    return new NcSDInt32(v);
  else if (dt == DataType.UINT)
    return new NcSDUInt32(v);
  else if (dt == DataType.SHORT)
    return new NcSDInt16(v);
  else if (dt == DataType.USHORT)
    return new NcSDUInt16(v);
  else if ((dt == DataType.BYTE) || (dt == DataType.UBYTE))
    return new NcSDByte(v);
  else if (dt == DataType.CHAR)
    return new NcSDString(v);
  else if (dt == DataType.STRING)
    return new NcSDString(v);
  else if (dt == DataType.STRUCTURE)
    return createStructure(ncfile, (Structure) v);
  else
    throw new UnsupportedOperationException("NcDDS Variable data type = " + dt);
}
 
Example 2
Source File: CFPointWriterUtils.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private static void setDataArray(DataType dt, Array arr, Member m) {

    // Set the value (int, short, float, double...)
    if (dt == DataType.SHORT) {
      arr.setShort(0, m.getDataArray().getShort(0));
    }

    if (dt == DataType.INT) {
      arr.setInt(0, m.getDataArray().getInt(0));
    }

    if (dt == DataType.DOUBLE) {
      arr.setDouble(0, m.getDataArray().getDouble(0));
    }

    if (dt == DataType.FLOAT) {
      arr.setFloat(0, m.getDataArray().getFloat(0));
    }

  }
 
Example 3
Source File: NcStream.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private static DataType decodeAttributeType(ucar.nc2.stream.NcStreamProto.Attribute.Type dtype) {
  switch (dtype) {
    case STRING:
      return DataType.STRING;
    case BYTE:
      return DataType.BYTE;
    case SHORT:
      return DataType.SHORT;
    case INT:
      return DataType.INT;
    case LONG:
      return DataType.LONG;
    case FLOAT:
      return DataType.FLOAT;
    case DOUBLE:
      return DataType.DOUBLE;
  }
  throw new IllegalStateException("illegal att type " + dtype);
}
 
Example 4
Source File: NUWGConvention.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
NavInfo(VariableDS.Builder vb) throws IOException {
  this.vb = vb;
  this.orgVar = vb.orgVar;
  valueType = vb.dataType;
  try {
    if ((valueType == DataType.CHAR) || (valueType == DataType.STRING))
      svalue = orgVar.readScalarString();
    else if (valueType == DataType.BYTE)
      bvalue = orgVar.readScalarByte();
    else if ((valueType == DataType.INT) || (valueType == DataType.SHORT))
      ivalue = orgVar.readScalarInt();
    else
      dvalue = orgVar.readScalarDouble();
  } catch (UnsupportedOperationException e) {
    parseInfo.format("Nav variable %s  not a scalar%n", getName());
  }
}
 
Example 5
Source File: NUWGConvention.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public String getStringValue() {
  if ((valueType == DataType.CHAR) || (valueType == DataType.STRING))
    return svalue;
  else if (valueType == DataType.BYTE)
    return Byte.toString(bvalue);
  else if ((valueType == DataType.INT) || (valueType == DataType.SHORT))
    return Integer.toString(ivalue);
  else
    return Double.toString(dvalue);
}
 
Example 6
Source File: TestPointDatasets.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
static private void checkData(StructureData sdata) {

    for (StructureMembers.Member member : sdata.getMembers()) {
      DataType dt = member.getDataType();
      if (dt == DataType.FLOAT) {
        sdata.getScalarFloat(member);
        sdata.getJavaArrayFloat(member);
      } else if (dt == DataType.DOUBLE) {
        sdata.getScalarDouble(member);
        sdata.getJavaArrayDouble(member);
      } else if (dt == DataType.BYTE) {
        sdata.getScalarByte(member);
        sdata.getJavaArrayByte(member);
      } else if (dt == DataType.SHORT) {
        sdata.getScalarShort(member);
        sdata.getJavaArrayShort(member);
      } else if (dt == DataType.INT) {
        sdata.getScalarInt(member);
        sdata.getJavaArrayInt(member);
      } else if (dt == DataType.LONG) {
        sdata.getScalarLong(member);
        sdata.getJavaArrayLong(member);
      } else if (dt == DataType.CHAR) {
        sdata.getScalarChar(member);
        sdata.getJavaArrayChar(member);
        sdata.getScalarString(member);
      } else if (dt == DataType.STRING) {
        sdata.getScalarString(member);
      }

      if ((dt != DataType.STRING) && (dt != DataType.CHAR) && (dt != DataType.STRUCTURE) && (dt != DataType.SEQUENCE)) {
        sdata.convertScalarFloat(member.getName());
      }

    }
  }
 
Example 7
Source File: MetarField.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
void sum(StructureData sdata, StructureMembers.Member m) {
  if (m.getDataType() == DataType.DOUBLE)
    sum(sdata.getScalarDouble(m));
  else if (m.getDataType() == DataType.FLOAT)
    sum(sdata.getScalarFloat(m));
  else if (m.getDataType() == DataType.INT)
    sum(sdata.getScalarInt(m));
}
 
Example 8
Source File: H4header.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
Number get(DataType dataType, int index) {
  if (dataType == DataType.BYTE)
    return bb.get(index);
  if (dataType == DataType.SHORT)
    return bb.asShortBuffer().get(index);
  if (dataType == DataType.INT)
    return bb.asIntBuffer().get(index);
  if (dataType == DataType.LONG)
    return bb.asLongBuffer().get(index);
  if (dataType == DataType.FLOAT)
    return bb.asFloatBuffer().get(index);
  if (dataType == DataType.DOUBLE)
    return bb.asDoubleBuffer().get(index);
  return Double.NaN;
}
 
Example 9
Source File: NUWGConvention.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public int getInt(String name) throws NoSuchElementException {
  NavInfo nav = findInfo(name);
  if (nav == null)
    throw new NoSuchElementException("GRIB1 " + name);

  if ((nav.valueType == DataType.INT) || (nav.valueType == DataType.SHORT))
    return nav.ivalue;
  else if ((nav.valueType == DataType.DOUBLE) || (nav.valueType == DataType.FLOAT))
    return (int) nav.dvalue;
  else if (nav.valueType == DataType.BYTE)
    return (int) nav.bvalue;

  throw new IllegalArgumentException("NUWGConvention.GRIB1.getInt " + name + " type = " + nav.valueType);
}
 
Example 10
Source File: NUWGConvention.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public double getDouble(String name) throws NoSuchElementException {
  NavInfo nav = findInfo(name);
  if (nav == null)
    throw new NoSuchElementException("GRIB1 " + name);

  if ((nav.valueType == DataType.DOUBLE) || (nav.valueType == DataType.FLOAT))
    return nav.dvalue;
  else if ((nav.valueType == DataType.INT) || (nav.valueType == DataType.SHORT))
    return (double) nav.ivalue;
  else if (nav.valueType == DataType.BYTE)
    return (double) nav.bvalue;

  throw new IllegalArgumentException("NUWGConvention.GRIB1.getDouble " + name + " type = " + nav.valueType);
}
 
Example 11
Source File: NsslRadarMosaicConvention.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void addCoordSystem(NetcdfDataset ds) {

    double lat = ds.findGlobalAttributeIgnoreCase("Latitude").getNumericValue().doubleValue();
    double lon = ds.findGlobalAttributeIgnoreCase("Longitude").getNumericValue().doubleValue();
    double dlat = ds.findGlobalAttributeIgnoreCase("LatGridSpacing").getNumericValue().doubleValue();
    double dlon = ds.findGlobalAttributeIgnoreCase("LonGridSpacing").getNumericValue().doubleValue();
    int time = ds.findGlobalAttributeIgnoreCase("Time").getNumericValue().intValue();

    if (debug)
      System.out.println(ds.getLocation() + " Lat/Lon=" + lat + "/" + lon);

    int nlat = ds.findDimension("Lat").getLength();
    int nlon = ds.findDimension("Lon").getLength();

    // add lat
    CoordinateAxis v =
        new CoordinateAxis1D(ds, null, "Lat", DataType.FLOAT, "Lat", CDM.LAT_UNITS, "latitude coordinate");
    v.setValues(nlat, lat, -dlat);
    v.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Lat.toString()));
    ds.addCoordinateAxis(v);

    // add lon
    v = new CoordinateAxis1D(ds, null, "Lon", DataType.FLOAT, "Lon", CDM.LON_UNITS, "longitude coordinate");
    v.setValues(nlon, lon, dlon);
    v.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Lon.toString()));
    ds.addCoordinateAxis(v);

    // add time
    ds.addDimension(null, new Dimension("Time", 1));
    v = new CoordinateAxis1D(ds, null, "Time", DataType.INT, "Time", "seconds since 1970-1-1 00:00:00",
        "time coordinate");
    v.setValues(1, time, 1);
    v.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Time.toString()));
    ds.addCoordinateAxis(v);
  }
 
Example 12
Source File: RecordDatasetHelper.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected RecordStationObs(StructureData sdata, int recno, boolean useId) {
  super(recno);
  this.recno = recno;
  this.sdata = sdata;
  this.timeUnit = RecordDatasetHelper.this.timeUnit;

  StructureMembers members = sdata.getStructureMembers();
  obsTime = getTime(members.findMember(obsTimeVName), sdata);
  nomTime = (nomTimeVName == null) ? obsTime : getTime(members.findMember(nomTimeVName), sdata);

  if (useId) {
    // this assumes the station id/name is stored in the obs record
    String stationId;
    if (stationIdType == DataType.INT) {
      stationId = Integer.toString(sdata.getScalarInt(stnIdVName));
    } else
      stationId = sdata.getScalarString(stnIdVName).trim();
    station = stationHelper.getStation(stationId);
    if (null != errs)
      errs.format(" cant find station id = <%s> when reading record %d%n", stationId, recno);
    log.error(" cant find station id = <" + stationId + "> when reading record " + recno);

  } else {
    // use a station index
    List<Station> stations = stationHelper.getStations();
    int stationIndex = sdata.getScalarInt(stnIndexVName);
    if (stationIndex < 0 || stationIndex >= stations.size()) {
      if (null != errs)
        errs.format(" cant find station at index =%d when reading record %d%n", stationIndex, recno);
      log.error("cant find station at index = " + stationIndex + " when reading record " + recno);
    } else
      station = stations.get(stationIndex);
  }

  location = station;
}
 
Example 13
Source File: RecordDatasetHelper.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Constructor for when you already have the StructureData and want to wrap it in a StationObsDatatype
 *
 * @param recno record number LOOK why do we need ??
 * @param sdata the structure data
 */
protected RecordStationObs(int recno, StructureData sdata) {
  this.recno = recno;
  this.sdata = sdata;

  StructureMembers members = sdata.getStructureMembers();

  obsTime = sdata.convertScalarDouble(members.findMember(obsTimeVName));
  nomTime = (nomTimeVName == null) ? obsTime : sdata.convertScalarDouble(members.findMember(nomTimeVName));

  // obsTime = sdata.convertScalarDouble( members.findMember(obsTimeVName) );
  // nomTime = (nomTimeVName == null) ? obsTime : sdata.convertScalarDouble( members.findMember(nomTimeVName));

  Object stationId;
  if (stationIdType == DataType.INT) {
    stationId = sdata.getScalarInt(stnIdVName);
  } else
    stationId = sdata.getScalarString(stnIdVName).trim();

  station = (ucar.unidata.geoloc.Station) stnHash.get(stationId);
  location = station;
  if (station == null) {
    if (null != errs)
      errs.append(" cant find station = <").append(stationId).append(">" + "when reading record ").append(recno)
          .append("\n");
    if (showErrors)
      System.out.println(" cant find station = <" + stationId + ">" + "when reading record " + recno);
  }
}
 
Example 14
Source File: CDMTypeFcns.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public static DataType daptype2cdmtype(DapType type) {
  assert (type != null);
  switch (type.getTypeSort()) {
    case Char:
      return DataType.CHAR;
    case UInt8:
      return DataType.UBYTE;
    case Int8:
      return DataType.BYTE;
    case Int16:
      return DataType.SHORT;
    case UInt16:
      return DataType.USHORT;
    case Int32:
      return DataType.INT;
    case UInt32:
      return DataType.UINT;
    case Int64:
      return DataType.LONG;
    case UInt64:
      return DataType.ULONG;
    case Float32:
      return DataType.FLOAT;
    case Float64:
      return DataType.DOUBLE;
    case String:
    case URL:
      return DataType.STRING;
    case Opaque:
      return DataType.OPAQUE;
    case Enum:
      // Coverity[FB.BC_UNCONFIRMED_CAST]
      DapEnumeration dapenum = (DapEnumeration) type;
      switch (dapenum.getBaseType().getTypeSort()) {
        case Char:
        case UInt8:
        case Int8:
          return DataType.ENUM1;
        case Int16:
        case UInt16:
          return DataType.ENUM2;
        case Int32:
        case UInt32:
          return DataType.ENUM4;
        case Int64:
        case UInt64:
          // since there is no ENUM8, use ENUM4
          return DataType.ENUM4;
        default:
          break;
      }
      break;
    case Structure:
      return DataType.STRUCTURE;
    case Sequence:
      return DataType.SEQUENCE;
    default:
      break;
  }
  return null;
}
 
Example 15
Source File: AWIPSConvention.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private CoordinateAxis makeTimeCoordAxis(NetcdfDataset ds) {
  Variable timeVar = ds.findVariable("valtimeMINUSreftime");
  Dimension recordDim = ds.findDimension("record");
  Array vals;

  try {
    vals = timeVar.read();
  } catch (IOException ioe) {
    return null;
  }

  // it seems that the record dimension does not always match valtimeMINUSreftime dimension!!
  // HAHAHAHAHAHAHAHA !
  int recLen = recordDim.getLength();
  int valLen = (int) vals.getSize();
  if (recLen != valLen) {
    try {
      vals = vals.sectionNoReduce(new int[] {0}, new int[] {recordDim.getLength()}, null);
      parseInfo.format(" corrected the TimeCoordAxis length%n");
    } catch (InvalidRangeException e) {
      parseInfo.format("makeTimeCoordAxis InvalidRangeException%n");
    }
  }

  // create the units out of the filename if possible
  String units = makeTimeUnitFromFilename(ds.getLocation());
  if (units == null) // ok that didnt work, try something else
    return makeTimeCoordAxisFromReference(ds, timeVar, vals);

  // create the coord axis
  String desc = "synthesized time coordinate from valtimeMINUSreftime and filename YYYYMMDD_HHMM";
  CoordinateAxis1D timeCoord = new CoordinateAxis1D(ds, null, "timeCoord", DataType.INT, "record", units, desc);

  timeCoord.setCachedData(vals, true);

  parseInfo.format("Created Time Coordinate Axis = ");
  timeCoord.getNameAndDimensions(parseInfo, true, false);
  parseInfo.format("%n");

  return timeCoord;
}
 
Example 16
Source File: NcStream.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public static DataType convertDataType(ucar.nc2.stream.NcStreamProto.DataType dtype) {
  switch (dtype) {
    case CHAR:
      return DataType.CHAR;
    case BYTE:
      return DataType.BYTE;
    case SHORT:
      return DataType.SHORT;
    case INT:
      return DataType.INT;
    case LONG:
      return DataType.LONG;
    case FLOAT:
      return DataType.FLOAT;
    case DOUBLE:
      return DataType.DOUBLE;
    case STRING:
      return DataType.STRING;
    case STRUCTURE:
      return DataType.STRUCTURE;
    case SEQUENCE:
      return DataType.SEQUENCE;
    case ENUM1:
      return DataType.ENUM1;
    case ENUM2:
      return DataType.ENUM2;
    case ENUM4:
      return DataType.ENUM4;
    case OPAQUE:
      return DataType.OPAQUE;
    case UBYTE:
      return DataType.UBYTE;
    case USHORT:
      return DataType.USHORT;
    case UINT:
      return DataType.UINT;
    case ULONG:
      return DataType.ULONG;
  }
  throw new IllegalStateException("illegal data type " + dtype);
}
 
Example 17
Source File: CFpointObs.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * Identify ragged array representations for double nests (timeSeries profile, timeSeries trajectory)
 * <p/>
 * This uses the contiguous ragged array representation for each profile (9.5.43.3), and the indexed ragged array
 * representation to organise the profiles into time series (9.3.54). The canonical use case is when writing real-time
 * data streams that contain profiles from many stations, arriving randomly, with the data for each entire profile
 * written all at once.
 *
 * @param ds in this dataset
 * @param info put info here
 * @param errlog error go here
 * @return EncodingInfo if ragged array representations is found
 */
protected boolean identifyDoubleRaggeds(NetcdfDataset ds, EncodingInfo info, Formatter errlog) {
  // the timeseries are stored as ragged index
  Evaluator.VarAtt varatt = Evaluator.findVariableWithAttribute(ds, CF.INSTANCE_DIMENSION);
  if (varatt == null)
    varatt = Evaluator.findVariableWithAttribute(ds, CF.RAGGED_PARENTINDEX);
  if (varatt == null)
    return false;

  Variable ragged_parentIndex = varatt.var;
  String instanceDimName = varatt.att.getStringValue();
  Dimension stationDim = ds.findDimension(instanceDimName);

  if (stationDim == null) {
    errlog.format(
        "CFpointObs: Indexed ragged array representation: parent_index variable has illegal value for %s = %s%n",
        CF.INSTANCE_DIMENSION, instanceDimName);
    return false;
  }

  if (ragged_parentIndex.getDataType() != DataType.INT) {
    errlog.format("CFpointObs: Indexed ragged array representation: parent_index variable must be of type integer%n");
    return false;
  }

  if (ragged_parentIndex.getRank() != 1 && info.childStruct == null) {
    errlog.format("CFpointObs: Indexed ragged array representation: parent_index variable %s must be 1D %n",
        ragged_parentIndex);
    return false;
  }
  Dimension profileDim = (info.childDim != null) ? info.childDim : ragged_parentIndex.getDimension(0);

  // onto the profiles, stored contiguously
  varatt = Evaluator.findVariableWithAttribute(ds, CF.SAMPLE_DIMENSION);
  if (varatt == null)
    varatt = Evaluator.findVariableWithAttribute(ds, CF.RAGGED_ROWSIZE);
  if (varatt == null)
    return false;

  Variable ragged_rowSize = varatt.var;
  String obsDimName = varatt.att.getStringValue();
  Dimension obsDim = ds.findDimension(obsDimName);

  if (obsDimName == null) {
    errlog.format(
        "CFpointObs: Contiguous ragged array representation: parent_index variable has illegal value for %s = %s%n",
        CF.SAMPLE_DIMENSION, obsDimName);
    return false;
  }

  if (!obsDimName.equals(info.grandChildDim.getShortName())) {
    errlog.format(
        "CFpointObs: Contiguous ragged array representation: row_size variable has obs dimension %s must be %s%n",
        obsDimName, info.childDim);
    return false;
  }

  if (ragged_rowSize.getDataType() != DataType.INT) {
    errlog.format("CFpointObs: Contiguous ragged array representation: row_size variable must be of type integer%n");
    return false;
  }

  if (info.childDim == null) { // nc4 ext
    Dimension profileDim2 = ragged_rowSize.getDimension(0);
    if (profileDim2 != profileDim) {
      errlog.format("CFpointObs: Double ragged array representation dimensions do not agree: %s != %s%n",
          profileDim2.getShortName(), profileDim.getShortName());
      return false;
    }
  }

  info.set(Encoding.raggedIndex, stationDim, profileDim, obsDim);
  info.ragged_parentIndex = ragged_parentIndex;
  info.ragged_rowSize = ragged_rowSize;
  return true;
}
 
Example 18
Source File: H4type.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public static DataType setDataType(short type, Variable v) {
  DataType dt;
  switch (type) {
    case 3:
    case 21:
      dt = DataType.UBYTE;
      break;
    case 4:
      dt = DataType.CHAR;
      break;
    case 5:
      dt = DataType.FLOAT;
      break;
    case 6:
      dt = DataType.DOUBLE;
      break;
    case 20:
      dt = DataType.BYTE;
      break;
    case 22:
      dt = DataType.SHORT;
      break;
    case 23:
      dt = DataType.USHORT;
      break;
    case 24:
      dt = DataType.INT;
      break;
    case 25:
      dt = DataType.UINT;
      break;
    case 26:
      dt = DataType.LONG;
      break;
    case 27:
      dt = DataType.ULONG;
      break;
    default:
      throw new IllegalStateException("unknown type= " + type);
  }

  if (v != null) {
    v.setDataType(dt);
  }

  return dt;
}
 
Example 19
Source File: RecordDatasetHelper.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * This reads through all the records in the dataset, and constructs a list of
 * RecordPointObs or RecordStationObs. It does not cache the data.
 * <p>
 * If stnIdVName is not null, its a StationDataset, then construct a Station HashMap of StationImpl
 * objects. Add the RecordStationObs into the list of obs for that station.
 *
 * @param cancel allow user to cancel
 * @return List of RecordPointObs or RecordStationObs
 * @throws IOException
 */
public ArrayList readAllCreateObs(CancelTask cancel) throws IOException {

  // see if its a station or point dataset
  boolean hasStations = stnIdVName != null;
  if (hasStations)
    stnHash = new HashMap<Object, ucar.unidata.geoloc.Station>();

  // get min and max date and lat,lon
  double minDate = Double.MAX_VALUE;
  double maxDate = -Double.MAX_VALUE;

  double minLat = Double.MAX_VALUE;
  double maxLat = -Double.MAX_VALUE;

  double minLon = Double.MAX_VALUE;
  double maxLon = -Double.MAX_VALUE;

  // read all the data, create a RecordObs
  ArrayList records = new ArrayList();
  int recno = 0;
  try (StructureDataIterator ii = recordVar.getStructureIterator()) {
    while (ii.hasNext()) {
      StructureData sdata = ii.next();
      StructureMembers members = sdata.getStructureMembers();

      Object stationId = null;
      if (hasStations) {
        if (stationIdType == DataType.INT) {
          int stationNum = sdata.getScalarInt(stnIdVName);
          stationId = new Integer(stationNum);
        } else
          stationId = sdata.getScalarString(stnIdVName).trim();
      }

      String desc = (stnDescVName == null) ? null : sdata.getScalarString(stnDescVName);
      double lat = sdata.convertScalarDouble(latVName);
      double lon = sdata.convertScalarDouble(lonVName);
      double alt = (altVName == null) ? Double.NaN : altScaleFactor * sdata.convertScalarDouble(altVName);
      double obsTime = sdata.convertScalarDouble(members.findMember(obsTimeVName));
      double nomTime = (nomTimeVName == null) ? obsTime : sdata.convertScalarDouble(members.findMember(nomTimeVName));

      // double obsTime = sdata.convertScalarDouble( members.findMember( obsTimeVName) );
      // double nomTime = (nomTimeVName == null) ? obsTime : sdata.convertScalarDouble( members.findMember(
      // nomTimeVName));

      if (hasStations) {
        StationImpl stn = (StationImpl) stnHash.get(stationId);
        if (stn == null) {
          stn = new StationImpl(stationId.toString(), desc, lat, lon, alt);
          stnHash.put(stationId, stn);
        }
        RecordStationObs stnObs = new RecordStationObs(stn, obsTime, nomTime, recno);
        records.add(stnObs);
        stn.addObs(stnObs);

      } else {
        records.add(new RecordPointObs(EarthLocation.create(lat, lon, alt), obsTime, nomTime, recno));
      }

      // track date range and bounding box
      minDate = Math.min(minDate, obsTime);
      maxDate = Math.max(maxDate, obsTime);

      minLat = Math.min(minLat, lat);
      maxLat = Math.max(maxLat, lat);
      minLon = Math.min(minLon, lon);
      maxLon = Math.max(maxLon, lon);

      recno++;
      if ((cancel != null) && cancel.isCancel())
        return null;
    }
  }

  boundingBox = new LatLonRect(new LatLonPointImpl(minLat, minLon), new LatLonPointImpl(maxLat, maxLon));

  return records;
}