// get a list of station obs for this station
  public List getData(Station s, CancelTask cancel) throws IOException {
    ArrayStructure stationData = readData("ID " + s.getName(), cancel);

    ArrayList stationObs = new ArrayList();
    IndexIterator ii = stationData.getIndexIterator();
    while (ii.hasNext()) {
      stationObs.add(new StationObs((Station) s, (StructureData) ii.getObjectNext()));
    }
    return stationObs;
  }
Exemplo n.º 2
0
 private Array convertToChar(Variable newVar, Array oldData) {
   ArrayChar newData = (ArrayChar) Array.factory(DataType.CHAR, newVar.getShape());
   Index ima = newData.getIndex();
   IndexIterator ii = oldData.getIndexIterator();
   while (ii.hasNext()) {
     String s = (String) ii.getObjectNext();
     int[] c = ii.getCurrentCounter();
     for (int i = 0; i < c.length; i++) ima.setDim(i, c[i]);
     newData.setString(ima, s);
   }
   return newData;
 }
Exemplo n.º 3
0
  public void testAggCoordVarNoCoordsDir(NetcdfFile ncfile) throws IOException {
    Variable time = ncfile.findVariable("time");
    assert null != time;
    assert time.getShortName().equals("time");
    assert time.getRank() == 1 : time.getRank();
    assert time.getShape()[0] == 3;
    assert time.getDataType() == DataType.STRING : time.getDataType();

    assert time.getDimension(0) == ncfile.findDimension("time");

    Array data = time.read();

    assert (data instanceof ArrayObject);
    IndexIterator dataI = data.getIndexIterator();
    String coordName = (String) dataI.getObjectNext();
    assert coordName.equals("time0Dir.nc") : coordName;
    coordName = (String) dataI.getObjectNext();
    assert coordName.equals("time1Dir.nc") : coordName;
    coordName = (String) dataI.getObjectNext();
    assert coordName.equals("time2Dir.nc") : coordName;
  }