Java源码示例:opendap.dap.DAS

示例1
private static void doit(String urlName) throws IOException, DAP2Exception {
  System.out.println("DODSV read =" + urlName);
  try (DConnect2 dodsConnection = new DConnect2(urlName, true)) {

    // get the DDS
    DDS dds = dodsConnection.getDDS();
    dds.print(System.out);
    DodsV root = DodsV.parseDDS(dds);

    // get the DAS
    DAS das = dodsConnection.getDAS();
    das.print(System.out);
    root.parseDAS(das);

    // show the dodsV tree
    root.show(System.out, "");
  }
}
 
示例2
void dotest(String test) throws Exception {
  boolean constrained = false;
  this.test = test;
  this.testname = test;
  this.ce = "";
  // see if we are using constraints
  constrained = (test.indexOf(';') >= 0);
  if (constrained) {
    String[] pieces = test.split(";");
    this.testname = pieces[0];
    this.testno = pieces[1];
    this.ce = pieces[2];
    try {
      Integer.decode(this.testno);
    } catch (NumberFormatException nfe) {
      System.err.printf("Illegal constrained test testno: %s\n", test);
      return;
    }
  }

  if (constrained) {
    testdataname = "ce." + testname + "." + testno;
    url = currentTestSet.url + "/" + testname;
  } else {
    testdataname = testname;
    url = currentTestSet.url + "/" + testname;

  }
  if (verbose)
    System.out.println("*** Testing: " + testdataname);
  if (verbose)
    System.out.println("*** URL: " + url);


  if (!constrained)
    testpart(TestPart.DAS, ce);
  testpart(TestPart.DDS, ce);
  if (constrained)
    testpart(TestPart.DATADDS, ce);
  if (!pass)
    Assert.assertTrue(testname, pass);
}
 
示例3
@Test
@Ignore
public void testGetDAS() throws Exception {
    final DAS das = dConnect.getDAS();
    final Enumeration attributeNames = das.getNames();
    assertTrue(attributeNames.hasMoreElements());
    final Set<String> attributeNameSet = new HashSet<String>();
    while (attributeNames.hasMoreElements()) {
        attributeNameSet.add(attributeNames.nextElement().toString());
    }
    assertTrue(attributeNameSet.contains("lat"));
    assertTrue(attributeNameSet.contains("lon"));
    assertTrue(attributeNameSet.contains("time"));
    assertTrue(attributeNameSet.contains("time_bnds"));
    assertTrue(attributeNameSet.contains("sst"));
    assertTrue(attributeNameSet.contains("NC_GLOBAL"));

    final AttributeTable attributeTableLat = das.getAttribute("lat").getContainer();
    final Enumeration attributeTableLatNames = attributeTableLat.getNames();
    testLatLonAttributes(attributeTableLat, attributeTableLatNames, "Latitude", 88.0f, -88.0f, "latitude_north", "y");

    final AttributeTable attributeTableLon = das.getAttribute("lon").getContainer();
    final Enumeration attributeTableLonNames = attributeTableLon.getNames();
    testLatLonAttributes(attributeTableLon, attributeTableLonNames, "Longitude", 0.0f, 358.0f, "longitude_east", "x");

    final AttributeTable globalAttributes = das.getAttributeTable("NC_GLOBAL");
    assertNotNull(globalAttributes);

    final HashSet<String> globalAttributesNamesSet = new HashSet<String>();
    final Enumeration globalAttributesNames = globalAttributes.getNames();
    while (globalAttributesNames.hasMoreElements()) {
        globalAttributesNamesSet.add(globalAttributesNames.nextElement().toString());
    }
    assertTrue(globalAttributesNamesSet.contains("title"));
    assertTrue(globalAttributesNamesSet.contains("conventions"));
    assertTrue(globalAttributesNamesSet.contains("history"));
    assertTrue(globalAttributesNamesSet.contains("comments"));
    assertTrue(globalAttributesNamesSet.contains("platform"));
    assertTrue(globalAttributesNamesSet.contains("source"));
    assertTrue(globalAttributesNamesSet.contains("institution"));
    assertTrue(globalAttributesNamesSet.contains("references"));
    assertTrue(globalAttributesNamesSet.contains("citation"));

    assertEquals("NOAA Extended Reconstructed SST V3", globalAttributes.getAttribute("title").getValueAt(0));
}
 
示例4
/**
 * Get the DAS for this Dataset.
 *
 * @return the DAS
 * @throws opendap.dap.DAP2Exception
 * @throws ParseException
 */
public DAS getDAS() throws opendap.dap.DAP2Exception, ParseException;
 
示例5
/**
 * Returns an string representation of the variables value. This
 * is really foreshadowing functionality for Server types, but
 * as it may come in useful for clients it is added here. Simple
 * types (example: DFloat32) will return a single value. DConstuctor
 * and DVector types will be flattened. DStrings and DURL's will
 * have double quotes around them.
 */
public void printBrowserForm(PrintWriter pw, DAS das);