ucar.nc2.iosp.nids
Class Nidsiosp

java.lang.Object
  extended by ucar.nc2.iosp.AbstractIOServiceProvider
      extended by ucar.nc2.iosp.nids.Nidsiosp
All Implemented Interfaces:
IOServiceProvider

public class Nidsiosp
extends AbstractIOServiceProvider

IOServiceProvider implementation abstract base class to read/write "version 3" netcdf files. AKA "file format version 1" files.

see concrete class


Field Summary
protected  boolean debug
           
protected  boolean debugSize
           
protected  boolean debugSPIO
           
protected  HashMap dimHash
           
protected  int fileUsed
           
protected  boolean fill
           
protected  ucar.nc2.iosp.nids.Nidsheader headerParser
           
protected  boolean readonly
           
protected  int recStart
           
protected  boolean showHeaderBytes
           
 
Fields inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
raf
 
Constructor Summary
Nidsiosp()
           
 
Method Summary
 void close()
          Close the file.
 short convertunsignedByte2Short(byte b)
           
 void flush()
           
 String getFileTypeDescription()
          Get a human-readable description for this file type.
 String getFileTypeId()
          Get a unique id for this file type.
 float getHexDecodeValue(short val)
           
 boolean isValidFile(RandomAccessFile raf)
          checking the file
static void main(String[] args)
           
 void open(RandomAccessFile raf, NetcdfFile file, CancelTask cancelTask)
          Open the file and read the header part
 ArrayStructure readCircleStructData(String name, ByteBuffer bos, ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
          Read data
 byte[] readCompData(long hoff, long doff)
          Read compressed data
 byte[] readCompData1(byte[] uncomp, long hoff, long doff)
           
 Array readData(Variable v2, Section section)
          Read the data for each variable passed in
 Object readDistance(ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
           
 ArrayStructure readGraphicSymbolData(String name, ByteBuffer bos, ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
          Read graphic sysmbol structure data
 ArrayStructure readLinkedVectorData(String name, ByteBuffer bos, ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
          Read linked vector sturcture data
 Array readNestedCircleStructData(String name, String memberName, ByteBuffer bos, ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo, List section)
          Read nested data
 Array readNestedData(Variable v2, Section section)
          Read nested structure data
 Array readNestedDataUnlinkVector(String name, String memberName, ByteBuffer bos, ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo, List section)
          Read nested data
 Array readNestedGraphicSymbolData(String name, StructureMembers.Member m, ByteBuffer bos, ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo, List section)
          Read nested graphic symbolic structure data
 Array readNestedLinkedVectorData(String name, String memberName, ByteBuffer bos, ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo, List section)
          Read nested structure data
 Array readNestedTextStringData(String name, String memberName, ByteBuffer bos, ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo, List section)
          Read nested data
 Array readNestedVectorArrowData(String name, String memberName, ByteBuffer bos, ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo, List section)
          Read nested data
 Array readNestedWindBarbData(String name, String memberName, ByteBuffer bos, ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo, List section)
          Read nested data
 Object readOneArrayData(ByteBuffer bos, ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo, String vName)
           
 Object readOneArrayData1(ByteBuffer bos, ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
          Read data
 byte[] readOneBeamData(byte[] ddata, int rLen, int xt, int level)
          read one radial beam data
 short[] readOneBeamShortData(byte[] ddata, int rLen, int xt, int level)
          read one radial beam data
 byte[] readOneRowData(byte[] ddata, int rLen, int xt)
          Read data from encoded values and run len into regular data array
 short[] readOneRowData1(byte[] ddata, int rLen, int xt)
          Read data from encoded values and run len into regular data array
 short[] readOneRowData2(byte[] ddata, int rLen, int xt)
          Read data from encoded values and run len into regular data array
 Object readOneScanData(ByteBuffer bos, ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo, String vName)
          Read one scan radar data
 Object readRadialDataAzi(ByteBuffer bos, ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
           
 Object readRadialDataEle(ByteBuffer bos, ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
          read radail elevation array
 Object readRadialDataGate(ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
           
 Object readRadialDataLatLonAlt(double t, ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
          read radial data
 Object readTabAlphaNumData(ByteBuffer bos, ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
          Read data
 ArrayStructure readTextStringData(String name, ByteBuffer bos, ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
          Read data
 byte[] readUCompData(long hoff, long doff)
          Read uncompressed data
 ArrayStructure readUnlinkedVectorData(String name, ByteBuffer bos, ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
          Read data
 ArrayStructure readVectorArrowData(String name, ByteBuffer bos, ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
          Read data
 ArrayStructure readWindBarbData(String name, ByteBuffer bos, ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo, List sList)
          Read data
static int unsignedByteToInt(byte b)
           
 
Methods inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
getDetailInfo, getFileTypeVersion, getStructureIterator, readSection, readToByteChannel, sendIospMessage, sync, syncExtend, toStringDebug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

readonly

protected boolean readonly

headerParser

protected ucar.nc2.iosp.nids.Nidsheader headerParser

fileUsed

protected int fileUsed

recStart

protected int recStart

debug

protected boolean debug

debugSize

protected boolean debugSize

debugSPIO

protected boolean debugSPIO

showHeaderBytes

protected boolean showHeaderBytes

fill

protected boolean fill

dimHash

protected HashMap dimHash
Constructor Detail

Nidsiosp

public Nidsiosp()
Method Detail

isValidFile

public boolean isValidFile(RandomAccessFile raf)
checking the file

Parameters:
raf -
Returns:
the valid of file checking

getFileTypeId

public String getFileTypeId()
Description copied from interface: IOServiceProvider
Get a unique id for this file type.

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

getFileTypeDescription

public String getFileTypeDescription()
Description copied from interface: IOServiceProvider
Get a human-readable description for this file type.

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

open

public void open(RandomAccessFile raf,
                 NetcdfFile file,
                 CancelTask cancelTask)
          throws IOException
Open the file and read the header part

Specified by:
open in interface IOServiceProvider
Overrides:
open in class AbstractIOServiceProvider
Parameters:
raf -
file -
cancelTask -
Throws:
IOException

readNestedData

public Array readNestedData(Variable v2,
                            Section section)
                     throws IOException,
                            InvalidRangeException
Read nested structure data

Parameters:
v2 -
section -
Returns:
output data
Throws:
IOException
InvalidRangeException

readData

public Array readData(Variable v2,
                      Section section)
               throws IOException,
                      InvalidRangeException
Read the data for each variable passed in

Parameters:
v2 -
section -
Returns:
output data
Throws:
IOException
InvalidRangeException
See Also:
Range

readNestedGraphicSymbolData

public Array readNestedGraphicSymbolData(String name,
                                         StructureMembers.Member m,
                                         ByteBuffer bos,
                                         ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo,
                                         List section)
                                  throws IOException,
                                         InvalidRangeException
Read nested graphic symbolic structure data

Parameters:
name - Variable name,
m - Structure mumber name,
bos - data buffer,
vinfo - variable info,
section - variable section
Returns:
the array of member variable data
Throws:
IOException
InvalidRangeException

readGraphicSymbolData

public ArrayStructure readGraphicSymbolData(String name,
                                            ByteBuffer bos,
                                            ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
                                     throws IOException,
                                            InvalidRangeException
Read graphic sysmbol structure data

Parameters:
name - Variable name
bos - data buffer,
vinfo - variable info,
Returns:
the arraystructure of graphic symbol data
Throws:
IOException
InvalidRangeException

readNestedLinkedVectorData

public Array readNestedLinkedVectorData(String name,
                                        String memberName,
                                        ByteBuffer bos,
                                        ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo,
                                        List section)
                                 throws IOException,
                                        InvalidRangeException
Read nested structure data

Parameters:
name - Variable name,
memberName - mumber name,
bos - data buffer,
vinfo - variable info,
section - variable section
Returns:
the array of member variable data
Throws:
IOException
InvalidRangeException

readLinkedVectorData

public ArrayStructure readLinkedVectorData(String name,
                                           ByteBuffer bos,
                                           ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
                                    throws IOException,
                                           InvalidRangeException
Read linked vector sturcture data

Parameters:
name - Variable name,
bos - data buffer,
vinfo - variable info,
Returns:
the arraystructure of linked vector data
Throws:
IOException
InvalidRangeException

readNestedCircleStructData

public Array readNestedCircleStructData(String name,
                                        String memberName,
                                        ByteBuffer bos,
                                        ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo,
                                        List section)
                                 throws IOException,
                                        InvalidRangeException
Read nested data

Parameters:
name - Variable name,
memberName - Structure mumber name,
bos - Data buffer,
vinfo - variable info,
section - variable section
Returns:
the array of member variable data
Throws:
IOException
InvalidRangeException

readCircleStructData

public ArrayStructure readCircleStructData(String name,
                                           ByteBuffer bos,
                                           ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
                                    throws IOException,
                                           InvalidRangeException
Read data

Parameters:
name - Variable name,
bos - Data buffer,
vinfo - variable info,
Returns:
the arraystructure of circle struct data
Throws:
IOException
InvalidRangeException

readTabAlphaNumData

public Object readTabAlphaNumData(ByteBuffer bos,
                                  ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
                           throws IOException,
                                  InvalidRangeException
Read data

Parameters:
bos - Data buffer,
vinfo - variable info,
Returns:
the array of tab data
Throws:
IOException
InvalidRangeException

readOneScanData

public Object readOneScanData(ByteBuffer bos,
                              ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo,
                              String vName)
                       throws IOException,
                              InvalidRangeException
Read one scan radar data

Parameters:
bos - Data buffer
vinfo - variable info
Returns:
the data object of scan data
Throws:
IOException
InvalidRangeException

getHexDecodeValue

public float getHexDecodeValue(short val)

readOneBeamData

public byte[] readOneBeamData(byte[] ddata,
                              int rLen,
                              int xt,
                              int level)
                       throws IOException,
                              InvalidRangeException
read one radial beam data

Parameters:
ddata -
rLen -
xt -
level -
Returns:
one beam data array
Throws:
IOException
InvalidRangeException

readOneBeamShortData

public short[] readOneBeamShortData(byte[] ddata,
                                    int rLen,
                                    int xt,
                                    int level)
                             throws IOException,
                                    InvalidRangeException
read one radial beam data

Parameters:
ddata -
rLen -
xt -
level -
Returns:
one beam data array
Throws:
IOException
InvalidRangeException

readNestedWindBarbData

public Array readNestedWindBarbData(String name,
                                    String memberName,
                                    ByteBuffer bos,
                                    ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo,
                                    List section)
                             throws IOException,
                                    InvalidRangeException
Read nested data

Parameters:
name - Variable name,
memberName - Structure mumber name,
bos - Data buffer,
vinfo - variable info,
section - variable section
Returns:
the array of member variable data
Throws:
IOException
InvalidRangeException

readWindBarbData

public ArrayStructure readWindBarbData(String name,
                                       ByteBuffer bos,
                                       ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo,
                                       List sList)
                                throws IOException,
                                       InvalidRangeException
Read data

Parameters:
name - Variable name,
bos - Data buffer,
vinfo - variable info,
Returns:
the arraystructure of wind barb data
Throws:
IOException
InvalidRangeException

readNestedVectorArrowData

public Array readNestedVectorArrowData(String name,
                                       String memberName,
                                       ByteBuffer bos,
                                       ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo,
                                       List section)
                                throws IOException,
                                       InvalidRangeException
Read nested data

Parameters:
name - Variable name,
memberName - Structure mumber name,
bos - Data buffer,
vinfo - variable info,
section - variable section
Returns:
the array of member variable data
Throws:
IOException
InvalidRangeException

readVectorArrowData

public ArrayStructure readVectorArrowData(String name,
                                          ByteBuffer bos,
                                          ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
                                   throws IOException,
                                          InvalidRangeException
Read data

Parameters:
name - Variable name,
bos - Data buffer,
vinfo - variable info,
Returns:
the arraystructure of vector arrow data
Throws:
IOException
InvalidRangeException

readNestedTextStringData

public Array readNestedTextStringData(String name,
                                      String memberName,
                                      ByteBuffer bos,
                                      ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo,
                                      List section)
                               throws IOException,
                                      InvalidRangeException
Read nested data

Parameters:
name - Variable name,
memberName - Structure mumber name,
bos - Data buffer,
vinfo - variable info,
section - variable section
Returns:
the array of member variable data
Throws:
IOException
InvalidRangeException

readTextStringData

public ArrayStructure readTextStringData(String name,
                                         ByteBuffer bos,
                                         ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
                                  throws IOException,
                                         InvalidRangeException
Read data

Parameters:
name - Variable name,
bos - Data buffer,
vinfo - variable info
Returns:
the arraystructure of text string data
Throws:
IOException
InvalidRangeException

readNestedDataUnlinkVector

public Array readNestedDataUnlinkVector(String name,
                                        String memberName,
                                        ByteBuffer bos,
                                        ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo,
                                        List section)
                                 throws IOException,
                                        InvalidRangeException
Read nested data

Parameters:
name - Variable name,
memberName - Structure mumber name,
bos - Data buffer,
vinfo - variable info,
section - variable section
Returns:
the array of member variable data
Throws:
IOException
InvalidRangeException

readUnlinkedVectorData

public ArrayStructure readUnlinkedVectorData(String name,
                                             ByteBuffer bos,
                                             ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
                                      throws IOException,
                                             InvalidRangeException
Read data

Parameters:
name - Variable name,
bos - Data buffer,
vinfo - variable info,
Returns:
the arraystructure of unlinked vector data
Throws:
IOException
InvalidRangeException

readOneArrayData

public Object readOneArrayData(ByteBuffer bos,
                               ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo,
                               String vName)
                        throws IOException,
                               InvalidRangeException
Throws:
IOException
InvalidRangeException

readOneArrayData1

public Object readOneArrayData1(ByteBuffer bos,
                                ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
                         throws IOException,
                                InvalidRangeException
Read data

Parameters:
bos - is data buffer
vinfo - is variable info
Returns:
the data object
Throws:
IOException
InvalidRangeException

readOneRowData1

public short[] readOneRowData1(byte[] ddata,
                               int rLen,
                               int xt)
                        throws IOException,
                               InvalidRangeException
Read data from encoded values and run len into regular data array

Parameters:
ddata - is encoded data values
Returns:
the data array of row data
Throws:
IOException
InvalidRangeException

readOneRowData2

public short[] readOneRowData2(byte[] ddata,
                               int rLen,
                               int xt)
                        throws IOException,
                               InvalidRangeException
Read data from encoded values and run len into regular data array

Parameters:
ddata - is encoded data values
Returns:
the data array of row data
Throws:
IOException
InvalidRangeException

readOneRowData

public byte[] readOneRowData(byte[] ddata,
                             int rLen,
                             int xt)
                      throws IOException,
                             InvalidRangeException
Read data from encoded values and run len into regular data array

Parameters:
ddata - is encoded data values
Returns:
the data array of row data
Throws:
IOException
InvalidRangeException

readRadialDataEle

public Object readRadialDataEle(ByteBuffer bos,
                                ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
                         throws IOException,
                                InvalidRangeException
read radail elevation array

Parameters:
bos -
vinfo -
Returns:
data elevation array
Throws:
IOException
InvalidRangeException

readRadialDataLatLonAlt

public Object readRadialDataLatLonAlt(double t,
                                      ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
                               throws IOException,
                                      InvalidRangeException
read radial data

Parameters:
t -
vinfo -
Returns:
data output
Throws:
IOException
InvalidRangeException

readRadialDataAzi

public Object readRadialDataAzi(ByteBuffer bos,
                                ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
                         throws IOException,
                                InvalidRangeException
Throws:
IOException
InvalidRangeException

readDistance

public Object readDistance(ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
                    throws IOException,
                           InvalidRangeException
Throws:
IOException
InvalidRangeException

readRadialDataGate

public Object readRadialDataGate(ucar.nc2.iosp.nids.Nidsheader.Vinfo vinfo)
                          throws IOException,
                                 InvalidRangeException
Throws:
IOException
InvalidRangeException

readCompData1

public byte[] readCompData1(byte[] uncomp,
                            long hoff,
                            long doff)
                     throws IOException
Throws:
IOException

readCompData

public byte[] readCompData(long hoff,
                           long doff)
                    throws IOException
Read compressed data

Parameters:
hoff - header offset
doff - data offset
Returns:
the array of data
Throws:
IOException

readUCompData

public byte[] readUCompData(long hoff,
                            long doff)
                     throws IOException
Read uncompressed data

Parameters:
hoff - header offset
doff - data offset
Returns:
the array of data
Throws:
IOException

convertunsignedByte2Short

public short convertunsignedByte2Short(byte b)

unsignedByteToInt

public static int unsignedByteToInt(byte b)

flush

public void flush()
           throws IOException
Throws:
IOException

close

public void close()
           throws IOException
Description copied from interface: IOServiceProvider
Close the file. It is the IOServiceProvider's job to close the file (even though it didnt open it), and to free any other resources it has used.

Specified by:
close in interface IOServiceProvider
Overrides:
close in class AbstractIOServiceProvider
Throws:
IOException - if read error

main

public static void main(String[] args)
                 throws Exception,
                        IOException,
                        InstantiationException,
                        IllegalAccessException
Throws:
Exception
IOException
InstantiationException
IllegalAccessException


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.