Package ucar.nc2.jni.netcdf
Class Nc4Iosp
- java.lang.Object
-
- ucar.nc2.iosp.AbstractIOServiceProvider
-
- ucar.nc2.jni.netcdf.Nc4Iosp
-
- All Implemented Interfaces:
Comparable<IOServiceProvider>
,IOServiceProvider
,IOServiceProviderWriter
@Deprecated public class Nc4Iosp extends AbstractIOServiceProvider implements IOServiceProviderWriter
Deprecated.do not use, will be removed in ver 6.IOSP for reading netcdf files through JNA interface to netcdf C library
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ucar.nc2.iosp.IOServiceProvider
IOServiceProvider.SortGroup
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEBUG
Deprecated.static int
NC_TURN_OFF_LOGGING
Deprecated.static String
TRANSLATE_NC4
Deprecated.static String
TRANSLATE_NONE
Deprecated.static String
TRANSLATECONTROL
Deprecated.-
Fields inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
location, ncfile, raf, rafOrder
-
-
Constructor Summary
Constructors Constructor Description Nc4Iosp()
Deprecated.Nc4Iosp(NetcdfFileWriter.Version version)
Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
appendStructureData(Structure s, StructureData sdata)
Deprecated.Append a structureData along the unlimited dimensionvoid
close()
Deprecated.Close the file.void
create(String filename, NetcdfFile ncfile, int extra, long preallocateSize, boolean largeFile)
Deprecated.Create new file, populate it from the objects in ncfile.static void
dumpbytes(byte[] bytes, int start, int len, String tag)
Deprecated.void
flush()
Deprecated.Flush all data buffers to disk.static Nc4prototypes
getCLibrary()
Deprecated.use NetcdfClibrary.getNativeInterfaceString
getFileTypeDescription()
Deprecated.Get a human-readable description for this file type.String
getFileTypeId()
Deprecated.Get a unique id for this file type.String
getFileTypeVersion()
Deprecated.Get the version of this file type.static long
getNativeAddr(int pos, ByteBuffer buf)
Deprecated.static boolean
isClibraryPresent()
Deprecated.use NetcdfClibrary.isLibraryPresentboolean
isValidFile(RandomAccessFile raf)
Deprecated.Checks whetherraf
is a valid file NetCDF-4 file.void
open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask)
Deprecated.Open existing file, and populate ncfile with it.void
openForWriting(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask)
Deprecated.Open existing file and allow writing.Array
readData(Variable v2, Section section)
Deprecated.Read data from a top level Variable and return a memory resident Array.boolean
rewriteHeader(boolean largeFile)
Deprecated.if theres room before data, rewrite header without moving the data.Object
sendIospMessage(Object message)
Deprecated.A way to communicate arbitrary information to and from an iosp.Nc4Iosp
setAddReserved(boolean tf)
Deprecated.void
setChunker(Nc4Chunking chunker)
Deprecated.static void
setDebugFlags(DebugFlags flags)
Deprecated.void
setFill(boolean fill)
Deprecated.Set the fill flag.static void
setLibraryAndPath(String jnaPath, String libName)
Deprecated.use NetcdfClibrary.setLibraryNameAndPathstatic int
setLogLevel(int level)
Deprecated.use NetcdfClibrary.setLogLevelstatic String
show(SizeT[] inta)
Deprecated.void
updateAttribute(Variable v2, Attribute att)
Deprecated.Update the value of an existing attribute.static void
useHdfEos(boolean val)
Deprecated.void
writeData(Variable v2, Section section, Array values)
Deprecated.Write data into a variable.-
Methods inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
build, buildFinish, getDetailInfo, getLastModified, getStructureIterator, isBuilder, reacquire, readSection, readToByteChannel, readToOutputStream, release, setNetcdfFile, streamToByteChannel, syncExtend, toStringDebug
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ucar.nc2.iosp.IOServiceProvider
build, buildFinish, compareTo, getDetailInfo, getSortGroup, getStructureIterator, isBuilder, reacquire, readSection, readToByteChannel, readToOutputStream, release, streamToByteChannel, syncExtend, toStringDebug
-
-
-
-
Field Detail
-
DEBUG
public static final boolean DEBUG
Deprecated.- See Also:
- Constant Field Values
-
NC_TURN_OFF_LOGGING
public static int NC_TURN_OFF_LOGGING
Deprecated.
-
TRANSLATECONTROL
public static final String TRANSLATECONTROL
Deprecated.- See Also:
- Constant Field Values
-
TRANSLATE_NONE
public static final String TRANSLATE_NONE
Deprecated.- See Also:
- Constant Field Values
-
TRANSLATE_NC4
public static final String TRANSLATE_NC4
Deprecated.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Nc4Iosp
public Nc4Iosp()
Deprecated.
-
Nc4Iosp
public Nc4Iosp(NetcdfFileWriter.Version version)
Deprecated.
-
-
Method Detail
-
setLibraryAndPath
@Deprecated public static void setLibraryAndPath(String jnaPath, String libName)
Deprecated.use NetcdfClibrary.setLibraryNameAndPathset the path and name of the netcdf c library. must be called before load() is called.- Parameters:
jnaPath
- path to shared librarieslibName
- library name
-
isClibraryPresent
@Deprecated public static boolean isClibraryPresent()
Deprecated.use NetcdfClibrary.isLibraryPresentTest if the netcdf C library is present and loaded.- Returns:
- true if present
-
getCLibrary
@Deprecated public static Nc4prototypes getCLibrary()
Deprecated.use NetcdfClibrary.getNativeInterface
-
setLogLevel
@Deprecated public static int setLogLevel(int level)
Deprecated.use NetcdfClibrary.setLogLevelSet the log level for loaded library. Do nothing if set_log_level is not available.
-
useHdfEos
public static void useHdfEos(boolean val)
Deprecated.
-
setDebugFlags
public static void setDebugFlags(DebugFlags flags)
Deprecated.
-
setChunker
public void setChunker(Nc4Chunking chunker)
Deprecated.
-
isValidFile
public boolean isValidFile(RandomAccessFile raf) throws IOException
Deprecated.Checks whetherraf
is a valid file NetCDF-4 file. Actually, it checks whether it is a valid HDF-5 file of any type. Furthermore, it checks whether the NetCDF C library is available on the system. If both conditions are satisfied, this method returnstrue
; otherwise it returnsfalse
.- Specified by:
isValidFile
in interfaceIOServiceProvider
- Parameters:
raf
- a file on disk.- Returns:
true
ifraf
is a valid HDF-5 file and the NetCDF C library is available.- Throws:
IOException
- if an I/O error occurs.
-
getFileTypeDescription
public String getFileTypeDescription()
Deprecated.Description copied from interface:IOServiceProvider
Get a human-readable description for this file type.- Specified by:
getFileTypeDescription
in interfaceIOServiceProvider
- Returns:
- description of the file type
- See Also:
- "https://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html"
-
getFileTypeId
public String getFileTypeId()
Deprecated.Description copied from interface:IOServiceProvider
Get a unique id for this file type.- Specified by:
getFileTypeId
in interfaceIOServiceProvider
- Returns:
- registered id of the file type
- See Also:
- "https://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html"
-
getFileTypeVersion
public String getFileTypeVersion()
Deprecated.Description copied from interface:IOServiceProvider
Get the version of this file type.- Specified by:
getFileTypeVersion
in interfaceIOServiceProvider
- Overrides:
getFileTypeVersion
in classAbstractIOServiceProvider
- Returns:
- version of the file type
- See Also:
- "https://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html"
-
close
public void close() throws IOException
Deprecated.Description copied from interface:IOServiceProvider
Close the file. It is the IOServiceProvider's job to close the file (even though it didnt open it), and to free any other resources it has used.- Specified by:
close
in interfaceIOServiceProvider
- Overrides:
close
in classAbstractIOServiceProvider
- Throws:
IOException
- if read error
-
open
public void open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask) throws IOException
Deprecated.Description copied from interface:IOServiceProvider
Open existing file, and populate ncfile with it. This method is only called by the NetcdfFile constructor on itself. The provided NetcdfFile object will be empty except for the location String and the IOServiceProvider associated with this NetcdfFile object.- Specified by:
open
in interfaceIOServiceProvider
- Overrides:
open
in classAbstractIOServiceProvider
- Parameters:
raf
- the file to work on, it has already passed the isValidFile() test.ncfile
- add objects to this empty NetcdfFilecancelTask
- used to monitor user cancellation; may be null.- Throws:
IOException
- if read error
-
openForWriting
public void openForWriting(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask) throws IOException
Deprecated.Description copied from interface:IOServiceProviderWriter
Open existing file and allow writing. Netcdf-4 writing is general. Netcdf-3 writing is restricted to writing data into existing variables.- Specified by:
openForWriting
in interfaceIOServiceProviderWriter
- Parameters:
raf
- the file to work on.ncfile
- add objects to this empty NetcdfFilecancelTask
- used to monitor user cancellation; may be null.- Throws:
IOException
- if I/O error
-
dumpbytes
public static void dumpbytes(byte[] bytes, int start, int len, String tag)
Deprecated.
-
readData
public Array readData(Variable v2, Section section) throws IOException, InvalidRangeException
Deprecated.Description copied from interface:IOServiceProvider
Read data from a top level Variable and return a memory resident Array. This Array has the same element type as the Variable, and the requested shape.- Specified by:
readData
in interfaceIOServiceProvider
- Parameters:
v2
- a top-level Variablesection
- the section of data to read. There must be a Range for each Dimension in the variable, in order. Note: no nulls allowed. IOSP may not modify.- Returns:
- the requested data in a memory-resident Array
- Throws:
IOException
- if read errorInvalidRangeException
- if invalid section- See Also:
Range
-
create
public void create(String filename, NetcdfFile ncfile, int extra, long preallocateSize, boolean largeFile) throws IOException
Deprecated.Description copied from interface:IOServiceProviderWriter
Create new file, populate it from the objects in ncfile.- Specified by:
create
in interfaceIOServiceProviderWriter
- Parameters:
filename
- name of file to create.ncfile
- get everything but data from hereextra
- if > 0, pad header with extra bytespreallocateSize
- if > 0, set length of file to this upon creation - this (usually) pre-allocates contiguous storage.largeFile
- if want large file format- Throws:
IOException
- if I/O error
-
writeData
public void writeData(Variable v2, Section section, Array values) throws IOException, InvalidRangeException
Deprecated.Description copied from interface:IOServiceProviderWriter
Write data into a variable.- Specified by:
writeData
in interfaceIOServiceProviderWriter
- Parameters:
v2
- variable to write; must already exist.section
- the section of data to write. There must be a Range for each Dimension in the variable, in order. The shape must match the shape of values. The origin and stride indicate where the data is placed into the stored Variable array.values
- data to write. The shape must match section.getShape().- Throws:
IOException
- if I/O errorInvalidRangeException
- if invalid section
-
appendStructureData
public int appendStructureData(Structure s, StructureData sdata) throws IOException, InvalidRangeException
Deprecated.Description copied from interface:IOServiceProviderWriter
Append a structureData along the unlimited dimension- Specified by:
appendStructureData
in interfaceIOServiceProviderWriter
- Parameters:
s
- belongs to this structuresdata
- the stuctureData to append- Returns:
- the recnum where it was written
- Throws:
IOException
InvalidRangeException
-
flush
public void flush() throws IOException
Deprecated.Description copied from interface:IOServiceProviderWriter
Flush all data buffers to disk.- Specified by:
flush
in interfaceIOServiceProviderWriter
- Throws:
IOException
-
setAddReserved
public Nc4Iosp setAddReserved(boolean tf)
Deprecated.
-
setFill
public void setFill(boolean fill)
Deprecated.Description copied from interface:IOServiceProviderWriter
Set the fill flag. For new files, set in the create() method. This method is to set fill for existing files that you want to write. If true, the data is first written with fill values. Set to false if you expect to write all data values, set to true if you want to be sure that unwritten data values have the fill value in it.- Specified by:
setFill
in interfaceIOServiceProviderWriter
- Parameters:
fill
- set fill mode true or false
-
rewriteHeader
public boolean rewriteHeader(boolean largeFile) throws IOException
Deprecated.Description copied from interface:IOServiceProviderWriter
if theres room before data, rewrite header without moving the data. netcdf3 only- Specified by:
rewriteHeader
in interfaceIOServiceProviderWriter
- Returns:
- true if it worked
- Throws:
IOException
-
updateAttribute
public void updateAttribute(Variable v2, Attribute att) throws IOException
Deprecated.Description copied from interface:IOServiceProviderWriter
Update the value of an existing attribute. Attribute is found by name, which must match exactly. You cannot make an attribute longer, or change the number of values. For strings: truncate if longer, zero fill if shorter. Strings are padded to 4 byte boundaries, ok to use padding if it exists. For numerics: must have same number of values.- Specified by:
updateAttribute
in interfaceIOServiceProviderWriter
- Parameters:
v2
- variable, or null for global attributeatt
- replace with this value- Throws:
IOException
-
getNativeAddr
public static long getNativeAddr(int pos, ByteBuffer buf)
Deprecated.
-
sendIospMessage
public Object sendIospMessage(Object message)
Deprecated.Description copied from interface:IOServiceProvider
A way to communicate arbitrary information to and from an iosp.- Specified by:
sendIospMessage
in interfaceIOServiceProvider
- Overrides:
sendIospMessage
in classAbstractIOServiceProvider
- Parameters:
message
- opaque message sent to the IOSP object when its opened (not when isValidFile() is called)- Returns:
- opaque Object, may be null.
-
-