private Element writeAxis(CoordinateAxis axis) {
		NcMLWriter ncmlWriter = new NcMLWriter();

		Element varElem = new Element("axis");
		varElem.setAttribute("name", axis.getFullName());
		varElem.setAttribute("shape", getShapeString(axis.getShape())); // axis.getDimensionsString());

		DataType dt = axis.getDataType();
		varElem.setAttribute("type", dt.toString());

		AxisType axisType = axis.getAxisType();
		if (null != axisType)
			varElem.setAttribute("axisType", axisType.toString());

		// attributes
		for (Attribute att : axis.getAttributes()) {
			varElem.addContent(ncmlWriter.makeAttributeElement(att));
		}

		if (axis.getRank() == 1) {
			try {
				Element values = ncmlWriter.makeValuesElement(axis, true);
				varElem.addContent(values);
			} catch (IOException e) {
				String message = String.format(
						"Couldn't read values for %s. Omitting <values> element.", axis.getFullName());
				logger.warn(message, e);
			}
		}

		return varElem;
	}
private Element writeAxis ( CoordinateAxis axis ) { NcMLWriter ncmlWriter = new NcMLWriter ( ) ; Element varElem = new Element ( "axis" ) ; varElem . setAttribute ( "name" , axis . getFullName ( ) ) ; varElem . setAttribute ( "shape" , getShapeString ( axis . getShape ( ) ) ) ; DataType dt = axis . getDataType ( ) ; varElem . setAttribute ( "type" , dt . toString ( ) ) ; AxisType axisType = axis . getAxisType ( ) ; if ( null != axisType ) varElem . setAttribute ( "axisType" , axisType . toString ( ) ) ; for ( Attribute att : axis . getAttributes ( ) ) { varElem . addContent ( ncmlWriter . makeAttributeElement ( att ) ) ; } if ( axis . getRank ( ) == 1 ) { try { Element values = ncmlWriter . makeValuesElement ( axis , true ) ; varElem . addContent ( values ) ; } catch ( IOException e ) { String message = String . format ( "Couldn't read values for %s. Omitting <values> element." , axis . getFullName ( ) ) ; logger . warn ( message , e ) ; } } return varElem ; }
/* private List getDimensions(ucar.nc2.dt.GridDataset gds) {
HashSet dimHash = new HashSet();
List grids = gds.getGrids();
for (int i = 0; i < grids.size(); i++) {
GeoGrid grid = (GeoGrid) grids.get(i);
List dims = grid.getDimensions();
for (int j = 0; j < dims.size(); j++) {
Dimension dim = (Dimension) dims.get(j);
dimHash.add(dim);
}
}
List list = Arrays.asList(dimHash.toArray());
Collections.sort(list);
return list;
}