Class GempakStationFileIOSP

  • All Implemented Interfaces:
    Comparable<ucar.nc2.iosp.IOServiceProvider>, ucar.nc2.iosp.IOServiceProvider
    Direct Known Subclasses:
    GempakSoundingIOSP, GempakSurfaceIOSP

    public abstract class GempakStationFileIOSP
    extends ucar.nc2.iosp.AbstractIOServiceProvider
    An IOSP for Gempak Station (SF,SN) data.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface ucar.nc2.iosp.IOServiceProvider

        ucar.nc2.iosp.IOServiceProvider.SortGroup
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static ucar.nc2.Dimension DIM_LEN2
      static for shared dimension of length 2
      protected static ucar.nc2.Dimension DIM_LEN4
      static for shared dimension of length 4
      protected static ucar.nc2.Dimension DIM_LEN8
      static for shared dimension of length 4
      protected AbstractGempakStationFileReader gemreader
      Gempak file reader
      protected static Number IMISS
      Integer missing attribute
      protected static String MISSING_VAR
      name for the time variable
      protected StringBuilder parseInfo
      place to store debug stuff
      protected static Number RMISS
      Float missing attribute
      protected static String TIME_VAR
      name for the time variable
      • Fields inherited from class ucar.nc2.iosp.AbstractIOServiceProvider

        location, ncfile, raf, rafOrder
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addGlobalAttributes()
      Add on global attributes for all types
      protected void buildNCFile()
      Build the netCDF file
      void close()
      Close any resources like file handles
      protected abstract void fillNCFile()
      Fill the contents of the netCDF file.
      String getCFFeatureType()
      Get the CF feature type, subclasses should override
      String getConventions()
      Get the netCDF conventions identifier.
      String getDetailInfo()
      Get the detail information
      protected int getStnVarSize​(String name)
      Get the size of a particular station variable
      boolean isValidFile​(ucar.unidata.io.RandomAccessFile raf)
      Is this a valid file?
      protected ucar.nc2.Variable makeMissingVariable()
      Make the missing variable
      protected ucar.nc2.Variable makeParamVariable​(GempakParameter param, List<ucar.nc2.Dimension> dims)
      Make a variable from a GempakParmaeter
      protected abstract AbstractGempakStationFileReader makeStationReader()
      Make the appropriate station file reader, subclasses need to implement this
      protected ucar.nc2.Variable makeStationVariable​(String varname, ucar.nc2.Dimension firstDim)
      Make a station variable
      protected List<ucar.nc2.Variable> makeStationVars​(List<GempakStation> stations, ucar.nc2.Dimension dim)
      Make the station variables from a representative station
      protected ucar.nc2.Structure makeStructure​(String partName, List<ucar.nc2.Dimension> dimensions, boolean includeMissing)
      Make a structure for the part
      void open​(ucar.unidata.io.RandomAccessFile raf, ucar.nc2.NetcdfFile ncfile, ucar.nc2.util.CancelTask cancelTask)
      Open the service provider for reading.
      void reacquire()
      Reacquire any resources like file handles
      void release()
      Release any resources like file handles
      • Methods inherited from class ucar.nc2.iosp.AbstractIOServiceProvider

        build, buildFinish, getFileTypeVersion, getLastModified, getStructureIterator, isBuilder, readSection, readToByteChannel, readToOutputStream, sendIospMessage, setNetcdfFile, streamToByteChannel, syncExtend, toStringDebug
      • Methods inherited from interface ucar.nc2.iosp.IOServiceProvider

        compareTo, getFileTypeDescription, getFileTypeId, getSortGroup, readData
    • Field Detail

      • parseInfo

        protected StringBuilder parseInfo
        place to store debug stuff
      • RMISS

        protected static final Number RMISS
        Float missing attribute
      • IMISS

        protected static final Number IMISS
        Integer missing attribute
      • DIM_LEN8

        protected static final ucar.nc2.Dimension DIM_LEN8
        static for shared dimension of length 4
      • DIM_LEN4

        protected static final ucar.nc2.Dimension DIM_LEN4
        static for shared dimension of length 4
      • DIM_LEN2

        protected static final ucar.nc2.Dimension DIM_LEN2
        static for shared dimension of length 2
    • Constructor Detail

      • GempakStationFileIOSP

        public GempakStationFileIOSP()
    • Method Detail

      • isValidFile

        public boolean isValidFile​(ucar.unidata.io.RandomAccessFile raf)
                            throws IOException
        Is this a valid file?
        Parameters:
        raf - RandomAccessFile to check
        Returns:
        true if a valid Gempak grid file
        Throws:
        IOException - problem reading file
      • makeStationReader

        protected abstract AbstractGempakStationFileReader makeStationReader()
        Make the appropriate station file reader, subclasses need to implement this
        Returns:
        the appropriate reader for that subclass
      • open

        public void open​(ucar.unidata.io.RandomAccessFile raf,
                         ucar.nc2.NetcdfFile ncfile,
                         ucar.nc2.util.CancelTask cancelTask)
                  throws IOException
        Open the service provider for reading.
        Specified by:
        open in interface ucar.nc2.iosp.IOServiceProvider
        Overrides:
        open in class ucar.nc2.iosp.AbstractIOServiceProvider
        Parameters:
        raf - file to read from
        ncfile - netCDF file we are writing to (memory)
        cancelTask - task for cancelling
        Throws:
        IOException - problem reading file
      • close

        public void close()
                   throws IOException
        Close any resources like file handles
        Specified by:
        close in interface ucar.nc2.iosp.IOServiceProvider
        Overrides:
        close in class ucar.nc2.iosp.AbstractIOServiceProvider
        Throws:
        IOException - problem reading file
      • release

        public void release()
                     throws IOException
        Release any resources like file handles
        Specified by:
        release in interface ucar.nc2.iosp.IOServiceProvider
        Overrides:
        release in class ucar.nc2.iosp.AbstractIOServiceProvider
        Throws:
        IOException - problem reading file
      • reacquire

        public void reacquire()
                       throws IOException
        Reacquire any resources like file handles
        Specified by:
        reacquire in interface ucar.nc2.iosp.IOServiceProvider
        Overrides:
        reacquire in class ucar.nc2.iosp.AbstractIOServiceProvider
        Throws:
        IOException - problem reading file
      • getDetailInfo

        public String getDetailInfo()
        Get the detail information
        Specified by:
        getDetailInfo in interface ucar.nc2.iosp.IOServiceProvider
        Overrides:
        getDetailInfo in class ucar.nc2.iosp.AbstractIOServiceProvider
        Returns:
        the detail info
      • buildNCFile

        protected void buildNCFile()
                            throws IOException
        Build the netCDF file
        Throws:
        IOException - problem reading the file
      • fillNCFile

        protected abstract void fillNCFile()
                                    throws IOException
        Fill the contents of the netCDF file. Assumes that the file has been cleared.
        Throws:
        IOException - problem reading the file
      • makeStructure

        protected ucar.nc2.Structure makeStructure​(String partName,
                                                   List<ucar.nc2.Dimension> dimensions,
                                                   boolean includeMissing)
        Make a structure for the part
        Parameters:
        partName - partname
        dimensions - dimensions for the structure
        includeMissing - true to include the missing variable
        Returns:
        a Structure
      • makeMissingVariable

        protected ucar.nc2.Variable makeMissingVariable()
        Make the missing variable
        Returns:
        the missing variable
      • makeParamVariable

        protected ucar.nc2.Variable makeParamVariable​(GempakParameter param,
                                                      List<ucar.nc2.Dimension> dims)
        Make a variable from a GempakParmaeter
        Parameters:
        param - GempakParameter
        dims - Variable dimensions
        Returns:
        the Variable
      • addGlobalAttributes

        protected void addGlobalAttributes()
        Add on global attributes for all types
      • getConventions

        public String getConventions()
        Get the netCDF conventions identifier.
        Returns:
        the convention name
      • getCFFeatureType

        public String getCFFeatureType()
        Get the CF feature type, subclasses should override
        Returns:
        the feature type
      • getStnVarSize

        protected int getStnVarSize​(String name)
        Get the size of a particular station variable
        Parameters:
        name - name of the variable (key)
        Returns:
        size or -1
      • makeStationVars

        protected List<ucar.nc2.Variable> makeStationVars​(List<GempakStation> stations,
                                                          ucar.nc2.Dimension dim)
        Make the station variables from a representative station
        Parameters:
        stations - list of stations
        dim - station dimension
        Returns:
        the list of variables
      • makeStationVariable

        protected ucar.nc2.Variable makeStationVariable​(String varname,
                                                        ucar.nc2.Dimension firstDim)
        Make a station variable
        Parameters:
        varname - variable name
        firstDim - station dimension
        Returns:
        corresponding variable