Package ucar.nc2.iosp.gempak
Class GempakStationFileIOSP
- java.lang.Object
-
- ucar.nc2.iosp.AbstractIOServiceProvider
-
- ucar.nc2.iosp.gempak.GempakStationFileIOSP
-
- All Implemented Interfaces:
Comparable<IOServiceProvider>
,IOServiceProvider
- Direct Known Subclasses:
GempakSoundingIOSP
,GempakSurfaceIOSP
public abstract class GempakStationFileIOSP extends AbstractIOServiceProvider
An IOSP for Gempak Station (SF,SN) data.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ucar.nc2.iosp.IOServiceProvider
IOServiceProvider.SortGroup
-
-
Field Summary
Fields Modifier and Type Field Description protected static Dimension
DIM_LEN2
static for shared dimension of length 2protected static Dimension
DIM_LEN4
static for shared dimension of length 4protected static Dimension
DIM_LEN8
static for shared dimension of length 4protected AbstractGempakStationFileReader
gemreader
Gempak file readerprotected static Number
IMISS
Integer missing attributeprotected static String
MISSING_VAR
name for the time variableprotected StringBuilder
parseInfo
place to store debug stuffprotected static Number
RMISS
Float missing attributeprotected static String
TIME_VAR
name for the time variable-
Fields inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
location, ncfile, raf, rafOrder
-
-
Constructor Summary
Constructors Constructor Description GempakStationFileIOSP()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addGlobalAttributes()
Add on global attributes for all typesprotected void
buildNCFile()
Build the netCDF filevoid
close()
Close any resources like file handlesprotected abstract void
fillNCFile()
Fill the contents of the netCDF file.String
getCFFeatureType()
Get the CF feature type, subclasses should overrideString
getConventions()
Get the netCDF conventions identifier.String
getDetailInfo()
Get the detail informationprotected int
getStnVarSize(String name)
Get the size of a particular station variableboolean
isValidFile(RandomAccessFile raf)
Is this a valid file?protected Variable
makeMissingVariable()
Make the missing variableprotected Variable
makeParamVariable(GempakParameter param, List<Dimension> dims)
Make a variable from a GempakParmaeterprotected abstract AbstractGempakStationFileReader
makeStationReader()
Make the appropriate station file reader, subclasses need to implement thisprotected Variable
makeStationVariable(String varname, Dimension firstDim)
Make a station variableprotected List<Variable>
makeStationVars(List<GempakStation> stations, Dimension dim)
Make the station variables from a representative stationprotected Structure
makeStructure(String partName, List<Dimension> dimensions, boolean includeMissing)
Make a structure for the partvoid
open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask)
Open the service provider for reading.void
reacquire()
Reacquire any resources like file handlesvoid
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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ucar.nc2.iosp.IOServiceProvider
compareTo, getFileTypeDescription, getFileTypeId, getSortGroup, readData
-
-
-
-
Field Detail
-
gemreader
protected AbstractGempakStationFileReader gemreader
Gempak file reader
-
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 Dimension DIM_LEN8
static for shared dimension of length 4
-
DIM_LEN4
protected static final Dimension DIM_LEN4
static for shared dimension of length 4
-
DIM_LEN2
protected static final Dimension DIM_LEN2
static for shared dimension of length 2
-
TIME_VAR
protected static final String TIME_VAR
name for the time variable- See Also:
- Constant Field Values
-
MISSING_VAR
protected static final String MISSING_VAR
name for the time variable- See Also:
- Constant Field Values
-
-
Method Detail
-
isValidFile
public boolean isValidFile(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(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask) throws IOException
Open the service provider for reading.- Specified by:
open
in interfaceIOServiceProvider
- Overrides:
open
in classAbstractIOServiceProvider
- Parameters:
raf
- file to read fromncfile
- 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 interfaceIOServiceProvider
- Overrides:
close
in classAbstractIOServiceProvider
- Throws:
IOException
- problem reading file
-
release
public void release() throws IOException
Release any resources like file handles- Specified by:
release
in interfaceIOServiceProvider
- Overrides:
release
in classAbstractIOServiceProvider
- Throws:
IOException
- problem reading file
-
reacquire
public void reacquire() throws IOException
Reacquire any resources like file handles- Specified by:
reacquire
in interfaceIOServiceProvider
- Overrides:
reacquire
in classAbstractIOServiceProvider
- Throws:
IOException
- problem reading file
-
getDetailInfo
public String getDetailInfo()
Get the detail information- Specified by:
getDetailInfo
in interfaceIOServiceProvider
- Overrides:
getDetailInfo
in classAbstractIOServiceProvider
- 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 Structure makeStructure(String partName, List<Dimension> dimensions, boolean includeMissing)
Make a structure for the part- Parameters:
partName
- partnamedimensions
- dimensions for the structureincludeMissing
- true to include the missing variable- Returns:
- a Structure
-
makeMissingVariable
protected Variable makeMissingVariable()
Make the missing variable- Returns:
- the missing variable
-
makeParamVariable
protected Variable makeParamVariable(GempakParameter param, List<Dimension> dims)
Make a variable from a GempakParmaeter- Parameters:
param
- GempakParameterdims
- 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<Variable> makeStationVars(List<GempakStation> stations, Dimension dim)
Make the station variables from a representative station- Parameters:
stations
- list of stationsdim
- station dimension- Returns:
- the list of variables
-
-