Exemple #1
0
  public void testStride(String stride) throws IOException, InvalidRangeException {
    Variable time = ncfile.findVariable("time");
    ArrayInt all = (ArrayInt) time.read();

    ArrayInt correct = (ArrayInt) all.section(new Section(stride).getRanges());
    System.out.printf("correct(%s) %s", stride, NCdumpW.toString(correct));
    ArrayInt data = (ArrayInt) time.read(stride);
    System.out.printf("data(%s) %s%n", stride, NCdumpW.toString(data));
    Index ci = correct.getIndex();
    Index di = data.getIndex();
    for (int i = 0; i < data.getSize(); i++)
      assert (data.getInt(di.set(i)) == correct.getInt(ci.set(i)))
          : stride
              + " index "
              + i
              + " = "
              + data.getInt(di.set(i))
              + " != "
              + correct.getInt(ci.set(i));
  }
Exemple #2
0
  public void testStride() throws IOException, InvalidRangeException {
    System.out.println("ncfile opened = " + location + "\n" + ncfile);
    Variable time = ncfile.findVariable("time");

    ArrayInt all = (ArrayInt) time.read();
    for (int i = 0; i < all.getSize(); i++) assert (all.getInt(i) == i + 1);

    testStride("0:13:3");

    for (int i = 1; i < 12; i++) testStride("0:13:" + i);
  }