Read data from IDL Save Files. This was written using http://www.physics.wisc.edu/~craigm/idl/savefmt/node20.html https://cow.physics.wisc.edu/~craigm/idl/savefmt.pdf and https://github.com/scipy/scipy/blob/master/scipy/io/idl.py for reference, and with no involvement from individuals at Harris Geospacial. No warranties are implied and this must be used at your own risk.
{@code
from org.autoplot.idlsupport import ReadIDLSav
reader= ReadIDLSav()
aFile= File('/tmp/aDataFile.sav')
inChannel = aFile.getChannel
fileSize = inChannel.size()
buffer = ByteBuffer.allocate( inChannel.size() )
bytesRead= 0;
while ( bytesRead
ReadIDLSav( )
TYPECODE_COMPLEX_FLOAT_SCALAR
TYPECODE_BYTE
TYPECODE_INT16
TYPECODE_INT32
TYPECODE_FLOAT
TYPECODE_DOUBLE
TYPECODE_COMPLEX_FLOAT
TYPECODE_STRING
TYPECODE_STRUCT
TYPECODE_COMPLEX_DOUBLE
TYPECODE_INT64
TYPECODE_UINT64
checkMagic
checkMagic( java.nio.channels.FileChannel inChannel ) → boolean
Parameters
inChannel - a FileChannel
Returns:
boolean
[search for examples]
[view on GitHub]
[view on old javadoc]
decodeTypeCode
decodeTypeCode( int typeCode ) → String
return a string representing the type code, if supported.
Parameters
typeCode - for example 4 which means float or 7 which means string.
Returns:
"float" or "string" or whatever the code is, or the numeric code if not supported.
[search for examples]
[view on GitHub]
[view on old javadoc]
isArray
isArray( java.nio.ByteBuffer in, String name ) → boolean
return true if the name refers to an array
Parameters
in - ByteBuffer for the entire file
name - the variable name
Returns:
td.isStructure();
[search for examples]
[view on GitHub]
[view on old javadoc]
isStructure
isStructure( java.nio.ByteBuffer in, String name ) → boolean
return true if the name refers to a structure
Parameters
in - ByteBuffer for the entire file
name - the variable name
Returns:
true if the name refers to a structure
[search for examples]
[view on GitHub]
[view on old javadoc]
readArrayDataIntoArrayOfArrays
readArrayDataIntoArrayOfArrays( org.autoplot.idlsupport.ReadIDLSav.ArrayData data ) → Object
read the data into 1-D and 2-D arrays. This is provided for reference, but
can be extended to 3-D and higher arrays, if the need arrises.
Parameters
data - a ReadIDLSav.ArrayData
Returns:
an Object
[search for examples]
[view on GitHub]
[view on old javadoc]
readFileIntoByteBuffer
readFileIntoByteBuffer( java.io.File f ) → java.nio.ByteBuffer
Parameters
f - a File
Returns:
java.nio.ByteBuffer
[search for examples]
[view on GitHub]
[view on old javadoc]
readFileIntoChannel
readFileIntoChannel( java.io.File f ) → java.nio.channels.FileChannel
Parameters
f - a File
Returns:
java.nio.channels.FileChannel
[search for examples]
[view on GitHub]
[view on old javadoc]
readStructDesc
readStructDesc( java.nio.ByteBuffer rec, long fileOffset ) → org.autoplot.idlsupport.ReadIDLSav.StructDesc
Parameters
rec - a ByteBuffer
fileOffset - a long
Returns:
org.autoplot.idlsupport.ReadIDLSav.StructDesc
[search for examples]
[view on GitHub]
[view on old javadoc]
readTagDesc
readTagDesc( java.nio.ByteBuffer in, String name ) → org.autoplot.idlsupport.ReadIDLSav.TagDesc
scan through the IDLSav and retrieve information about the array.
Parameters
in - the idlsav loaded into a ByteBuffer.
name - the name of the array
Returns:
an org.autoplot.idlsupport.ReadIDLSav.TagDesc
[search for examples]
[view on GitHub]
[view on old javadoc]
readTagDesc
readTagDesc( java.nio.channels.FileChannel inch, String name ) → org.autoplot.idlsupport.ReadIDLSav.TagDesc
scan through the IDLSav and retrieve information about the array.
Parameters
inch - the FileChannel for the idlsav
name - the name of the array
Returns:
an org.autoplot.idlsupport.ReadIDLSav.TagDesc
[search for examples]
[view on GitHub]
[view on old javadoc]
readVar
readVar( java.nio.ByteBuffer in, String name ) → Object
scan through the IDLSav and return just the one variable.
Parameters
in - the IDLSav mapped into a NIO ByteBuffer.
name - the variable name to look for.
Returns:
an Object
[search for examples]
[view on GitHub]
[view on old javadoc]
readVar
readVar( java.nio.channels.FileChannel inch, String name ) → Object
scan through the IDLSav and return just the one variable.
Parameters
inch - FileChannel for the IDLSav.
name - the variable name to look for.
Returns:
an Object
[search for examples]
[view on GitHub]
[view on old javadoc]
readVarNames
readVarNames( java.nio.ByteBuffer in ) → String[]
list the names in the IDLSav file. This is only the supported
variable types.
Parameters
in - a ByteBuffer
Returns:
the names found.
[search for examples]
[view on GitHub]
[view on old javadoc]
readVarNames
readVarNames( java.nio.channels.FileChannel inChannel ) → String[]
list the names in the IDLSav file. This is only the supported
variable types.
Parameters
inChannel - a FileChannel
Returns:
the names found.
[search for examples]
[view on GitHub]
[view on old javadoc]
readVars
readVars( java.nio.ByteBuffer in ) → java.util.Map
Parameters
in - a ByteBuffer
Returns:
java.util.Map
[search for examples]
[view on GitHub]
[view on old javadoc]
readVars( java.nio.channels.FileChannel inChannel ) → java.util.Map [view source]