while (tableNames.hasMoreElements()) { String tableName = (String) tableNames.nextElement(); AttributeTable attTable = das.getAttributeTableN(tableName);
while (tableNames.hasMoreElements()) { String tableName = (String) tableNames.nextElement(); AttributeTable attTable = das.getAttributeTableN(tableName); if (attTable == null) continue; // should probably never happen
/** * Checks to see if this is netcdf char array. * * @param v must be type STRING * @return string length dimension, else null */ Dimension getNetcdfStrlenDim(DODSVariable v) { AttributeTable table = das.getAttributeTableN(v.getFullName()); // LOOK this probably doesnt work for nested variables if (table == null) return null; opendap.dap.Attribute dodsAtt = table.getAttribute("DODS"); if (dodsAtt == null) return null; AttributeTable dodsTable = dodsAtt.getContainerN(); if (dodsTable == null) return null; opendap.dap.Attribute att = dodsTable.getAttribute("strlen"); if (att == null) return null; String strlen = att.getValueAtN(0); opendap.dap.Attribute att2 = dodsTable.getAttribute("dimName"); String dimName = (att2 == null) ? null : att2.getValueAtN(0); if (debugCharArray) System.out.println(v.getFullName() + " has strlen= " + strlen + " dimName= " + dimName); int dimLength; try { dimLength = Integer.parseInt(strlen); } catch (NumberFormatException e) { logger.warn("DODSNetcdfFile " + location + " var = " + v.getFullName() + " error on strlen attribute = " + strlen); return null; } if (dimLength <= 0) return null; // LOOK what about unlimited ?? return new Dimension(dimName, dimLength, dimName != null); }