コード例 #1
0
 public void testAlias() throws IOException {
   String filename = TestAll.cdmUnitTestDir + "fmrc/ensemble/demeter/MM_cnrm_129_red.ncml";
   NetcdfDataset ncd = ucar.nc2.dataset.NetcdfDataset.openDataset(filename);
   Variable v = ncd.findCoordinateAxis("number");
   assert v != null;
   // assert v.isCoordinateVariable();
   assert v instanceof CoordinateAxis1D;
   assert null != ncd.findDimension("ensemble");
   assert v.getDimension(0) == ncd.findDimension("ensemble");
 }
コード例 #2
0
  // test offset only gets applied once
  public void testWrapOnce() throws IOException {
    String filename = TestAll.cdmUnitTestDir + "ncml/coords/testCoordScaling.ncml";
    System.out.printf("%s%n", filename);
    NetcdfDataset ncd = ucar.nc2.dataset.NetcdfDataset.openDataset(filename);
    Variable v = ncd.findCoordinateAxis("Longitude");
    assert v != null;
    assert v instanceof CoordinateAxis1D;

    // if offset is applied twice, the result is not in +-180 range
    Array data = v.read();
    NCdumpW.printArray(data);
    IndexIterator ii = data.getIndexIterator();
    while (ii.hasNext()) {
      assert Math.abs(ii.getDoubleNext()) < 180 : ii.getDoubleCurrent();
    }
  }