ucar.nc2.dods
Class DODSNetcdfFile

java.lang.Object
  extended by ucar.nc2.NetcdfFile
      extended by ucar.nc2.dods.DODSNetcdfFile

public class DODSNetcdfFile
extends NetcdfFile

Access to DODS datasets through the Netcdf API.

Version:
$Revision:51 $ $Date:2006-07-12 17:13:13Z $
Author:
caron
See Also:
NetcdfFile

Field Summary
static boolean debugAttributes
           
static boolean debugCached
           
static boolean debugCE
           
static boolean debugCharArray
           
static boolean debugConstruct
           
static boolean debugConvertData
           
static boolean debugDataResult
           
static boolean debugOpenResult
           
static boolean debugServerCall
           
static boolean debugTime
           
static boolean showNCfile
           
 
Fields inherited from class ucar.nc2.NetcdfFile
addedRecordStructure, cacheName, cacheState, dimensions, gattributes, id, isClosed, location, rootGroup, spi, title, variables
 
Constructor Summary
DODSNetcdfFile(java.lang.String datasetURL)
          Open a DODS file.
DODSNetcdfFile(java.lang.String datasetURL, CancelTask cancelTask)
          Open a DODS file, allow user control over preloading string arrays and making structure data available through netcdf API.
 
Method Summary
static java.lang.String canonicalURL(java.lang.String urlName)
          Create the canonical form of the URL.
 void close()
          Close all resources (files, sockets, etc) associated with this file.
static int convertToDODSType(DataType dataType, boolean isUnsigned)
          Get the DODS data class corresponding to the Netcdf data type.
static DataType convertToNCType(opendap.dap.BaseType dtype)
          Get the Netcdf data type corresponding to the DODS BaseType class.
static DataType convertToNCType(int dodsDataType)
          Get the Netcdf data type corresponding to the DODS data type.
static java.lang.String getDODSshortName(Variable var)
           
static boolean isUnsigned(opendap.dap.BaseType dtype)
          Get whether this is an unsigned type.
static boolean isUnsigned(int dodsDataType)
          Get whether this is an unsigned type.
static void main(java.lang.String[] arg)
           
protected  int[] makeShape(opendap.dap.DArray dodsArray)
           
 java.util.List readArrays(java.util.List preloadVariables)
          Make a single call to the DODS Server to read all the named variable's data in one client/server roundtrip.
 Array readData(Variable v, java.util.List section)
          do not call this directly, use Variable.read() !!
 Array readMemberData(Variable v, java.util.List section, boolean flatten)
          do not call this directly, use Variable.readSection() !!
 Array readWithCE(Variable v, java.lang.String CE)
           
static void setAllowCompression(boolean b)
          Set whether to allow messages to be compressed.
static void setAllowDeflate(boolean b)
          Deprecated. use setAllowCompression
static void setAllowSessions(boolean b)
          Set whether to allow sessions by allowing cookies.
static void setDebugFlags(DebugFlags debugFlag)
          Debugging flags.
 java.lang.String toStringDebug()
           
 
Methods inherited from class ucar.nc2.NetcdfFile
addAttribute, addDimension, addGroup, addMemberVariable, addRecordStructure, addVariable, addVariableAttribute, createValidNetcdfObjectName, empty, finalize, findAttValueIgnoreCase, findDimension, findGlobalAttribute, findGlobalAttributeIgnoreCase, findTopVariable, findVariable, finish, getCacheName, getCacheState, getDetailInfo, getDimensions, getGlobalAttributes, getId, getIosp, getLocation, getRootGroup, getTitle, getUnlimitedDimension, getValidNetcdfObjectNamePattern, getVariables, hasRecordStructure, hasUnlimitedDimension, isClosed, isValidNetcdfObjectName, makeFullName, makeFullNameWithString, open, open, open, open, open, openInMemory, openInMemory, read, registerIOProvider, registerIOProvider, removeDimension, removeVariable, replaceDimension, replaceGroupVariables, replaceStructureMembers, setCacheName, setCacheState, setDebugOutputStream, setId, setLocation, setProperty, setTitle, sync, syncExtend, toString, toStringDebug, toStringEnd, toStringStart, writeCDL, writeNcML
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

debugCE

public static boolean debugCE

debugServerCall

public static boolean debugServerCall

debugOpenResult

public static boolean debugOpenResult

debugDataResult

public static boolean debugDataResult

debugCharArray

public static boolean debugCharArray

debugConvertData

public static boolean debugConvertData

debugConstruct

public static boolean debugConstruct

debugTime

public static boolean debugTime

showNCfile

public static boolean showNCfile

debugAttributes

public static boolean debugAttributes

debugCached

public static boolean debugCached
Constructor Detail

DODSNetcdfFile

public DODSNetcdfFile(java.lang.String datasetURL)
               throws java.io.IOException
Open a DODS file.

Parameters:
datasetURL - URL of the file. This should start with the protocol "dods:" It may also start with protocol "http:".
Throws:
java.io.IOException
java.net.MalformedURLException

DODSNetcdfFile

public DODSNetcdfFile(java.lang.String datasetURL,
                      CancelTask cancelTask)
               throws java.io.IOException
Open a DODS file, allow user control over preloading string arrays and making structure data available through netcdf API.

Parameters:
datasetURL - URL of the file. This should start with the protocol "dods:" or "http:".
cancelTask - check if task is cancelled. may be null.
Throws:
java.io.IOException
java.net.MalformedURLException
Method Detail

setAllowSessions

public static void setAllowSessions(boolean b)
Set whether to allow sessions by allowing cookies. This only affects requests to the TDS. Setting this to true can eliminate consistency problems for datasets that are being updated.

Parameters:
b - true or false. default is false.

setAllowDeflate

public static void setAllowDeflate(boolean b)
Deprecated. use setAllowCompression

Set whether to allow messages to be compressed.

Parameters:
b - true or false.

setAllowCompression

public static void setAllowCompression(boolean b)
Set whether to allow messages to be compressed.

Parameters:
b - true or false.

setDebugFlags

public static void setDebugFlags(DebugFlags debugFlag)
Debugging flags.

Parameters:
debugFlag -

canonicalURL

public static java.lang.String canonicalURL(java.lang.String urlName)
Create the canonical form of the URL. If the urlName starts with "http:", change it to start with "dods:", otherwise leave it alone.

Parameters:
urlName - the url string
Returns:
canonical form

close

public void close()
           throws java.io.IOException
Description copied from class: NetcdfFile
Close all resources (files, sockets, etc) associated with this file. If the underlying file was acquired, it will be released, otherwise closed.

Overrides:
close in class NetcdfFile
Throws:
java.io.IOException - if error closing

makeShape

protected int[] makeShape(opendap.dap.DArray dodsArray)

getDODSshortName

public static java.lang.String getDODSshortName(Variable var)

convertToDODSType

public static int convertToDODSType(DataType dataType,
                                    boolean isUnsigned)
Get the DODS data class corresponding to the Netcdf data type. This is the inverse of convertToNCType().

Parameters:
dataType - Netcdf data type.
Returns:
the corresponding DODS type enum, from opendap.dap.Attribute.XXXX.

convertToNCType

public static DataType convertToNCType(int dodsDataType)
Get the Netcdf data type corresponding to the DODS data type. This is the inverse of convertToDODSType().

Parameters:
dodsDataType - DODS type enum, from dods.dap.Attribute.XXXX.
Returns:
the corresponding netcdf DataType.
See Also:
isUnsigned(int)

isUnsigned

public static boolean isUnsigned(int dodsDataType)
Get whether this is an unsigned type.

Parameters:
dodsDataType - DODS type enum, from dods.dap.Attribute.XXXX.
Returns:
true if unsigned

convertToNCType

public static DataType convertToNCType(opendap.dap.BaseType dtype)
Get the Netcdf data type corresponding to the DODS BaseType class. This is the inverse of convertToDODSType().

Parameters:
dtype - DODS BaseType.
Returns:
the corresponding netcdf DataType.
See Also:
isUnsigned(int)

isUnsigned

public static boolean isUnsigned(opendap.dap.BaseType dtype)
Get whether this is an unsigned type.

Parameters:
dtype - DODS BaseType.
Returns:
true if unsigned

readArrays

public java.util.List readArrays(java.util.List preloadVariables)
                          throws java.io.IOException
Make a single call to the DODS Server to read all the named variable's data in one client/server roundtrip.

Overrides:
readArrays in class NetcdfFile
Parameters:
preloadVariables - list of type Variable
Returns:
list of type Array, contains the data
Throws:
java.io.IOException

readData

public Array readData(Variable v,
                      java.util.List section)
               throws java.io.IOException,
                      InvalidRangeException
Description copied from class: NetcdfFile
do not call this directly, use Variable.read() !!

Overrides:
readData in class NetcdfFile
Throws:
java.io.IOException
InvalidRangeException

readMemberData

public Array readMemberData(Variable v,
                            java.util.List section,
                            boolean flatten)
                     throws java.io.IOException,
                            InvalidRangeException
Description copied from class: NetcdfFile
do not call this directly, use Variable.readSection() !!

Overrides:
readMemberData in class NetcdfFile
Throws:
java.io.IOException
InvalidRangeException

readWithCE

public Array readWithCE(Variable v,
                        java.lang.String CE)
                 throws java.io.IOException
Throws:
java.io.IOException

toStringDebug

public java.lang.String toStringDebug()
Returns:
the underlying dods info for debugging

main

public static void main(java.lang.String[] arg)