private int addParents(StringBuilder buff, Variable s, List<Range> section, int start) { Structure parent = s.getParentStructure(); if (parent != null) { start = addParents(buff, parent, section, start); buff.append("."); } List<Range> subSection = section.subList(start, start + s.getRank()); buff.append(getDODSConstraintName(s)); if (!s.isVariableLength()) // have to get the whole thing for a sequence !! makeSelector(buff, subSection); return start + s.getRank(); }
buff.append(getDODSConstraintName(v));
static void testArray(String urlName) throws IOException, opendap.dap.DAP2Exception { System.out.println("checkArray ="+urlName); DConnect2 dodsConnection = new DConnect2(urlName, true); // get the DataDDS DataDDS dataDDS = dodsConnection.getData("?", null); dataDDS.print(System.out); System.out.println(); DodsV root = DodsV.parseDataDDS( dataDDS); ConvertD2N converter = new ConvertD2N(); DODSNetcdfFile dodsfile = new DODSNetcdfFile(urlName); List vars = dodsfile.getVariables(); for (int i = 0; i < vars.size(); i++) { Variable v = (Variable) vars.get(i); String name = DODSNetcdfFile.getDODSConstraintName(v); DodsV dodsV = root.findByDodsShortName( name); if (dodsV == null) { System.out.println("Cant find "+name); continue; } Array data = converter.convertTopVariable(v, null, dodsV); showArray( v.getFullName(), data, System.out, ""); } /* for (int i = 0; i < root.children.size(); i++) { DodsV dodsV = (DodsV) root.children.get(i); Variable v = dodsfile.findVariable( dodsV.getNetcdfShortName()); Array data = converter.convertTopVariable(v, null, dodsV); showArray( data, System.out, ""); } */ System.out.println("============"); }