Re: [netcdf-java] NCdumpW NetCDF Java 4.1

Hello,

I was able to chase this down in the writeNcMLAtt method of NCdumpW.

Created a temporary fix by changing:
       out.format(StringUtil.quoteXmlAttribute(att.getStringValue(i)));
to:
out.format(StringUtil.quoteXmlAttribute(att.getStringValue(i).replaceAll("%","%%")));

cheers, Dave

David Neufeld wrote:
Hello All,

I am using trying to dump a netCDF file to NCML, and am getting an exception: java.util.UnknownFormatConversionException: Conversion = '%'

Here's the code snippet:
String location = "http://dods.ndbc.noaa.gov/thredds/dodsC/data/oceansites/INCOIS/OS_MB04_20090106_TS.nc";;
nc = NetcdfDataset.openDataset(location);
fos = new FileOutputStream(new File(ncmlFolder + ncmlOutputFileName));
OutputStreamWriter ows = new OutputStreamWriter(fos);
String varNames = null;
CancelTask ct = null;

The exception seems to be thrown because several of the variables have a units attribute of '%'.

The NetCDF UI Tools seem to handle the generation of NCML ok, so I'm wondering if I should look at a different method or another alternative.
Thanks for suggestions in advance.

Dave

David Neufeld
Enterprise Data Systems Group
NOAA, NGDC, CIRES
(303) 497-6507
David.Neufeld@xxxxxxxx











  • 2009 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: