ucar.nc2.iosp.gempak
Class GempakSurfaceIOSP

java.lang.Object
  extended by ucar.nc2.iosp.AbstractIOServiceProvider
      extended by ucar.nc2.iosp.gempak.GempakSurfaceIOSP
All Implemented Interfaces:
IOServiceProvider

public class GempakSurfaceIOSP
extends AbstractIOServiceProvider

An IOSP for Gempak Surface data. Warning: This is a work in progress and does not give readable files yet!

Author:
Unidata Java Development Team

Nested Class Summary
protected static class GempakSurfaceIOSP.MakeNetcdfFile
          TODO: generalize this static class for testing
 
Field Summary
protected  GempakSurfaceFileReader gemreader
          Gempak file reader
protected  NetcdfFile ncfile
          The netCDF file
protected  java.lang.StringBuilder parseInfo
          place to store debug stuff
protected  RandomAccessFile raf
          the file we are reading
 
Constructor Summary
GempakSurfaceIOSP()
           
 
Method Summary
 void close()
          Close this IOSP
 java.lang.String getDetailInfo()
          Get the detail information
 java.lang.String getFileTypeDescription()
          Get the file type description
 java.lang.String getFileTypeId()
          Get the file type id
 boolean isValidFile(RandomAccessFile raf)
          Is this a valid file?
static void main(java.lang.String[] args)
          Test this.
 void open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask)
          Open the service provider for reading.
 Array readData(Variable v2, Section section)
          Read the data for the variable
 boolean sync()
          Sync the file
 boolean syncExtend()
          Sync and extend
 
Methods inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
copyToByteChannel, createValidNetcdfObjectName, getFileTypeVersion, getStructureIterator, readSection, readToByteChannel, sendIospMessage, toStringDebug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ncfile

protected NetcdfFile ncfile
The netCDF file


raf

protected RandomAccessFile raf
the file we are reading


gemreader

protected GempakSurfaceFileReader gemreader
Gempak file reader


parseInfo

protected java.lang.StringBuilder parseInfo
place to store debug stuff

Constructor Detail

GempakSurfaceIOSP

public GempakSurfaceIOSP()
Method Detail

isValidFile

public boolean isValidFile(RandomAccessFile raf)
                    throws java.io.IOException
Is this a valid file?

Parameters:
raf - RandomAccessFile to check
Returns:
true if a valid Gempak grid file
Throws:
java.io.IOException - problem reading file

getFileTypeId

public java.lang.String getFileTypeId()
Get the file type id

Returns:
file type id
See Also:
"http://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html"

getFileTypeDescription

public java.lang.String getFileTypeDescription()
Get the file type description

Returns:
the file type description
See Also:
"http://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html"

open

public void open(RandomAccessFile raf,
                 NetcdfFile ncfile,
                 CancelTask cancelTask)
          throws java.io.IOException
Open the service provider for reading.

Parameters:
raf - file to read from
ncfile - netCDF file we are writing to (memory)
cancelTask - task for cancelling
Throws:
java.io.IOException - problem reading file

close

public void close()
           throws java.io.IOException
Close this IOSP

Specified by:
close in interface IOServiceProvider
Overrides:
close in class AbstractIOServiceProvider
Throws:
java.io.IOException - problem closing file

syncExtend

public boolean syncExtend()
Sync and extend

Specified by:
syncExtend in interface IOServiceProvider
Overrides:
syncExtend in class AbstractIOServiceProvider
Returns:
false

getDetailInfo

public java.lang.String getDetailInfo()
Get the detail information

Specified by:
getDetailInfo in interface IOServiceProvider
Overrides:
getDetailInfo in class AbstractIOServiceProvider
Returns:
the detail info

sync

public boolean sync()
             throws java.io.IOException
Sync the file

Specified by:
sync in interface IOServiceProvider
Overrides:
sync in class AbstractIOServiceProvider
Returns:
true if needed to sync
Throws:
java.io.IOException - problem synching the file

readData

public Array readData(Variable v2,
                      Section section)
               throws java.io.IOException,
                      InvalidRangeException
Read the data for the variable

Parameters:
v2 - Variable to read
section - section infomation
Returns:
Array of data
Throws:
java.io.IOException - problem reading from file
InvalidRangeException - invalid Range
See Also:
Range

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Test this.

Parameters:
args - file name
Throws:
java.io.IOException - problem reading the file