Package ucar.nc2.write
Class NetcdfCopier
- java.lang.Object
-
- ucar.nc2.write.NetcdfCopier
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class NetcdfCopier extends Object implements Closeable
Utility class for copying a NetcdfFile object, or parts of one, to a netcdf-3 or netcdf-4 file. This handles the entire CDM model (groups, etc) if you are writing to netcdf-4. If copying from an extended model to classic model, Strings are converted to Chars; nested groups are ignored. The fileIn may be an NcML file which has a referenced dataset in the location URL, the underlying data (modified by the NcML) is written to the new file. If the NcML does not have a referenced dataset, then the new file is filled with fill values, like ncgen. Use Nccopy for a command line interface. Use NetcdfFormatWriter object for a lower level API.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
static NetcdfCopier
create(NetcdfFile fileIn, NetcdfFormatWriter.Builder<?> ncwriter)
static void
setDebugFlags(DebugFlags debugFlags)
void
write(CancelTask cancel)
Write the input file to the output file.
-
-
-
Method Detail
-
setDebugFlags
public static void setDebugFlags(DebugFlags debugFlags)
-
create
public static NetcdfCopier create(NetcdfFile fileIn, NetcdfFormatWriter.Builder<?> ncwriter)
-
write
public void write(@Nullable CancelTask cancel) throws IOException
Write the input file to the output file.- Parameters:
cancel
- allow user to cancel; may be null.- Throws:
IOException
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
-