cdm/src/main/java/ucar/nc2/dt/grid/GridDatasetInfo.java
public static void main(String args[]) throws IOException {
		String url = "cdmremote:http://localhost:8080/thredds/cdmremote/grib/NCDC/CFSR/NCDC-CFSR/PGB-LatLon0p5";

		GridDataset ncd = ucar.nc2.dt.grid.GridDataset.open(url);
		GridDatasetInfo info = new GridDatasetInfo(ncd, null);
		FileOutputStream fos2 = new FileOutputStream("C:/tmp2/gridInfo.xml");
		info.writeXML(info.makeGridForm(), fos2);
		fos2.close();

		String infoString = info.writeXML(info.makeGridForm());
		System.out.println(infoString);
	}
public static void main(String args[]) throws IOException {
		String url = "cdmremote:http://localhost:8080/thredds/cdmremote/grib/NCDC/CFSR/NCDC-CFSR/PGB-LatLon0p5";

		GridDataset ncd = ucar.nc2.dt.grid.GridDataset.open(url);
		GridDatasetInfo info = new GridDatasetInfo(ncd, null);
		FileOutputStream fos2 = new FileOutputStream("C:/tmp2/gridInfo.xml");
		info.writeXML(info.makeGridForm(), fos2);
		fos2.close();

		String infoString = info.writeXML(info.makeGridForm());
		System.out.println(infoString);
	}
debug

@param args ignored
@throws java.io.IOException on io error