legacy/src/main/java/ucar/nc2/dt/point/StationObsDatasetInfo.java
public static void main(String args[]) throws IOException {
    String url = "C:/data/metars/Surface_METAR_20060326_0000.nc";

    StationObsDataset ncd = (StationObsDataset) TypedDatasetFactory.open(FeatureType.STATION, url, null, new StringBuilder());
    StationObsDatasetInfo info = new StationObsDatasetInfo(ncd, null);
    FileOutputStream fos2 = new FileOutputStream("C:/TEMP/stationCollection.xml");
    GZIPOutputStream zout =  new GZIPOutputStream( fos2);

    info.writeStationObsDatasetXML(System.out);
    info.writeStationCollectionXML(zout);

    zout.close();
    File f = new File("C:/TEMP/stationCollection.xml");
    System.out.println(" size="+f.length());
  }
public static void main(String args[]) throws IOException {
    String url = "C:/data/metars/Surface_METAR_20060326_0000.nc";

    StationObsDataset ncd = (StationObsDataset) TypedDatasetFactory.open(FeatureType.STATION, url, null, new StringBuilder());
    StationObsDatasetInfo info = new StationObsDatasetInfo(ncd, null);
    FileOutputStream fos2 = new FileOutputStream("C:/TEMP/stationCollection.xml");
    GZIPOutputStream zout =  new GZIPOutputStream( fos2);

    info.writeStationObsDatasetXML(System.out);
    info.writeStationCollectionXML(zout);

    zout.close();
    File f = new File("C:/TEMP/stationCollection.xml");
    System.out.println(" size="+f.length());
  }
debug