Package ucar.nc2.write
Class NetcdfFormatWriter.Builder
- java.lang.Object
-
- ucar.nc2.write.NetcdfFormatWriter.Builder
-
- Enclosing class:
- NetcdfFormatWriter
public static class NetcdfFormatWriter.Builder extends Object
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NetcdfFormatWriter.BuilderaddAttribute(Attribute att)Add a global attributeDimensionaddDimension(String dimName, int length)Add a dimension to the root group.DimensionaddDimension(Dimension dim)Add a dimension to the root group.Structure.BuilderaddStructure(String shortName, String dimString)Add a Structure to the root group.DimensionaddUnlimitedDimension(String dimName)Add an unlimited dimension to the root group.Variable.BuilderaddVariable(String shortName, DataType dataType, String dimString)Add a Variable to the root group.Variable.BuilderaddVariable(String shortName, DataType dataType, List<Dimension> dims)Add a Variable to the root group.NetcdfFormatWriterbuild()Once this is called, do not use the Builder again.NetcdfFileFormatgetFormat()IOServiceProvidergetIosp()Group.BuildergetRootGroup()Get the root groupNetcdfFormatWriter.BuildersetChunker(Nc4Chunking chunker)Nc4Chunking, used only for netcdf4NetcdfFormatWriter.BuildersetExtraHeader(int extraHeaderBytes)Set extra bytes to reserve in the header.NetcdfFormatWriter.BuildersetFill(boolean fill)Set the fill flag.NetcdfFormatWriter.BuildersetFormat(NetcdfFileFormat format)Set the format version.NetcdfFormatWriter.BuildersetIosp(IOServiceProvider iosp)NetcdfFormatWriter.BuildersetLocation(String location)The file locatipnNetcdfFormatWriter.BuildersetNewFile(boolean newFile)True if its a new file, false if its an existing file.NetcdfFormatWriter.BuildersetPreallocateSize(long preallocateSize)Preallocate the file size, for efficiency.NetcdfFormatWriter.BuildersetRootGroup(Group.Builder rootGroup)Set the root group.NetcdfFormatWriter.BuildersetUseJna(boolean useJna)Set if you want to use JNA / netcdf c library to do the writing.
-
-
-
Method Detail
-
setLocation
public NetcdfFormatWriter.Builder setLocation(String location)
The file locatipn
-
setIosp
public NetcdfFormatWriter.Builder setIosp(IOServiceProvider iosp)
-
getIosp
public IOServiceProvider getIosp()
-
setFormat
public NetcdfFormatWriter.Builder setFormat(NetcdfFileFormat format)
Set the format version. Only needed when its a new file. Default is NetcdfFileFormat.NETCDF3
-
getFormat
public NetcdfFileFormat getFormat()
-
setNewFile
public NetcdfFormatWriter.Builder setNewFile(boolean newFile)
True if its a new file, false if its an existing file. Default true.
-
setFill
public NetcdfFormatWriter.Builder 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.
-
setExtraHeader
public NetcdfFormatWriter.Builder 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 NetcdfFormatWriter.Builder setPreallocateSize(long preallocateSize)
Preallocate the file size, for efficiency. Only used by netcdf-3.
-
setChunker
public NetcdfFormatWriter.Builder setChunker(Nc4Chunking chunker)
Nc4Chunking, used only for netcdf4
-
setUseJna
public NetcdfFormatWriter.Builder setUseJna(boolean useJna)
Set if you want to use JNA / netcdf c library to do the writing. Default is false.
-
addAttribute
public NetcdfFormatWriter.Builder addAttribute(Attribute att)
Add a global attribute
-
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 NetcdfFormatWriter.Builder setRootGroup(Group.Builder rootGroup)
Set the root group. This allows all metadata to be built externally.
-
addVariable
public Variable.Builder addVariable(String shortName, DataType dataType, String dimString)
Add a Variable to the root group.
-
addVariable
public Variable.Builder addVariable(String shortName, DataType 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
-
-