Package ucar.nc2.iosp.gempak
Class GempakStationFileIOSP
- java.lang.Object
-
- ucar.nc2.iosp.AbstractIOServiceProvider
-
- ucar.nc2.iosp.gempak.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.AbstractIOServiceProviderAn IOSP for Gempak Station (SF,SN) data.
-
-
Field Summary
Fields Modifier and Type Field Description protected static ucar.nc2.DimensionDIM_LEN2static for shared dimension of length 2protected static ucar.nc2.DimensionDIM_LEN4static for shared dimension of length 4protected static ucar.nc2.DimensionDIM_LEN8static for shared dimension of length 4protected AbstractGempakStationFileReadergemreaderGempak file readerprotected static NumberIMISSInteger missing attributeprotected static StringMISSING_VARname for the time variableprotected StringBuilderparseInfoplace to store debug stuffprotected static NumberRMISSFloat missing attributeprotected static StringTIME_VARname for the time variable
-
Constructor Summary
Constructors Constructor Description GempakStationFileIOSP()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddGlobalAttributes()Add on global attributes for all typesprotected voidbuildNCFile()Build the netCDF filevoidclose()Close any resources like file handlesprotected abstract voidfillNCFile()Fill the contents of the netCDF file.StringgetCFFeatureType()Get the CF feature type, subclasses should overrideStringgetConventions()Get the netCDF conventions identifier.StringgetDetailInfo()Get the detail informationprotected intgetStnVarSize(String name)Get the size of a particular station variablebooleanisValidFile(ucar.unidata.io.RandomAccessFile raf)Is this a valid file?protected ucar.nc2.VariablemakeMissingVariable()Make the missing variableprotected ucar.nc2.VariablemakeParamVariable(GempakParameter param, List<ucar.nc2.Dimension> dims)Make a variable from a GempakParmaeterprotected abstract AbstractGempakStationFileReadermakeStationReader()Make the appropriate station file reader, subclasses need to implement thisprotected ucar.nc2.VariablemakeStationVariable(String varname, ucar.nc2.Dimension firstDim)Make a station variableprotected List<ucar.nc2.Variable>makeStationVars(List<GempakStation> stations, ucar.nc2.Dimension dim)Make the station variables from a representative stationprotected ucar.nc2.StructuremakeStructure(String partName, List<ucar.nc2.Dimension> dimensions, boolean includeMissing)Make a structure for the partvoidopen(ucar.unidata.io.RandomAccessFile raf, ucar.nc2.NetcdfFile ncfile, ucar.nc2.util.CancelTask cancelTask)Open the service provider for reading.voidreacquire()Reacquire any resources like file handlesvoidrelease()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
-
-
-
-
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 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
-
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(ucar.unidata.io.RandomAccessFile raf) throws IOExceptionIs 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 IOExceptionOpen the service provider for reading.- Specified by:
openin interfaceucar.nc2.iosp.IOServiceProvider- Overrides:
openin classucar.nc2.iosp.AbstractIOServiceProvider- 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 IOExceptionClose any resources like file handles- Specified by:
closein interfaceucar.nc2.iosp.IOServiceProvider- Overrides:
closein classucar.nc2.iosp.AbstractIOServiceProvider- Throws:
IOException- problem reading file
-
release
public void release() throws IOExceptionRelease any resources like file handles- Specified by:
releasein interfaceucar.nc2.iosp.IOServiceProvider- Overrides:
releasein classucar.nc2.iosp.AbstractIOServiceProvider- Throws:
IOException- problem reading file
-
reacquire
public void reacquire() throws IOExceptionReacquire any resources like file handles- Specified by:
reacquirein interfaceucar.nc2.iosp.IOServiceProvider- Overrides:
reacquirein classucar.nc2.iosp.AbstractIOServiceProvider- Throws:
IOException- problem reading file
-
getDetailInfo
public String getDetailInfo()
Get the detail information- Specified by:
getDetailInfoin interfaceucar.nc2.iosp.IOServiceProvider- Overrides:
getDetailInfoin classucar.nc2.iosp.AbstractIOServiceProvider- Returns:
- the detail info
-
buildNCFile
protected void buildNCFile() throws IOExceptionBuild the netCDF file- Throws:
IOException- problem reading the file
-
fillNCFile
protected abstract void fillNCFile() throws IOExceptionFill 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- partnamedimensions- dimensions for the structureincludeMissing- 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- 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<ucar.nc2.Variable> makeStationVars(List<GempakStation> stations, ucar.nc2.Dimension dim)
Make the station variables from a representative station- Parameters:
stations- list of stationsdim- 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 namefirstDim- station dimension- Returns:
- corresponding variable
-
-