|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectucar.nc2.FileWriter
public class FileWriter
Copy a NetcdfFile to a Netcdf-3 local file. This allows you, for example, to create a "view" of another NetcdfFile using NcML, and/or to write a remote or OpenDAP file into a local netcdf file. All metadata and data is copied out of the NetcdfFile and into the NetcdfFileWritable.
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 the static methods writeToFile() to copy an entire file. Create a FileWriter object to control exactly what gets written to the file.
NetcdfFile
Nested Class Summary | |
---|---|
static class |
FileWriter.ChunkingIndex
An index that computes chunk shapes. |
static class |
FileWriter.FileWriterProgressEvent
|
static interface |
FileWriter.FileWriterProgressListener
|
Constructor Summary | |
---|---|
FileWriter(String fileOutName,
boolean fill)
For writing parts of a NetcdfFile to a new Netcdf-3 local file. |
|
FileWriter(String fileOutName,
boolean fill,
boolean isLargeFile,
int extraHeaderBytes)
For writing parts of a NetcdfFile to a new Netcdf-3 local file. |
Method Summary | |
---|---|
static double |
copyVarData(NetcdfFileWriteable ncfile,
List<Variable> varlist,
Structure recordVar,
List<FileWriter.FileWriterProgressListener> progressListeners)
Write data from varList into new file. |
static double |
copyVarData(NetcdfFileWriteable ncfile,
List<Variable> varlist,
Structure recordVar,
long delay)
Deprecated. |
void |
finish()
Call this when all attributes, dimensions, and variables have been added. |
NetcdfFileWriteable |
getNetcdf()
Get underlying NetcdfFileWriteable |
static void |
main(String[] arg)
Main program. |
static void |
setDebugFlags(DebugFlags debugFlags)
Set debugging flags |
void |
setRecordVariable(Structure recordVar)
Read record data from here (when finish is called). |
void |
writeAttribute(String varName,
Attribute att)
Write a Variable attribute to the file. |
Dimension |
writeDimension(Dimension dim)
Add a Dimension to the file |
void |
writeGlobalAttribute(Attribute att)
Write a global attribute to the file. |
static NetcdfFile |
writeToFile(NetcdfFile fileIn,
String fileOutName)
Copy a NetcdfFile to a physical file, using Netcdf-3 file format. |
static NetcdfFile |
writeToFile(NetcdfFile fileIn,
String fileOutName,
boolean fill)
Copy a NetcdfFile to a physical file, using Netcdf-3 file format. |
static NetcdfFile |
writeToFile(NetcdfFile fileIn,
String fileOutName,
boolean fill,
boolean isLargeFile)
Copy a NetcdfFile to a physical file, using Netcdf-3 file format. |
static NetcdfFile |
writeToFile(NetcdfFile fileIn,
String fileOutName,
boolean fill,
boolean isLargeFile,
List<FileWriter.FileWriterProgressListener> progressListeners)
Copy a NetcdfFile to a physical file, using Netcdf-3 file format. |
static NetcdfFile |
writeToFile(NetcdfFile fileIn,
String fileOutName,
boolean fill,
int delay)
Deprecated. |
static NetcdfFile |
writeToFile(NetcdfFile fileIn,
String fileOutName,
boolean fill,
int delay,
boolean isLargeFile)
Deprecated. |
void |
writeVariable(Variable oldVar)
Add a Variable to the file. |
void |
writeVariables(List<Variable> varList)
Add a list of Variables to the file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileWriter(String fileOutName, boolean fill) throws IOException
fileOutName
- file name to write to.fill
- use fill mode or not
IOException
- on badpublic FileWriter(String fileOutName, boolean fill, boolean isLargeFile, int extraHeaderBytes) throws IOException
fileOutName
- file name to write to.fill
- use fill mode or notisLargeFile
- true if large file formatextraHeaderBytes
- add extra bytes in the header, or -1
IOException
- on badMethod Detail |
---|
public static void setDebugFlags(DebugFlags debugFlags)
debugFlags
- debug flagspublic static NetcdfFile writeToFile(NetcdfFile fileIn, String fileOutName) throws IOException
fileIn
- write from this NetcdfFilefileOutName
- write to this local file
IOException
- on read or write errorpublic static NetcdfFile writeToFile(NetcdfFile fileIn, String fileOutName, boolean fill) throws IOException
fileIn
- write from this NetcdfFilefileOutName
- write to this local filefill
- use fill mode
IOException
- on read or write errorpublic static NetcdfFile writeToFile(NetcdfFile fileIn, String fileOutName, boolean fill, boolean isLargeFile) throws IOException
fileIn
- write from this NetcdfFilefileOutName
- write to this local filefill
- use fill modeisLargeFile
- if true, make large file format (> 2Gb offsets)
IOException
- on read or write errorpublic static NetcdfFile writeToFile(NetcdfFile fileIn, String fileOutName, boolean fill, boolean isLargeFile, List<FileWriter.FileWriterProgressListener> progressListeners) throws IOException
fileIn
- write from this NetcdfFilefileOutName
- write to this local filefill
- use fill modeisLargeFile
- if true, make large file format (> 2Gb offsets)progressListeners
- List of progress listeners, use null or empty list if there are none.
IOException
- on read or write errorpublic static double copyVarData(NetcdfFileWriteable ncfile, List<Variable> varlist, Structure recordVar, List<FileWriter.FileWriterProgressListener> progressListeners) throws IOException
ncfile
- write tot this filevarlist
- list of varibles from the original file, with data in themrecordVar
- the record variable from the original file, or null means dont use record variablesprogressListeners
- List of progress event listeners, may be null
IOException
- if I/O errorpublic NetcdfFileWriteable getNetcdf()
public void writeGlobalAttribute(Attribute att)
att
- take attribute name, value, from herepublic void writeAttribute(String varName, Attribute att)
varName
- name of variable to attach attribute toatt
- take attribute name, value, from herepublic Dimension writeDimension(Dimension dim)
dim
- copy this dimension
public void writeVariable(Variable oldVar)
oldVar
- copy this Variable to new file.public void writeVariables(List<Variable> varList)
varList
- list of Variablepublic void setRecordVariable(Structure recordVar)
recordVar
- the record Variable.public void finish() throws IOException
IOException
- on read or write errorpublic static double copyVarData(NetcdfFileWriteable ncfile, List<Variable> varlist, Structure recordVar, long delay) throws IOException
IOException
public static NetcdfFile writeToFile(NetcdfFile fileIn, String fileOutName, boolean fill, int delay) throws IOException
IOException
public static NetcdfFile writeToFile(NetcdfFile fileIn, String fileOutName, boolean fill, int delay, boolean isLargeFile) throws IOException
IOException
public static void main(String[] arg) throws IOException
ucar.nc2.FileWriter -in fileIn -out fileOut.
where:
arg
- -in fileIn -out fileOut
IOException
- on read or write error
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |