public void testScan() throws IOException, InvalidRangeException {
    String xml =
        "<?xml version='1.0' encoding='UTF-8'?>\n"
            + "<netcdf xmlns='http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2'>\n"
            + "  <variable name='time' type='int' shape='time'>\n"
            + "    <attribute name='long_name' type='string' value='time coordinate' />\n"
            + "    <attribute name='units' type='string' value='days since 2001-8-31 00:00:00 UTC' />\n"
            + "    <values start='0' increment='10' />\n"
            + "  </variable>\n"
            + "  <aggregation dimName='time' type='joinNew'>\n"
            + "    <variableAgg name='T'/>\n"
            + "    <scan location='src/test/data/ncml/nc/' suffix='Dir.nc' subdirs='false'/>\n"
            + "  </aggregation>\n"
            + "</netcdf>";

    String filename = "file:./" + TestNcML.topDir + "aggSynScan.xml";
    NetcdfFile ncfile = NcMLReader.readNcML(new StringReader(xml), null);

    testDimensions(ncfile);
    testCoordVar(ncfile);
    testAggCoordVarScan(ncfile);
    testReadData(ncfile, "T");
    testReadSlice(ncfile, "T");
    ncfile.close();
  }
Exemple #2
0
 public void setUp() {
   try {
     ncfile = NcMLReader.readNcML(location, null);
     // System.out.println("ncfile opened = "+location);
   } catch (java.net.MalformedURLException e) {
     System.out.println("bad URL error = " + e);
   } catch (IOException e) {
     System.out.println("IO error = " + e);
     e.printStackTrace();
   }
 }
  public void testNoCoord() throws IOException, InvalidRangeException {
    String filename = "file:./" + TestNcML.topDir + "aggSynNoCoord.xml";
    NetcdfFile ncfile = NcMLReader.readNcML(filename, null);

    testDimensions(ncfile);
    testCoordVar(ncfile);
    testAggCoordVarNoCoord(ncfile);
    testReadData(ncfile, "T");
    testReadSlice(ncfile, "T");

    ncfile.close();
  }
  public void test1() throws IOException, InvalidRangeException {
    String filename = "file:./" + TestNcML.topDir + "aggSynthetic.xml";
    NetcdfFile ncfile = NcMLReader.readNcML(filename, null);

    Variable v = ncfile.findVariable("time");
    assert v != null;
    String testAtt = ncfile.findAttValueIgnoreCase(v, "units", null);
    assert testAtt != null;
    assert testAtt.equals("months since 2000-6-16 6:00");

    testDimensions(ncfile);
    testCoordVar(ncfile);
    testAggCoordVar(ncfile);
    testReadData(ncfile, "T");
    testReadSlice(ncfile, "T");

    ncfile.close();
  }
  public void testRename() throws IOException, InvalidRangeException {
    String xml =
        "<?xml version='1.0' encoding='UTF-8'?>\n"
            + "<netcdf xmlns='http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2'>\n"
            + "  <variable name='Temperature' orgName='T' />\n"
            + "  <aggregation  dimName='time' type='joinNew'>\n"
            + "    <variableAgg name='T'/>\n"
            + "    <scan location='src/test/data/ncml/nc/' suffix='Dir.nc' subdirs='false'/>\n"
            + "  </aggregation>\n"
            + "</netcdf>";

    String filename = "file:./" + TestNcML.topDir + "aggSynRename.xml";
    NetcdfFile ncfile = NcMLReader.readNcML(new StringReader(xml), null);

    testDimensions(ncfile);
    testCoordVar(ncfile);
    testAggCoordVarNoCoordsDir(ncfile);
    testReadData(ncfile, "Temperature");
    testReadSlice(ncfile, "Temperature");
    ncfile.close();
  }