[netcdf-java] how to write in-memory netcdfdataset as an nc file?

Nick Bower nick.bower at metoceanengineers.com
Tue Nov 27 20:24:42 MST 2007


Ah had I looked to the bottom of the ncml tutorial, I may have noted the 
FileWriter class;

NetcdfDataset ncd = NcMLReader.readNcML (ncml_filename, null);
NetcdfFile ncdnew = *ucar.nc2.FileWriter.writeToFile*(ncd, fileout_name, true);
ncd.close();
ncdnew.close();



Nick Bower wrote:
> Maybe this is too obvious for me to see right now, but I can't find a 
> way to simply write down an in-memory NcML document to a NetCDF file.  
> The issue seems to be that although I can create NetcdfDataset from 
> ncml and this inherits NetcdfFile, there appears no way to create 
> NetcdfFileWriteable from either.
>
> I have so far;
>
>
> public void persistNcml(String ncml, String filePath) {
>
>  InputStream ins = new ByteArrayInputStream(ncml.getBytes());
>  NetcdfDataset netcdfDataset = NcMLReader.readNcML(ins, null);
>
>  ??? [need way to persist netcdfDataset as an nc file]
>
> }
>
>
> Thanks, Nick
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.unidata.ucar.edu/mailing_lists/archives/netcdf-java/attachments/20071128/7718fca4/attachment.html 


More information about the netcdf-java mailing list