Class SigmetIOServiceProvider

  • All Implemented Interfaces:
    ucar.nc2.iosp.IOServiceProvider

    public class SigmetIOServiceProvider
    extends ucar.nc2.iosp.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"
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static Map<String,​Number> recHdr  
      • Fields inherited from class ucar.nc2.iosp.AbstractIOServiceProvider

        location, ncfile, raf, rafOrder
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void doNetcdfFileCoordinate​(ucar.nc2.NetcdfFile ncfile, int[] bst, short[] yr, short[] m, short[] dda, ArrayList<ucar.nc2.Variable> varList, Map<String,​Number> recHdr)
      Fill all of the variables/attributes in the ncfile
      String getFileTypeDescription()  
      String getFileTypeId()  
      String getFileTypeVersion()  
      ArrayList<ucar.nc2.Variable> init​(ucar.unidata.io.RandomAccessFile raf, ucar.nc2.NetcdfFile ncfile, Map<String,​String> hdrNames)
      Define Dimensions, Variables, Attributes in ncfile
      boolean isValidFile​(ucar.unidata.io.RandomAccessFile raf)
      Check if this is a valid SIGMET-IRIS file for this IOServiceProvider.
      void open​(ucar.unidata.io.RandomAccessFile raf, ucar.nc2.NetcdfFile ncfile, ucar.nc2.util.CancelTask cancelTask)
      Open existing file, and populate ncfile with it.
      ucar.ma2.Array readData​(ucar.nc2.Variable v2, ucar.ma2.Section section)  
      ucar.ma2.Array readData1​(ucar.nc2.Variable v2, ucar.ma2.Section section)
      Read data from a top level Variable and return a memory resident Array.
      ucar.ma2.Array readFloatData​(ucar.nc2.iosp.LayoutRegular index, ucar.nc2.Variable v2)
      Read data from a top level Variable of FLOAT data type and return a memory resident Array.
      ucar.ma2.Array readIntData​(ucar.nc2.iosp.LayoutRegular index, ucar.nc2.Variable v2)
      Read data from a top level Variable of INTEGER data type and return a memory resident Array.
      static Map<String,​Number> readRecordsHdr​(ucar.unidata.io.RandomAccessFile raf)
      Read some global data from SIGMET file.
      Map<String,​String> readStnNames​(ucar.unidata.io.RandomAccessFile raf)
      Read StationName strings
      long readToByteChannel11​(ucar.nc2.Variable v2, ucar.ma2.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
    • Constructor Detail

      • SigmetIOServiceProvider

        public SigmetIOServiceProvider()
    • Method Detail

      • getFileTypeDescription

        public String getFileTypeDescription()
      • getFileTypeVersion

        public String getFileTypeVersion()
        Specified by:
        getFileTypeVersion in interface ucar.nc2.iosp.IOServiceProvider
        Overrides:
        getFileTypeVersion in class ucar.nc2.iosp.AbstractIOServiceProvider
      • getFileTypeId

        public String getFileTypeId()
      • isValidFile

        public boolean isValidFile​(ucar.unidata.io.RandomAccessFile raf)
        Check if this is a valid SIGMET-IRIS file for this IOServiceProvider.
      • open

        public void open​(ucar.unidata.io.RandomAccessFile raf,
                         ucar.nc2.NetcdfFile ncfile,
                         ucar.nc2.util.CancelTask cancelTask)
                  throws IOException
        Open existing file, and populate ncfile with it.
        Specified by:
        open in interface ucar.nc2.iosp.IOServiceProvider
        Overrides:
        open in class ucar.nc2.iosp.AbstractIOServiceProvider
        Throws:
        IOException
      • readRecordsHdr

        public static Map<String,​Number> readRecordsHdr​(ucar.unidata.io.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​(ucar.unidata.io.RandomAccessFile raf)
        Read StationName strings
      • init

        public ArrayList<ucar.nc2.Variable> init​(ucar.unidata.io.RandomAccessFile raf,
                                                 ucar.nc2.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​(ucar.nc2.NetcdfFile ncfile,
                                           int[] bst,
                                           short[] yr,
                                           short[] m,
                                           short[] dda,
                                           ArrayList<ucar.nc2.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 sweep
        yr - year of start of each sweep
        m - month of start of each sweep
        dda - day of start of each sweep
        varList - ArrayList of Variables of ncfile
        recHdr - java.util.Map with values for Attributes
      • readData1

        public ucar.ma2.Array readData1​(ucar.nc2.Variable v2,
                                        ucar.ma2.Section section)
                                 throws IOException,
                                        ucar.ma2.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
        ucar.ma2.InvalidRangeException
      • readData

        public ucar.ma2.Array readData​(ucar.nc2.Variable v2,
                                       ucar.ma2.Section section)
                                throws IOException
        Throws:
        IOException
      • readIntData

        public ucar.ma2.Array readIntData​(ucar.nc2.iosp.LayoutRegular index,
                                          ucar.nc2.Variable v2)
                                   throws IOException
        Read data from a top level Variable of INTEGER data type and return a memory resident Array.
        Parameters:
        index - LayoutRegular object
        v2 - Variable has INTEGER data type.
        Returns:
        Array of data which will be read from Variable through this call.
        Throws:
        IOException
      • readFloatData

        public ucar.ma2.Array readFloatData​(ucar.nc2.iosp.LayoutRegular index,
                                            ucar.nc2.Variable v2)
                                     throws IOException
        Read data from a top level Variable of FLOAT data type and return a memory resident Array.
        Parameters:
        index - LayoutRegular object
        v2 - Variable has FLOAT data type.
        Returns:
        Array of data which will be read from Variable through this call.
        Throws:
        IOException
      • readToByteChannel11

        public long readToByteChannel11​(ucar.nc2.Variable v2,
                                        ucar.ma2.Section section,
                                        WritableByteChannel channel)
                                 throws IOException
        Read data from a top level Variable and send data to a WritableByteChannel.
        Parameters:
        v2 - Variable
        section - 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