legacy/src/main/java/ucar/nc2/dt/point/RecordDatasetHelper.java
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(new ucar.unidata.geoloc.EarthLocationImpl(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;
  }
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(new ucar.unidata.geoloc.EarthLocationImpl(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;
  }
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 ( new ucar . unidata . geoloc . EarthLocationImpl ( 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 ; }
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
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 .