cdm/src/main/java/ucar/nc2/dt/grid/GridDatasetInfo.java
public Document makeGridForm() {
		Element rootElem = new Element("gridForm");
		Document doc = new Document(rootElem);
		rootElem.setAttribute("location", gds.getLocation());
		if (null != path)
			rootElem.setAttribute("path", path);

		// its all about grids
		List<GridDatatype> grids = gds.getGrids();
		Collections.sort(grids, new GridComparator()); // sort by time axis, vert axis, grid name


		CoordinateAxis currentTime = null;
		CoordinateAxis currentVert = null;
		Element timeElem = null;
		Element vertElem = null;
		boolean newTime;

		for (int i = 0; i < grids.size(); i++) {
			GeoGrid grid = (GeoGrid) grids.get(i);
			GridCoordSystem gcs = grid.getCoordinateSystem();


			CoordinateAxis time = gcs.getTimeAxis();
			CoordinateAxis vert = gcs.getVerticalAxis();

			/* System.out.println(" grid "+grid.getName()
              +" time="+(time == null ? " null" : time.hashCode())
              +" vert="+(vert == null ? " null" : vert.hashCode())); */

			//Assuming all variables in dataset has ensemble dim if one has
			if(i==0){
				CoordinateAxis1D ens = gcs.getEnsembleAxis();
				if(ens != null){
					Element ensAxisEl = writeAxis2(ens, "ensemble");    		  
					rootElem.addContent(ensAxisEl);
				}

			}

			if ((i == 0) || !compareAxis(time, currentTime)) {
				timeElem = new Element("timeSet");
				rootElem.addContent(timeElem);
				Element timeAxisElement = writeAxis2(time, "time");
				if (timeAxisElement != null)
					timeElem.addContent(timeAxisElement);
				currentTime = time;
				newTime = true;
			} else {
				newTime = false;
			}

			if (newTime || !compareAxis(vert, currentVert)) {
				vertElem = new Element("vertSet");
				timeElem.addContent(vertElem);
				Element vertAxisElement = writeAxis2(vert, "vert");
				if (vertAxisElement != null)
					vertElem.addContent(vertAxisElement);
				currentVert = vert;
			}

			vertElem.addContent(writeGrid(grid));
		}

		// add lat/lon bounding box
		LatLonRect bb = gds.getBoundingBox();
		if (bb != null)
			rootElem.addContent(writeBoundingBox(bb));

		// add projected bounding box
		//--> Asuming all gridSets have the same coordinates and bbox
		ProjectionRect rect = grids.get(0).getCoordinateSystem().getBoundingBox();

		Element projBBOX =new Element("projectionBox");
		Element minx = new Element("minx");
		minx.addContent( Double.valueOf(rect.getMinX()).toString() );
		projBBOX.addContent(minx);
		Element maxx = new Element("maxx");
		maxx.addContent( Double.valueOf(rect.getMaxX()).toString() );
		projBBOX.addContent(maxx);
		Element miny = new Element("miny");
		miny.addContent( Double.valueOf(rect.getMinY()).toString() );
		projBBOX.addContent(miny);
		Element maxy = new Element("maxy");    
		maxy.addContent( Double.valueOf(rect.getMaxY()).toString() );
		projBBOX.addContent(maxy);    

		rootElem.addContent(projBBOX);

		// add date range
		CalendarDate start = gds.getCalendarDateStart();
		CalendarDate end = gds.getCalendarDateEnd();
		if ((start != null) && (end != null)) {
			Element dateRange = new Element("TimeSpan");
			dateRange.addContent(new Element("begin").addContent(start.toString()));
			dateRange.addContent(new Element("end").addContent(end.toString()));
			rootElem.addContent(dateRange);
		}

		// add accept list
		addAcceptList(rootElem);

		//    Element elem = new Element("AcceptList");
		//    elem.addContent(new Element("accept").addContent("xml"));
		//    elem.addContent(new Element("accept").addContent("csv"));
		//    elem.addContent(new Element("accept").addContent("netcdf"));
		//    rootElem.addContent(elem);
		return doc;
	}
public Document makeGridForm() {
		Element rootElem = new Element("gridForm");
		Document doc = new Document(rootElem);
		rootElem.setAttribute("location", gds.getLocation());
		if (null != path)
			rootElem.setAttribute("path", path);

		// its all about grids
		List<GridDatatype> grids = gds.getGrids();
		Collections.sort(grids, new GridComparator()); // sort by time axis, vert axis, grid name


		CoordinateAxis currentTime = null;
		CoordinateAxis currentVert = null;
		Element timeElem = null;
		Element vertElem = null;
		boolean newTime;

		for (int i = 0; i < grids.size(); i++) {
			GeoGrid grid = (GeoGrid) grids.get(i);
			GridCoordSystem gcs = grid.getCoordinateSystem();


			CoordinateAxis time = gcs.getTimeAxis();
			CoordinateAxis vert = gcs.getVerticalAxis();

			/* System.out.println(" grid "+grid.getName()
              +" time="+(time == null ? " null" : time.hashCode())
              +" vert="+(vert == null ? " null" : vert.hashCode())); */

			//Assuming all variables in dataset has ensemble dim if one has
			if(i==0){
				CoordinateAxis1D ens = gcs.getEnsembleAxis();
				if(ens != null){
					Element ensAxisEl = writeAxis2(ens, "ensemble");    		  
					rootElem.addContent(ensAxisEl);
				}

			}

			if ((i == 0) || !compareAxis(time, currentTime)) {
				timeElem = new Element("timeSet");
				rootElem.addContent(timeElem);
				Element timeAxisElement = writeAxis2(time, "time");
				if (timeAxisElement != null)
					timeElem.addContent(timeAxisElement);
				currentTime = time;
				newTime = true;
			} else {
				newTime = false;
			}

			if (newTime || !compareAxis(vert, currentVert)) {
				vertElem = new Element("vertSet");
				timeElem.addContent(vertElem);
				Element vertAxisElement = writeAxis2(vert, "vert");
				if (vertAxisElement != null)
					vertElem.addContent(vertAxisElement);
				currentVert = vert;
			}

			vertElem.addContent(writeGrid(grid));
		}

		// add lat/lon bounding box
		LatLonRect bb = gds.getBoundingBox();
		if (bb != null)
			rootElem.addContent(writeBoundingBox(bb));

		// add projected bounding box
		//--> Asuming all gridSets have the same coordinates and bbox
		ProjectionRect rect = grids.get(0).getCoordinateSystem().getBoundingBox();

		Element projBBOX =new Element("projectionBox");
		Element minx = new Element("minx");
		minx.addContent( Double.valueOf(rect.getMinX()).toString() );
		projBBOX.addContent(minx);
		Element maxx = new Element("maxx");
		maxx.addContent( Double.valueOf(rect.getMaxX()).toString() );
		projBBOX.addContent(maxx);
		Element miny = new Element("miny");
		miny.addContent( Double.valueOf(rect.getMinY()).toString() );
		projBBOX.addContent(miny);
		Element maxy = new Element("maxy");    
		maxy.addContent( Double.valueOf(rect.getMaxY()).toString() );
		projBBOX.addContent(maxy);    

		rootElem.addContent(projBBOX);

		// add date range
		CalendarDate start = gds.getCalendarDateStart();
		CalendarDate end = gds.getCalendarDateEnd();
		if ((start != null) && (end != null)) {
			Element dateRange = new Element("TimeSpan");
			dateRange.addContent(new Element("begin").addContent(start.toString()));
			dateRange.addContent(new Element("end").addContent(end.toString()));
			rootElem.addContent(dateRange);
		}

		// add accept list
		addAcceptList(rootElem);

		//    Element elem = new Element("AcceptList");
		//    elem.addContent(new Element("accept").addContent("xml"));
		//    elem.addContent(new Element("accept").addContent("csv"));
		//    elem.addContent(new Element("accept").addContent("netcdf"));
		//    rootElem.addContent(elem);
		return doc;
	}
public Document makeGridForm ( ) { Element rootElem = new Element ( "gridForm" ) ; Document doc = new Document ( rootElem ) ; rootElem . setAttribute ( "location" , gds . getLocation ( ) ) ; if ( null != path ) rootElem . setAttribute ( "path" , path ) ; // its all about grids
 List < GridDatatype > grids = gds . getGrids ( ) ; Collections . sort ( grids , new GridComparator ( ) ) ; // sort by time axis, vert axis, grid name
 CoordinateAxis currentTime = null ; CoordinateAxis currentVert = null ; Element timeElem = null ; Element vertElem = null ; boolean newTime ; for ( int i = 0 ; i < grids . size ( ) ; i ++ ) { GeoGrid grid = ( GeoGrid ) grids . get ( i ) ; GridCoordSystem gcs = grid . getCoordinateSystem ( ) ; CoordinateAxis time = gcs . getTimeAxis ( ) ; CoordinateAxis vert = gcs . getVerticalAxis ( ) ; /* System.out.println(" grid "+grid.getName()
              +" time="+(time == null ? " null" : time.hashCode())
              +" vert="+(vert == null ? " null" : vert.hashCode())); */ //Assuming all variables in dataset has ensemble dim if one has
 if ( i == 0 ) { CoordinateAxis1D ens = gcs . getEnsembleAxis ( ) ; if ( ens != null ) { Element ensAxisEl = writeAxis2 ( ens , "ensemble" ) ; rootElem . addContent ( ensAxisEl ) ; } } if ( ( i == 0 ) || ! compareAxis ( time , currentTime ) ) { timeElem = new Element ( "timeSet" ) ; rootElem . addContent ( timeElem ) ; Element timeAxisElement = writeAxis2 ( time , "time" ) ; if ( timeAxisElement != null ) timeElem . addContent ( timeAxisElement ) ; currentTime = time ; newTime = true ; } else { newTime = false ; } if ( newTime || ! compareAxis ( vert , currentVert ) ) { vertElem = new Element ( "vertSet" ) ; timeElem . addContent ( vertElem ) ; Element vertAxisElement = writeAxis2 ( vert , "vert" ) ; if ( vertAxisElement != null ) vertElem . addContent ( vertAxisElement ) ; currentVert = vert ; } vertElem . addContent ( writeGrid ( grid ) ) ; } // add lat/lon bounding box
 LatLonRect bb = gds . getBoundingBox ( ) ; if ( bb != null ) rootElem . addContent ( writeBoundingBox ( bb ) ) ; // add projected bounding box
 //--> Asuming all gridSets have the same coordinates and bbox
 ProjectionRect rect = grids . get ( 0 ) . getCoordinateSystem ( ) . getBoundingBox ( ) ; Element projBBOX = new Element ( "projectionBox" ) ; Element minx = new Element ( "minx" ) ; minx . addContent ( Double . valueOf ( rect . getMinX ( ) ) . toString ( ) ) ; projBBOX . addContent ( minx ) ; Element maxx = new Element ( "maxx" ) ; maxx . addContent ( Double . valueOf ( rect . getMaxX ( ) ) . toString ( ) ) ; projBBOX . addContent ( maxx ) ; Element miny = new Element ( "miny" ) ; miny . addContent ( Double . valueOf ( rect . getMinY ( ) ) . toString ( ) ) ; projBBOX . addContent ( miny ) ; Element maxy = new Element ( "maxy" ) ; maxy . addContent ( Double . valueOf ( rect . getMaxY ( ) ) . toString ( ) ) ; projBBOX . addContent ( maxy ) ; rootElem . addContent ( projBBOX ) ; // add date range
 CalendarDate start = gds . getCalendarDateStart ( ) ; CalendarDate end = gds . getCalendarDateEnd ( ) ; if ( ( start != null ) && ( end != null ) ) { Element dateRange = new Element ( "TimeSpan" ) ; dateRange . addContent ( new Element ( "begin" ) . addContent ( start . toString ( ) ) ) ; dateRange . addContent ( new Element ( "end" ) . addContent ( end . toString ( ) ) ) ; rootElem . addContent ( dateRange ) ; } // add accept list
 addAcceptList ( rootElem ) ; //    Element elem = new Element("AcceptList");
 //    elem.addContent(new Element("accept").addContent("xml"));
 //    elem.addContent(new Element("accept").addContent("csv"));
 //    elem.addContent(new Element("accept").addContent("netcdf"));
 //    rootElem.addContent(elem);
 return doc ; }
Create the "Grid Form" XML document from this GridDataset.
Used to create the Grid HTML form, cause I dont know XSLT

@return the JDOM Document
Create the Grid Form XML document from this GridDataset . Used to create the Grid HTML form cause I dont know XSLT