Class 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"
    • Field Detail

      • RAW_VARIABLE_PREFIX

        public static String RAW_VARIABLE_PREFIX
    • Constructor Detail

      • SigmetIOServiceProvider

        public SigmetIOServiceProvider()
    • 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"
      • 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.
      • 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.
      • 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 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 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 Variable
        section - 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 object
        v2 - 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 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​(Variable v2,
                                        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