ucar.nc2.iosp.sigmet
Class SigmetIOServiceProvider
java.lang.Object
ucar.nc2.iosp.AbstractIOServiceProvider
ucar.nc2.iosp.sigmet.SigmetIOServiceProvider
- All Implemented Interfaces:
- IOServiceProvider
public class SigmetIOServiceProvider
- extends AbstractIOServiceProvider
Implementation of the ServerProvider pattern provides input/output
of the SIGMET-IRIS dataset. IOSP are managed by the NetcdfFile class.
When the SigmetDataset is requested by calling NetcdfFile.open(), the file
is opened as a ucar.unidata.io.RandomAccessFile.
The SIGMET-IRIS data format are described in "IRIS Programmer's Manual" ch.3
The SIGMET-IRIS file consists of records with fixed length=6144 bytes. Data is written in
little-endian format. The organization of raw product SIGMET-IRIS file is:
Record #1 { 0,0,0,...}
Record #2 { 0,0,0,... }
---if there are several sweeps (usually 24) and one type of data:
Record #3 { ...Data for sweep 1.. }
Record #4 { ...Data for sweep 1... }
.............................................
Record #n { ...Data for sweep 1... 0.... }
Record #n+1 { ...Data for sweep 2.. }
Record #n+2 { ...Data for sweep 2... }
.............................................
Record #m { ...Data for sweep 2... 0... }
Record #m+1 { ...Data for sweep 3.. }
.............................................
Structure of "Data for sweep" is: ......
and are encoded with the compression algorithm
("IRIS Programmer's Manual" 3.5.4.1)
---if there are "n" types of data (usually 4 or 5) and one sweep:
Record #3 { ...
...Data...}
Record #4 { ...Data... }
.............................................
Record #n { ...Data... }
Structure of "Data" is: ...
... ...
and are encoded with the compression algorithm
("IRIS Programmer's Manual" 3.5.4.1)
Method Summary |
void |
close()
Close the file. |
void |
doNetcdfFileCoordinate(NetcdfFile ncfile,
int[] bst,
short[] yr,
short[] m,
short[] dda,
ArrayList<Variable> varList,
Map<String,Number> recHdr)
Fill all of the variables/attributes in the ncfile |
String |
getDetailInfo()
Show debug / underlying implementation details |
String |
getFileTypeDescription()
Get a human-readable description for this file type. |
String |
getFileTypeId()
Get a unique id for this file type. |
String |
getFileTypeVersion()
Get the version of this file type. |
ArrayList<Variable> |
init(RandomAccessFile raf,
NetcdfFile ncfile,
Map<String,String> hdrNames)
Define Dimensions, Variables, Attributes in ncfile |
boolean |
isValidFile(RandomAccessFile raf)
Check if this is a valid SIGMET-IRIS file for this IOServiceProvider. |
static void |
main(String[] args)
|
void |
open(RandomAccessFile raf,
NetcdfFile ncfile,
CancelTask cancelTask)
Open existing file, and populate ncfile with it. |
Array |
readData(Variable v2,
Section section)
Read data from a top level Variable and return a memory resident Array. |
Array |
readData1(Variable v2,
Section section)
Read data from a top level Variable and return a memory resident Array. |
Array |
readFloatData(LayoutRegular index,
Variable v2)
Read data from a top level Variable of FLOAT data type and return a memory resident Array. |
Array |
readIntData(LayoutRegular index,
Variable v2)
Read data from a top level Variable of INTEGER data type and return a memory resident Array. |
Array |
readNestedData(Variable v2,
List section)
|
static Map<String,Number> |
readRecordsHdr(RandomAccessFile raf)
Read some global data from SIGMET file. |
Map<String,String> |
readStnNames(RandomAccessFile raf)
Read StationName strings |
long |
readToByteChannel11(Variable v2,
Section section,
WritableByteChannel channel)
Read data from a top level Variable and send data to a WritableByteChannel. |
void |
setSpecial(Object special)
|
String |
toStringDebug(Object o)
Debug info for this object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
recHdr
public static Map<String,Number> recHdr
SigmetIOServiceProvider
public SigmetIOServiceProvider()
main
public static void main(String[] args)
getFileTypeDescription
public String getFileTypeDescription()
- Description copied from interface:
IOServiceProvider
- Get a human-readable description for this file type.
- Returns:
- description of the file type
- See Also:
- "http://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html"
getFileTypeVersion
public String getFileTypeVersion()
- Description copied from interface:
IOServiceProvider
- Get the version of this file type.
- Specified by:
getFileTypeVersion
in interface IOServiceProvider
- Overrides:
getFileTypeVersion
in class AbstractIOServiceProvider
- Returns:
- version of the file type
- See Also:
- "http://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html"
getFileTypeId
public String getFileTypeId()
- Description copied from interface:
IOServiceProvider
- Get a unique id for this file type.
- Returns:
- registered id of the file type
- See Also:
- "http://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html"
isValidFile
public boolean isValidFile(RandomAccessFile raf)
- Check if this is a valid SIGMET-IRIS file for this IOServiceProvider.
- Parameters:
raf
- RandomAccessFile
- Returns:
- true if valid.
open
public void open(RandomAccessFile raf,
NetcdfFile ncfile,
CancelTask cancelTask)
throws IOException
- Open existing file, and populate ncfile with it.
- Specified by:
open
in interface IOServiceProvider
- Overrides:
open
in class AbstractIOServiceProvider
- 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
readRecordsHdr
public static Map<String,Number> readRecordsHdr(RandomAccessFile raf)
- Read some global data from SIGMET file. The SIGMET file consists of records with
fixed length=6144 bytes.
readStnNames
public Map<String,String> readStnNames(RandomAccessFile raf)
- Read StationName strings
init
public ArrayList<Variable> init(RandomAccessFile raf,
NetcdfFile ncfile,
Map<String,String> hdrNames)
throws IOException
- Define Dimensions, Variables, Attributes in ncfile
- Parameters:
raf
- ucar.unidata.io.RandomAccessFile corresponds of SIGMET datafile.ncfile
- an empty NetcdfFile object which will be filled.hdrNames
- java.util.Map with values for "StationName.." Attributes
- Returns:
- ArrayList of Variables of ncfile
- Throws:
IOException
doNetcdfFileCoordinate
public void doNetcdfFileCoordinate(NetcdfFile ncfile,
int[] bst,
short[] yr,
short[] m,
short[] dda,
ArrayList<Variable> varList,
Map<String,Number> recHdr)
- Fill all of the variables/attributes in the ncfile
- Parameters:
ncfile
- NetcdfFile object which will be filled.bst
- number of seconds since midnight for start of sweepyr
- year of start of each sweepm
- month of start of each sweepdda
- day of start of each sweepvarList
- ArrayList of Variables of ncfilerecHdr
- java.util.Map with values for Attributes
readData1
public Array readData1(Variable v2,
Section section)
throws IOException,
InvalidRangeException
- Read data from a top level Variable and return a memory resident Array.
- Parameters:
v2
- Variable. It may have FLOAT/INTEGER data type.section
- wanted section of data of Variable. The section list is a list
of ucar.ma2.Range which define the requested data subset.
- Returns:
- Array of data which will be read from Variable through this call.
- Throws:
IOException
InvalidRangeException
readData
public Array readData(Variable v2,
Section section)
throws IOException,
InvalidRangeException
- 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.
- 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 error
InvalidRangeException
- if invalid section- See Also:
Range
readIntData
public Array readIntData(LayoutRegular index,
Variable v2)
throws IOException
- Read data from a top level Variable of INTEGER data type and return a memory resident Array.
- Parameters:
index
- LayoutRegular objectv2
- Variable has INTEGER data type.
- Returns:
- Array of data which will be read from Variable through this call.
- Throws:
IOException
readFloatData
public Array readFloatData(LayoutRegular index,
Variable v2)
throws IOException
- Read data from a top level Variable of FLOAT data type and return a memory resident Array.
- Parameters:
index
- LayoutRegular objectv2
- Variable has FLOAT data type.
- Returns:
- Array of data which will be read from Variable through this call.
- Throws:
IOException
readToByteChannel11
public long readToByteChannel11(Variable v2,
Section section,
WritableByteChannel channel)
throws IOException,
InvalidRangeException
- Read data from a top level Variable and send data to a WritableByteChannel.
- Parameters:
v2
- Variablesection
- wanted section of data of Variable. The section list is a list
of ucar.ma2.Range which define the requested data subset.channel
- WritableByteChannel object - channel that can write bytes.
- Returns:
- the number of bytes written, possibly zero.
- Throws:
IOException
InvalidRangeException
readNestedData
public Array readNestedData(Variable v2,
List section)
throws IOException,
InvalidRangeException
- Throws:
IOException
InvalidRangeException
close
public void close()
throws IOException
- 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 interface IOServiceProvider
- Overrides:
close
in class AbstractIOServiceProvider
- Throws:
IOException
- if read error
setSpecial
public void setSpecial(Object special)
toStringDebug
public String toStringDebug(Object o)
- Description copied from interface:
IOServiceProvider
- Debug info for this object.
- Specified by:
toStringDebug
in interface IOServiceProvider
- Overrides:
toStringDebug
in class AbstractIOServiceProvider
- Parameters:
o
- which object
- Returns:
- debug info for this object
getDetailInfo
public String getDetailInfo()
- Description copied from interface:
IOServiceProvider
- Show debug / underlying implementation details
- Specified by:
getDetailInfo
in interface IOServiceProvider
- Overrides:
getDetailInfo
in class AbstractIOServiceProvider
- Returns:
- debug info
Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.