Package ucar.nc2.write
Class NetcdfFormatWriter.Builder<T extends NetcdfFormatWriter.Builder<T>>
- java.lang.Object
-
- ucar.nc2.write.NetcdfFormatWriter.Builder<T>
-
- Enclosing class:
- NetcdfFormatWriter
public abstract static class NetcdfFormatWriter.Builder<T extends NetcdfFormatWriter.Builder<T>> extends Object
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
addAttribute(Attribute att)
Add a global attributeDimension
addDimension(String dimName, int length)
Add a dimension to the root group.Dimension
addDimension(Dimension dim)
Add a dimension to the root group.Structure.Builder<?>
addStructure(String shortName, String dimString)
Add a Structure to the root group.Dimension
addUnlimitedDimension(String dimName)
Add an unlimited dimension to the root group.Variable.Builder<?>
addVariable(String shortName, ArrayType dataType, String dimString)
Add a Variable to the root group.Variable.Builder<?>
addVariable(String shortName, ArrayType dataType, List<Dimension> dims)
Add a Variable to the root group.NetcdfFormatWriter
build()
Once this is called, do not use the Builder again.Group.Builder
getRootGroup()
Get the root groupT
setChunker(Nc4Chunking chunker)
Nc4Chunking, used only for netcdf4T
setExtraHeader(int extraHeaderBytes)
Set extra bytes to reserve in the header.T
setFill(boolean fill)
Set the fill flag.T
setFormat(NetcdfFileFormat format)
Set the format version.NetcdfFormatWriter.Builder<?>
setIosp(IOServiceProvider iosp)
T
setIsExisting()
T
setLocation(String location)
The file locatipnT
setPreallocateSize(long preallocateSize)
Preallocate the file size, for efficiency.T
setRootGroup(Group.Builder rootGroup)
Set the root group.T
setUseJna(boolean useJna)
Set if you want to use JNA / netcdf c library to do the writing.
-
-
-
Method Detail
-
setIosp
public NetcdfFormatWriter.Builder<?> setIosp(IOServiceProvider iosp)
-
setIsExisting
public T setIsExisting()
-
setFill
public T setFill(boolean fill)
Set the fill flag. Only used by netcdf-3. If true, the data is first written with fill values. Default is fill = true, to follow the C library. Set false if you expect to write all data values, which makes writing faster. Set true if you want to be sure that unwritten data values are set to the fill value.
-
setFormat
public T setFormat(NetcdfFileFormat format)
Set the format version. Only needed when its a new file. Default is NetcdfFileFormat.NETCDF3
-
setExtraHeader
public T setExtraHeader(int extraHeaderBytes)
Set extra bytes to reserve in the header. Only used by netcdf-3. This can prevent rewriting the entire file on redefine.- Parameters:
extraHeaderBytes
- # bytes extra for the header
-
setPreallocateSize
public T setPreallocateSize(long preallocateSize)
Preallocate the file size, for efficiency. Only used by netcdf-3.
-
setChunker
public T setChunker(Nc4Chunking chunker)
Nc4Chunking, used only for netcdf4
-
setUseJna
public T setUseJna(boolean useJna)
Set if you want to use JNA / netcdf c library to do the writing. Default is false. JNA must be used for Netcdf-4. This is used to write to Netcdf-3 format with jna.
-
addDimension
public Dimension addDimension(String dimName, int length)
Add a dimension to the root group.
-
addUnlimitedDimension
public Dimension addUnlimitedDimension(String dimName)
Add an unlimited dimension to the root group.
-
getRootGroup
public Group.Builder getRootGroup()
Get the root group
-
setRootGroup
public T setRootGroup(Group.Builder rootGroup)
Set the root group. This allows metadata to be modified externally.
-
addVariable
public Variable.Builder<?> addVariable(String shortName, ArrayType dataType, String dimString)
Add a Variable to the root group.
-
addVariable
public Variable.Builder<?> addVariable(String shortName, ArrayType dataType, List<Dimension> dims)
Add a Variable to the root group.
-
addStructure
public Structure.Builder<?> addStructure(String shortName, String dimString)
Add a Structure to the root group.
-
build
public NetcdfFormatWriter build() throws IOException
Once this is called, do not use the Builder again.- Throws:
IOException
-
-