Package ucar.nc2.iosp.sigmet
Class SigmetIOServiceProvider
- java.lang.Object
-
- ucar.nc2.iosp.AbstractIOServiceProvider
-
- ucar.nc2.iosp.sigmet.SigmetIOServiceProvider
-
- All Implemented Interfaces:
Comparable<IOServiceProvider>
,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) - See Also:
- "ftp://ftp.sigmet.com/outgoing/manuals/program/3data.pdf esp section 3.5"
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ucar.nc2.iosp.IOServiceProvider
IOServiceProvider.SortGroup
-
-
Constructor Summary
Constructors Constructor Description SigmetIOServiceProvider()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 ncfileString
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 ncfileboolean
isValidFile(RandomAccessFile raf)
Check if this is a valid SIGMET-IRIS file for this IOServiceProvider.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.static Map<String,Number>
readRecordsHdr(RandomAccessFile raf)
Read some global data from SIGMET file.Map<String,String>
readStnNames(RandomAccessFile raf)
Read StationName stringslong
readToByteChannel11(Variable v2, Section section, WritableByteChannel channel)
Read data from a top level Variable and send data to a WritableByteChannel.-
Methods inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
build, buildFinish, close, getDetailInfo, getLastModified, getStructureIterator, isBuilder, reacquire, readSection, readToByteChannel, readToOutputStream, release, sendIospMessage, 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
compareTo, getSortGroup
-
-
-
-
Method Detail
-
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:
- "https://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 interfaceIOServiceProvider
- Overrides:
getFileTypeVersion
in classAbstractIOServiceProvider
- Returns:
- version of the file type
- See Also:
- "https://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:
- "https://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 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
-
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)
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
-
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
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- 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
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
-
-