Class GempakStationFileIOSP

  • All Implemented Interfaces:
    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.
    • 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
    • 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
      • 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