function result=nj_writeNcMLtoFile(NcMLfile, NetCDFoutfile) % nj_writeNcMLToFile : Reads an NcML and writes an equivalent NetcdfFile to % a physical file, using Netcdf-3 file format. % % Note: If NcML has referenced dataset(s) in the location URI, in that case % the underlying data (modified by the NcML is written to the new file. If % the NcML does not have a reference dataset, then the new file is filled % with fill values, like ncgen. % % Usage: result=nj_writeNcMLtoFile(NcMLfile, NetCDFoutfile); % NcMLfile - NcML file. File can be remote or local. % NetCDFoutfile - Output NetCDF file name with path. % % Calls ucar.nc2.ncml % Sachin Bhate (skbhate@gri.msstate.edu) import ucar.nc2.ncml.*; if nargin < 2 && nargout < 1 disp('Check input and output arguments!') disp('Usage:'); disp('set=nj_writeNcMLtoFile(NcMLfile, NetCDFoutfile)'); return end try disp(sprintf('\nReading NcML: %s', NcMLfile)); %write a NetCDF file disp(sprintf('\nWriting NetCDF File: %s\n', NetCDFoutfile)); NcMLReader.writeNcMLToFile(NcMLfile, NetCDFoutfile); set=1; catch disp('Write Error'); catch_error(); set=0; end if nargout result=set; end