signature:
public class SDUInt32 { /** * The RelOps interface defines how each type responds to relational
 * operators . Most ( all ? ) types will not have sensible responses to all of
 * the relational operators ( e . g . DInt won ' t know how to match a regular
 * expression but DString will ) . For those operators that are nonsensical a
 * class should throw InvalidOperatorException . */
public boolean equal ( BaseType bt ) throws InvalidOperatorException , RegExpException , SBHException { } }

implementation: return ( Operator . op ( EQUAL , this , bt ) ) ;


signature:
public class SDUInt32 { /** * Server - side serialization for OPeNDAP variables ( sub - classes of
 * < code > BaseType < / code > ) .
 * This does not send the entire class as the Java < code > Serializable < / code >
 * interface does , rather it sends only the binary data values . Other software
 * is responsible for sending variable type information ( see < code > DDS < / code > ) .
 * Writes data to a < code > DataOutputStream < / code > . This method is used
 * on the server side of the OPeNDAP client / server connection , and possibly
 * by GUI clients which need to download OPeNDAP data , manipulate it , and
 * then re - save it as a binary file .
 * @ param sink a < code > DataOutputStream < / code > to write to .
 * @ throws IOException thrown on any < code > OutputStream < / code > exception .
 * @ see BaseType
 * @ see DDS
 * @ see ServerDDS */
public void serialize ( String dataset , DataOutputStream sink , CEEvaluator ce , Object specialO ) throws NoSuchVariableException , DAP2ServerSideException , IOException { } }

implementation: if ( ! isRead ( ) ) read ( dataset , specialO ) ; if ( ce . evalClauses ( specialO ) ) externalize ( sink ) ;


signature:
public class BaseType { /** * Sets the unencoded name of the class instance .
 * @ param clearname the unencoded name of the class instance . */
@ Override public void setClearName ( String clearname ) { } }

implementation: super . setClearName ( clearname ) ; if ( _attr != null ) _attr . setClearName ( clearname ) ; if ( _attrTbl != null ) _attrTbl . setClearName ( clearname ) ;


signature:
public class BaseType { /** * Write the variable ' s declaration in a C - style syntax . This
 * function is used to create textual representation of the Data
 * Descriptor Structure ( DDS ) . See < em > The OPeNDAP User Manual < / em > for
 * information about this structure .
 * @ param os The < code > PrintWriter < / code > on which to print the
 * declaration .
 * @ param space Each line of the declaration will begin with the
 * characters in this string . Usually used for leading spaces .
 * @ param print _ semi a boolean value indicating whether to print a
 * semicolon at the end of the declaration .
 * @ param constrained a boolean value indicating whether to print
 * the declartion dependent on the projection information . < b > This
 * is only used by Server side code . < / b >
 * @ see DDS */
public void printDecl ( PrintWriter os , String space , boolean print_semi , boolean constrained ) { } }

implementation:
// LogStream . out . println ( " BaseType . printDecl ( ) . . . " ) ;
os . print ( space + getTypeName ( ) + " " + getEncodedName ( ) ) ; if ( print_semi ) os . println ( ";" ) ;


signature:
public class BaseType { /** * Print the variable ' s declaration . Same as
 * < code > printDecl ( os , space , true ) < / code > .
 * @ param os The < code > PrintWriter < / code > on which to print the
 * declaration .
 * @ param space Each line of the declaration will begin with the
 * characters in this string . Usually used for leading spaces .
 * @ see DDS # print ( PrintWriter ) */
public final void printDecl ( PrintWriter os , String space ) { } }

implementation: printDecl ( os , space , true , false ) ;


signature:
public class BaseType { /** * Print the variable ' s declaration using < code > OutputStream < / code > .
 * @ param os The < code > OutputStream < / code > on which to print the
 * declaration .
 * @ param space Each line of the declaration will begin with the
 * characters in this string . Usually used for leading spaces .
 * @ param print _ semi a boolean value indicating whether to print a
 * semicolon at the end of the declaration .
 * @ see DDS # print ( PrintWriter ) */
public final void printDecl ( OutputStream os , String space , boolean print_semi , boolean constrained ) { } }

implementation: PrintWriter pw = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( os , Util . UTF8 ) ) ) ; printDecl ( pw , space , print_semi , constrained ) ; pw . flush ( ) ;


signature:
public class BaseType { /** * Print the variable ' s declaration using < code > OutputStream < / code > .
 * @ param os The < code > OutputStream < / code > on which to print the
 * declaration .
 * @ param space Each line of the declaration will begin with the
 * characters in this string . Usually used for leading spaces .
 * @ param print _ semi a boolean value indicating whether to print a
 * semicolon at the end of the declaration .
 * @ see DDS # print ( PrintWriter ) */
public final void printDecl ( OutputStream os , String space , boolean print_semi ) { } }

implementation: printDecl ( os , space , print_semi , false ) ;


signature:
public class BaseType { /** * Returns a clone of this < code > BaseType < / code > .
 * See DAPNode . cloneDAG .
 * @ param map The set of already cloned nodes .
 * @ return a clone of this < code > BaseType < / code > . */
public DAPNode cloneDAG ( CloneMap map ) throws CloneNotSupportedException { } }

implementation: BaseType bt = ( BaseType ) super . cloneDAG ( map ) ; if ( this . _attrTbl != null ) bt . _attrTbl = ( AttributeTable ) cloneDAG ( map , this . _attrTbl ) ; if ( this . _attr != null ) bt . _attr = new Attribute ( getClearName ( ) , bt . _attrTbl ) ; return bt ;


signature:
public class NcTimeInstantType { /** * wml2 : Collection / wml2 : observationMember / om : OM _ Observation / om : resultTime / gml : TimeInstant */
public static TimeInstantType initTimeInstant ( TimeInstantType timeInstant ) { } }

implementation:
// @ gml : id
String id = MarshallingUtil . createIdForType ( TimeInstantType . class ) ; timeInstant . setId ( id ) ; // gml : timePosition
NcTimePositionType . initTimePosition ( timeInstant . addNewTimePosition ( ) ) ; return timeInstant ;


signature:
public class UnidataPointDatasetHelper { /** * Tries to find the coordinate variable of the specified type .
 * @ param ds search in this dataset
 * @ param a AxisType . LAT , LON , HEIGHT , or TIME
 * @ return coordinate variable , or null if not found . */
static public String getCoordinateName ( NetcdfDataset ds , AxisType a ) { } }

implementation:
List < Variable > varList = ds . getVariables ( ) ; for ( Variable v : varList ) { if ( v instanceof Structure ) { List < Variable > vars = ( ( Structure ) v ) . getVariables ( ) ; for ( Variable vs : vars ) { String axisType = ds . findAttValueIgnoreCase ( vs , _Coordinate . AxisType , null ) ; if ( ( axisType != null ) && axisType . equals ( a . toString ( ) ) ) return vs . getShortName ( ) ; } } else { String axisType = ds . findAttValueIgnoreCase ( v , _Coordinate . AxisType , null ) ; if ( ( axisType != null ) && axisType . equals ( a . toString ( ) ) ) return v . getShortName ( ) ; } } if ( a == AxisType . Lat ) return findVariableName ( ds , "latitude" ) ; if ( a == AxisType . Lon ) return findVariableName ( ds , "longitude" ) ; if ( a == AxisType . Time ) return findVariableName ( ds , "time" ) ; if ( a == AxisType . Height ) { Variable v = findVariable ( ds , "altitude" ) ; if ( null == v ) v = findVariable ( ds , "depth" ) ; if ( v != null ) return v . getShortName ( ) ; } // I think the CF part is done by the CoordSysBuilder adding the _ CoordinateAxisType attrinutes .
return null ;


signature:
public class UnidataPointDatasetHelper { /** * Tries to find the coordinate variable of the specified type , which has the specified dimension as its firsst dimension
 * @ param ds search in this dataset
 * @ param a AxisType . LAT , LON , HEIGHT , or TIME
 * @ param dim must use this dimension
 * @ return coordinate variable , or null if not found . */
static public String getCoordinateName ( NetcdfDataset ds , AxisType a , Dimension dim ) { } }

implementation: String name = getCoordinateName ( ds , a ) ; if ( name == null ) return null ; Variable v = ds . findVariable ( name ) ; if ( v == null ) return null ; if ( v . isScalar ( ) ) return null ; if ( ! v . getDimension ( 0 ) . equals ( dim ) ) return null ; return name ;


signature:
public class ErrorResponse { /** * Convert an ErrorResponse to the equivalent XML
 * @ return XML representation of the ErrorResponse */
public String buildXML ( ) { } }

implementation: StringBuilder response = new StringBuilder ( ) ; response . append ( "<Error" ) ; if ( code > 0 ) response . append ( String . format ( " httpcode=\"%d\"" , code ) ) ; response . append ( ">\n" ) ; if ( message != null ) response . append ( "<Message>" + getMessage ( ) + "</Message>\n" ) ; if ( context != null ) response . append ( "<Context>" + getContext ( ) + "</Context>\n" ) ; if ( otherinfo != null ) response . append ( "<OtherInformation>" + getOtherInfo ( ) + "</OtherInformation>\n" ) ; return response . toString ( ) ;


signature:
public class ErrorResponse { /** * Convert an ErrorResponse to the equivalent DapException .
 * @ return DapException representation of the ErrorResponse */
public DapException buildException ( ) { } }

implementation: String XML = buildXML ( ) ; DapException dapex = new DapException ( XML ) . setCode ( code ) ; return dapex ;


signature:
public class AWIPSConvention { /** * return the list of Dimensions that were created */
private List < Dimension > breakupLevels ( NetcdfDataset ds , Variable levelVar ) throws IOException { } }

implementation:
if ( debugBreakup ) parseInfo . format ( "breakupLevels = %s%n" , levelVar . getShortName ( ) ) ; List < Dimension > dimList = new ArrayList < > ( ) ; ArrayChar levelVarData ; try { levelVarData = ( ArrayChar ) levelVar . read ( ) ; } catch ( IOException ioe ) { return dimList ; } List < String > values = null ; String currentUnits = null ; ArrayChar . StringIterator iter = levelVarData . getStringIterator ( ) ; while ( iter . hasNext ( ) ) { String s = iter . next ( ) ; if ( debugBreakup ) parseInfo . format ( "   %s%n" , s ) ; StringTokenizer stoke = new StringTokenizer ( s ) ; /* problem with blank string :
 char pvvLevels ( levels _ 35 = 35 , charsPerLevel = 10 ) ;
 " MB 1000 " , " MB 975 " , " MB 950 " , " MB 925 " , " MB 900 " , " MB 875 " , " MB 850 " , " MB 825 " , " MB 800 " , " MB 775 " , " MB 750 " ,
 " MB 725 " , " MB 700 " , " MB 675 " , " MB 650 " , " MB 625 " , " MB 600 " , " MB 575 " , " MB 550 " , " MB 525 " , " MB 500 " , " MB 450 " ,
 " MB 400 " , " MB 350 " , " MB 300 " , " MB 250 " , " MB 200 " , " MB 150 " , " MB 100 " , " BL 0 30 " , " BL 60 90 " , " BL 90 120 " , " BL 120 150 " ,
 " BL 150 180 " , " " */
if ( ! stoke . hasMoreTokens ( ) ) continue ; // skip it
// first token is the unit
String units = stoke . nextToken ( ) . trim ( ) ; if ( ! units . equals ( currentUnits ) ) { if ( values != null ) dimList . add ( makeZCoordAxis ( ds , values , currentUnits ) ) ; values = new ArrayList < > ( ) ; currentUnits = units ; } // next token is the value
if ( stoke . hasMoreTokens ( ) ) values . add ( stoke . nextToken ( ) ) ; else values . add ( "0" ) ; } if ( values != null ) dimList . add ( makeZCoordAxis ( ds , values , currentUnits ) ) ; if ( debugBreakup ) parseInfo . format ( "  done breakup%n" ) ; return dimList ;


signature:
public class AWIPSConvention { /** * make a new variable out of the list in " values " */
private Dimension makeZCoordAxis ( NetcdfDataset ds , List < String > values , String units ) throws IOException { } }

implementation:
int len = values . size ( ) ; String name = makeZCoordName ( units ) ; if ( len > 1 ) name = name + Integer . toString ( len ) ; else name = name + values . get ( 0 ) ; StringUtil2 . replace ( name , ' ' , "-" ) ; Dimension dim ; if ( null != ( dim = ds . getRootGroup ( ) . findDimension ( name ) ) ) { if ( dim . getLength ( ) == len ) { // check against actual values
Variable coord = ds . getRootGroup ( ) . findVariable ( name ) ; Array coordData = coord . read ( ) ; Array newData = Array . makeArray ( coord . getDataType ( ) , values ) ; if ( MAMath . nearlyEquals ( coordData , newData ) ) { if ( debugBreakup ) parseInfo . format ( "  use existing coord %s%n" , dim ) ; return dim ; } } } String orgName = name ; int count = 1 ; while ( ds . getRootGroup ( ) . findDimension ( name ) != null ) { name = orgName + "-" + count ; count ++ ; } // create new one
dim = new Dimension ( name , len ) ; ds . addDimension ( null , dim ) ; if ( debugBreakup ) parseInfo . format ( "  make Dimension = %s length = %d%n" , name , len ) ; // if ( len < 2 ) return dim ; / / skip 1D
if ( debugBreakup ) { parseInfo . format ( "  make ZCoordAxis = = %s length = %d%n" , name , len ) ; } CoordinateAxis v = new CoordinateAxis1D ( ds , null , name , DataType . DOUBLE , name , makeUnitsName ( units ) , makeLongName ( name ) ) ; String positive = getZisPositive ( ds , v ) ; if ( null != positive ) v . addAttribute ( new Attribute ( _Coordinate . ZisPositive , positive ) ) ; v . setValues ( values ) ; ds . addCoordinateAxis ( v ) ; parseInfo . format ( "Created Z Coordinate Axis = " ) ; v . getNameAndDimensions ( parseInfo , true , false ) ; parseInfo . format ( "%n" ) ; return dim ;


signature:
public class AWIPSConvention { /** * create new variables as sections of ncVar */
private void createNewVariables ( NetcdfDataset ds , Variable ncVar , List < Dimension > newDims , Dimension levelDim ) throws InvalidRangeException { } }

implementation:
List < Dimension > dims = ncVar . getDimensions ( ) ; int newDimIndex = dims . indexOf ( levelDim ) ; // String shapeS = ncVar . getShapeS ( ) ;
int [ ] origin = new int [ ncVar . getRank ( ) ] ; int [ ] shape = ncVar . getShape ( ) ; int count = 0 ; for ( Dimension dim : newDims ) { String name = ncVar . getShortName ( ) + "-" + dim . getShortName ( ) ; origin [ newDimIndex ] = count ; shape [ newDimIndex ] = dim . getLength ( ) ; Variable varNew = ncVar . section ( new Section ( origin , shape ) ) ; varNew . setName ( name ) ; varNew . setDimension ( newDimIndex , dim ) ; // synthesize long name
String long_name = ds . findAttValueIgnoreCase ( ncVar , CDM . LONG_NAME , ncVar . getShortName ( ) ) ; long_name = long_name + "-" + dim . getShortName ( ) ; ds . addVariableAttribute ( varNew , new Attribute ( CDM . LONG_NAME , long_name ) ) ; ds . addVariable ( null , varNew ) ; parseInfo . format ( "Created New Variable as section = " ) ; varNew . getNameAndDimensions ( parseInfo , true , false ) ; parseInfo . format ( "%n" ) ; count += dim . getLength ( ) ; }


signature:
public class AWIPSConvention { /** * construct time coordinate from reftime variable */
private CoordinateAxis makeTimeCoordAxisFromReference ( NetcdfDataset ds , Variable timeVar , Array vals ) { } }

implementation:
Variable refVar = ds . findVariable ( "reftime" ) ; if ( refVar == null ) return null ; double refValue ; try { Array refArray = refVar . read ( ) ; refValue = refArray . getDouble ( refArray . getIndex ( ) ) ; // get the first value
} catch ( IOException ioe ) { return null ; } if ( refValue == N3iosp . NC_FILL_DOUBLE ) return null ; // construct the values array - make it a double to be safe
Array dvals = Array . factory ( DataType . DOUBLE , vals . getShape ( ) ) ; IndexIterator diter = dvals . getIndexIterator ( ) ; IndexIterator iiter = vals . getIndexIterator ( ) ; while ( iiter . hasNext ( ) ) diter . setDoubleNext ( iiter . getDoubleNext ( ) + refValue ) ; // add reftime to each of the values
String units = ds . findAttValueIgnoreCase ( refVar , CDM . UNITS , "seconds since 1970-1-1 00:00:00" ) ; units = normalize ( units ) ; String desc = "synthesized time coordinate from reftime, valtimeMINUSreftime" ; CoordinateAxis1D timeCoord = new CoordinateAxis1D ( ds , null , "timeCoord" , DataType . DOUBLE , "record" , units , desc ) ; timeCoord . setCachedData ( dvals , true ) ; parseInfo . format ( "Created Time Coordinate Axis From Reference = " ) ; timeCoord . getNameAndDimensions ( parseInfo , true , false ) ; parseInfo . format ( "%n" ) ; return timeCoord ;


signature:
public class GribToNetcdfWriter { /** * Shave n bits off the float
 * @ param value original floating point
 * @ param bitMask bitMask from getBitMask ( )
 * @ return modified float */
public static float bitShave ( float value , int bitMask ) { } }

implementation: if ( Float . isNaN ( value ) ) return value ; int bits = Float . floatToRawIntBits ( value ) ; int shave = bits & bitMask ; return Float . intBitsToFloat ( shave ) ;


signature:
public class GribToNetcdfWriter { /** * Write Grib file to a netcdf4 file . Experimental . */
public static void main ( String [ ] args ) { } }

implementation: String fileIn = ( args . length > 0 ) ? args [ 0 ] : "Q:/cdmUnitTest/formats/grib2/LMPEF_CLM_050518_1200.grb" ; String fileOut = ( args . length > 1 ) ? args [ 1 ] : "C:/tmp/ds.mint.bi" ; try ( GribToNetcdfWriter writer = new GribToNetcdfWriter ( fileIn , fileOut ) ) { writer . write ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; }


signature:
public class NetcdfDataset { /** * Retrieve the set of Enhancements that is associated with the given string .
 * < table border = " 1 " >
 * < tr > < th > String < / th > < th > Enhancements < / th > < / tr >
 * < tr > < td > All < / td > < td > ConvertEnums , ConvertUnsigned , ApplyScaleOffset , ConvertMissing , CoordSystems < / td > < / tr >
 * < tr > < td > None < / td > < td > & lt ; empty & gt ; < / td > < / tr >
 * < tr > < td > ConvertEnums < / td > < td > ConvertEnums < / td > < / tr >
 * < tr > < td > ConvertUnsigned < / td > < td > ConvertUnsigned < / td > < / tr >
 * < tr > < td > ApplyScaleOffset < / td > < td > ApplyScaleOffset < / td > < / tr >
 * < tr > < td > ConvertMissing < / td > < td > ConvertMissing < / td > < / tr >
 * < tr > < td > CoordSystems < / td > < td > CoordSystems < / td > < / tr >
 * < tr > < td > IncompleteCoordSystems < / td > < td > CoordSystems < / td > < / tr >
 * < tr > < td > true < / td > < td > Alias for " All " < / td > < / tr >
 * < tr > < td > ScaleMissingDefer < / td > < td > Alias for " None " < / td > < / tr >
 * < tr > < td > AllDefer < / td > < td > ConvertEnums , CoordSystems < / td > < / tr >
 * < tr > < td > ScaleMissing < / td > < td > ConvertUnsigned , ApplyScaleOffset , ConvertMissing < / td > < / tr >
 * < / table >
 * @ param enhanceMode a string from the above table .
 * @ return the set corresponding to { @ code enhanceMode } , or { @ code null } if there is no correspondence . */
static public Set < Enhance > parseEnhanceMode ( String enhanceMode ) { } }

implementation:
if ( enhanceMode == null ) return null ; switch ( enhanceMode . toLowerCase ( ) ) { case "all" : return getEnhanceAll ( ) ; case "none" : return getEnhanceNone ( ) ; case "convertenums" : return EnumSet . of ( Enhance . ConvertEnums ) ; case "convertunsigned" : return EnumSet . of ( Enhance . ConvertUnsigned ) ; case "applyscaleoffset" : return EnumSet . of ( Enhance . ApplyScaleOffset ) ; case "convertmissing" : return EnumSet . of ( Enhance . ConvertMissing ) ; case "coordsystems" : return EnumSet . of ( Enhance . CoordSystems ) ; case "incompletecoordsystems" : return EnumSet . of ( Enhance . CoordSystems , Enhance . IncompleteCoordSystems ) ; // Legacy strings , retained for backwards compatibility :
case "true" : return getEnhanceAll ( ) ; case "scalemissingdefer" : return getEnhanceNone ( ) ; case "alldefer" : return EnumSet . of ( Enhance . ConvertEnums , Enhance . CoordSystems ) ; case "scalemissing" : return EnumSet . of ( Enhance . ConvertUnsigned , Enhance . ApplyScaleOffset , Enhance . ConvertMissing ) ; // Return null by default , since some valid strings actually return an empty set .
default : return null ; }


signature:
public class NetcdfDataset { /** * Enable file caching . call this before calling acquireFile ( ) .
 * When application terminates , call NetcdfDataset . shutdown ( ) .
 * @ param minElementsInMemory keep this number in the cache
 * @ param maxElementsInMemory trigger a cleanup if it goes over this number .
 * @ param hardLimit if > 0 , never allow more than this many elements . This causes a cleanup to be done in
 * the calling thread .
 * @ param period ( secs ) do periodic cleanups every this number of seconds . */
static public synchronized void initNetcdfFileCache ( int minElementsInMemory , int maxElementsInMemory , int hardLimit , int period ) { } }

implementation: netcdfFileCache = new ucar . nc2 . util . cache . FileCache ( "NetcdfFileCache " , minElementsInMemory , maxElementsInMemory , hardLimit , period ) ;


signature:
public class NetcdfDataset { /** * Make NetcdfFile into NetcdfDataset with given enhance mode
 * @ param ncfile wrap this
 * @ param mode using this enhance mode ( may be null , meaning no enhance )
 * @ return NetcdfDataset wrapping the given ncfile
 * @ throws IOException on io error */
static public NetcdfDataset wrap ( NetcdfFile ncfile , Set < Enhance > mode ) throws IOException { } }

implementation:
if ( ncfile instanceof NetcdfDataset ) { NetcdfDataset ncd = ( NetcdfDataset ) ncfile ; if ( ! ncd . enhanceNeeded ( mode ) ) return ( NetcdfDataset ) ncfile ; } // enhancement requires wrappping , to not modify underlying dataset , eg if cached
// perhaps need a method variant that allows the ncfile to be modified
return new NetcdfDataset ( ncfile , mode ) ;


signature:
public class NetcdfDataset { /** * Factory method for opening a dataset through the netCDF API , and identifying its coordinate variables .
 * @ param location location of file
 * @ param enhance if true , use defaultEnhanceMode , else no enhancements
 * @ param cancelTask allow task to be cancelled ; may be null .
 * @ return NetcdfDataset object
 * @ throws java . io . IOException on read error */
static public NetcdfDataset openDataset ( String location , boolean enhance , ucar . nc2 . util . CancelTask cancelTask ) throws IOException { } }

implementation: return openDataset ( location , enhance , - 1 , cancelTask , null ) ;


signature:
public class NetcdfDataset { /** * Factory method for opening a dataset through the netCDF API , and identifying its coordinate variables .
 * @ param location location of file
 * @ param enhance if true , use defaultEnhanceMode , else no enhancements
 * @ param buffer _ size RandomAccessFile buffer size , if < = 0 , use default size
 * @ param cancelTask allow task to be cancelled ; may be null .
 * @ param spiObject sent to iosp . setSpecial ( ) if not null
 * @ return NetcdfDataset object
 * @ throws java . io . IOException on read error */
static public NetcdfDataset openDataset ( String location , boolean enhance , int buffer_size , ucar . nc2 . util . CancelTask cancelTask , Object spiObject ) throws IOException { } }

implementation: DatasetUrl durl = DatasetUrl . findDatasetUrl ( location ) ; return openDataset ( durl , enhance ? defaultEnhanceMode : null , buffer_size , cancelTask , spiObject ) ;


signature:
public class NetcdfDataset { /** * Factory method for opening a dataset through the netCDF API , and identifying its coordinate variables .
 * @ param location location of file
 * @ param enhanceMode set of enhancements . If null , then none
 * @ param buffer _ size RandomAccessFile buffer size , if < = 0 , use default size
 * @ param cancelTask allow task to be cancelled ; may be null .
 * @ param spiObject sent to iosp . setSpecial ( ) if not null
 * @ return NetcdfDataset object
 * @ throws java . io . IOException on read error */
static public NetcdfDataset openDataset ( DatasetUrl location , Set < Enhance > enhanceMode , int buffer_size , ucar . nc2 . util . CancelTask cancelTask , Object spiObject ) throws IOException { } }

implementation:
// do not acquire
NetcdfFile ncfile = openOrAcquireFile ( null , null , null , location , buffer_size , cancelTask , spiObject ) ; NetcdfDataset ds ; if ( ncfile instanceof NetcdfDataset ) { ds = ( NetcdfDataset ) ncfile ; enhance ( ds , enhanceMode , cancelTask ) ; // enhance " in place " , ie modify the NetcdfDataset
} else { ds = new NetcdfDataset ( ncfile , enhanceMode ) ; // enhance when wrapping
} return ds ;


signature:
public class NetcdfDataset { /** * Enhancement use cases
 * 1 . open NetcdfDataset ( enhance ) .
 * 2 . NcML - must create the NetcdfDataset , and enhance when its done .
 * Enhance mode is set when
 * 1 ) the NetcdfDataset is opened
 * 2 ) enhance ( EnumSet < Enhance > mode ) is called .
 * Possible remove all direct access to Variable . enhance */
static private CoordSysBuilderIF enhance ( NetcdfDataset ds , Set < Enhance > mode , CancelTask cancelTask ) throws IOException { } }

implementation:
if ( mode == null ) { mode = EnumSet . noneOf ( Enhance . class ) ; } // CoordSysBuilder may enhance dataset : add new variables , attributes , etc
CoordSysBuilderIF builder = null ; if ( mode . contains ( Enhance . CoordSystems ) && ! ds . enhanceMode . contains ( Enhance . CoordSystems ) ) { builder = ucar . nc2 . dataset . CoordSysBuilder . factory ( ds , cancelTask ) ; builder . augmentDataset ( ds , cancelTask ) ; ds . convUsed = builder . getConventionUsed ( ) ; } // now enhance enum / scale / offset / unsigned , using augmented dataset
if ( ( mode . contains ( Enhance . ConvertEnums ) && ! ds . enhanceMode . contains ( Enhance . ConvertEnums ) ) || ( mode . contains ( Enhance . ConvertUnsigned ) && ! ds . enhanceMode . contains ( Enhance . ConvertUnsigned ) ) || ( mode . contains ( Enhance . ApplyScaleOffset ) && ! ds . enhanceMode . contains ( Enhance . ApplyScaleOffset ) ) || ( mode . contains ( Enhance . ConvertMissing ) && ! ds . enhanceMode . contains ( Enhance . ConvertMissing ) ) ) { for ( Variable v : ds . getVariables ( ) ) { VariableEnhanced ve = ( VariableEnhanced ) v ; ve . enhance ( mode ) ; if ( ( cancelTask != null ) && cancelTask . isCancel ( ) ) return null ; } } // now find coord systems which may change some Variables to axes , etc
if ( builder != null ) { // temporarily set enhanceMode if incomplete coordinate systems are allowed
if ( mode . contains ( Enhance . IncompleteCoordSystems ) ) { ds . enhanceMode . add ( Enhance . IncompleteCoordSystems ) ; builder . buildCoordinateSystems ( ds ) ; ds . enhanceMode . remove ( Enhance . IncompleteCoordSystems ) ; } else { builder . buildCoordinateSystems ( ds ) ; } } /* timeTaxis must be CoordinateAxis1DTime
 for ( CoordinateSystem cs : ds . getCoordinateSystems ( ) ) {
 cs . makeTimeAxis ( ) ; */
ds . finish ( ) ; // recalc the global lists
ds . enhanceMode . addAll ( mode ) ; return builder ;


signature:
public class NetcdfDataset { /** * Same as openDataset , but file is acquired through the File Cache , with defaultEnhanceMode ,
 * without the need of setting the enhanceMode via the signature .
 * You still close with NetcdfDataset . close ( ) , the release is handled automatically .
 * You must first call initNetcdfFileCache ( ) for caching to actually take place .
 * @ param location location of file , passed to FileFactory
 * @ param cancelTask allow task to be cancelled ; may be null .
 * @ return NetcdfDataset object
 * @ throws java . io . IOException on read error */
static public NetcdfDataset acquireDataset ( DatasetUrl location , ucar . nc2 . util . CancelTask cancelTask ) throws IOException { } }

implementation: return acquireDataset ( null , location , defaultEnhanceMode , - 1 , cancelTask , null ) ;


signature:
public class NetcdfDataset { /** * / * static public NetcdfDataset acquireDataset ( FileFactory fac , String location , Set < Enhance > enhanceMode , int buffer _ size ,
 * ucar . nc2 . util . CancelTask cancelTask , Object iospMessage ) throws IOException {
 * caching not turned on
 * if ( netcdfFileCache = = null ) {
 * if ( fac = = null )
 * return openDataset ( location , enhanceMode , buffer _ size , cancelTask , iospMessage ) ;
 * else
 * must use the factory if there is one
 * return ( NetcdfDataset ) fac . open ( location , buffer _ size , cancelTask , iospMessage ) ;
 * if ( fac ! = null )
 * return ( NetcdfDataset ) openOrAcquireFile ( netcdfFileCache , fac , null , location , buffer _ size , cancelTask , iospMessage ) ;
 * fac = new MyNetcdfDatasetFactory ( location , enhanceMode ) ;
 * return ( NetcdfDataset ) openOrAcquireFile ( netcdfFileCache , fac , fac . hashCode ( ) , location , buffer _ size , cancelTask , iospMessage ) ; */
static public NetcdfDataset acquireDataset ( FileFactory fac , DatasetUrl durl , Set < Enhance > enhanceMode , int buffer_size , ucar . nc2 . util . CancelTask cancelTask , Object iospMessage ) throws IOException { } }

implementation:
// caching not turned on
if ( netcdfFileCache == null ) { if ( fac == null ) return openDataset ( durl , enhanceMode , buffer_size , cancelTask , iospMessage ) ; else // must use the factory if there is one
return ( NetcdfDataset ) fac . open ( durl , buffer_size , cancelTask , iospMessage ) ; } if ( fac != null ) return ( NetcdfDataset ) openOrAcquireFile ( netcdfFileCache , fac , null , durl , buffer_size , cancelTask , iospMessage ) ; fac = new MyNetcdfDatasetFactory ( durl , enhanceMode ) ; return ( NetcdfDataset ) openOrAcquireFile ( netcdfFileCache , fac , fac . hashCode ( ) , durl , buffer_size , cancelTask , iospMessage ) ;


signature:
public class NetcdfDataset { /** * Factory method for opening a NetcdfFile through the netCDF API .
 * @ param location location of dataset .
 * @ param cancelTask use to allow task to be cancelled ; may be null .
 * @ return NetcdfFile object
 * @ throws java . io . IOException on read error */
public static NetcdfFile openFile ( String location , ucar . nc2 . util . CancelTask cancelTask ) throws IOException { } }

implementation: DatasetUrl durl = DatasetUrl . findDatasetUrl ( location ) ; return openOrAcquireFile ( null , null , null , durl , - 1 , cancelTask , null ) ;


signature:
public class NetcdfDataset { /** * Factory method for opening a NetcdfFile through the netCDF API . May be any kind of file that
 * can be read through the netCDF API , including OpenDAP and NcML .
 * < p > This does not necessarily return a NetcdfDataset , or enhance the dataset ; use NetcdfDataset . openDataset ( ) method for that .
 * @ param location location of dataset . This may be a
 * < ol >
 * < li > local filename ( with a file : prefix or no prefix ) for netCDF ( version 3 ) , hdf5 files , or any file type
 * registered with NetcdfFile . registerIOProvider ( ) .
 * < li > OpenDAP dataset URL ( with a dods : , dap4 : , or http : prefix ) .
 * < li > NcML file or URL if the location ends with " . xml " or " . ncml "
 * < li > NetCDF file through an HTTP server ( http : prefix )
 * < li > thredds dataset ( thredds : prefix ) , see DataFactory . openDataset ( String location , . . . ) ) ;
 * < / ol >
 * @ param buffer _ size RandomAccessFile buffer size , if < = 0 , use default size
 * @ param cancelTask allow task to be cancelled ; may be null .
 * @ param spiObject sent to iosp . setSpecial ( ) if not null
 * @ return NetcdfFile object
 * @ throws java . io . IOException on read error */
public static NetcdfFile openFile ( DatasetUrl location , int buffer_size , ucar . nc2 . util . CancelTask cancelTask , Object spiObject ) throws IOException { } }

implementation: return openOrAcquireFile ( null , null , null , location , buffer_size , cancelTask , spiObject ) ;


signature:
public class NetcdfDataset { /** * Same as openFile , but file is acquired through the File Cache .
 * You still close with NetcdfFile . close ( ) , the release is handled automatically .
 * You must first call initNetcdfFileCache ( ) for caching to actually take place .
 * @ param location location of file , passed to FileFactory
 * @ param cancelTask allow task to be cancelled ; may be null .
 * @ return NetcdfFile object
 * @ throws java . io . IOException on read error */
static public NetcdfFile acquireFile ( DatasetUrl location , ucar . nc2 . util . CancelTask cancelTask ) throws IOException { } }

implementation: return acquireFile ( null , null , location , - 1 , cancelTask , null ) ;


signature:
public class NetcdfDataset { /** * Same as openFile , but file is acquired through the File Cache .
 * You still close with NetcdfFile . close ( ) , the release is handled automatically .
 * You must first call initNetcdfFileCache ( ) for caching to actually take place .
 * @ param factory if not null , use this factory to read the file . If null , use the default factory .
 * @ param hashKey if not null , use as the cache key , else use the location
 * @ param location location of file , passed to FileFactory
 * @ param buffer _ size RandomAccessFile buffer size , if < = 0 , use default size
 * @ param cancelTask allow task to be cancelled ; may be null .
 * @ param spiObject sent to iosp . setSpecial ( ) ; may be null
 * @ return NetcdfFile object
 * @ throws java . io . IOException on read error */
static public NetcdfFile acquireFile ( ucar . nc2 . util . cache . FileFactory factory , Object hashKey , DatasetUrl location , int buffer_size , ucar . nc2 . util . CancelTask cancelTask , Object spiObject ) throws IOException { } }

implementation:
// must use the factory if there is one but no fileCache
if ( ( netcdfFileCache == null ) && ( factory != null ) ) { return ( NetcdfFile ) factory . open ( location , buffer_size , cancelTask , spiObject ) ; } return openOrAcquireFile ( netcdfFileCache , factory , hashKey , location , buffer_size , cancelTask , spiObject ) ;


signature:
public class NetcdfDataset { /** * Open or acquire a NetcdfFile .
 * @ param cache if not null , acquire through this NetcdfFileCache , otherwise simply open
 * @ param factory if not null , use this factory if the file is not in the cache . If null , use the default factory .
 * @ param hashKey if not null , use as the cache key , else use the location
 * @ param orgLocation location of file
 * @ param buffer _ size RandomAccessFile buffer size , if < = 0 , use default size
 * @ param cancelTask allow task to be cancelled ; may be null .
 * @ param spiObject sent to iosp . setSpecial ( ) if not null
 * @ return NetcdfFile object
 * @ throws java . io . IOException on read error
 * static private NetcdfFile openOrAcquireFile ( FileCache cache , FileFactory factory , Object hashKey , String orgLocation ,
 * int buffer _ size , ucar . nc2 . util . CancelTask cancelTask , Object spiObject ) throws IOException {
 * if ( orgLocation = = null )
 * throw new IOException ( " NetcdfDataset . openFile : location is null " ) ;
 * String location = StringUtil2 . replace ( orgLocation . trim ( ) , ' \ \ ' , " / " ) ;
 * DatasetUrl durl = DatasetUrl . findDatasetUrl ( location ) ;
 * return openOrAcquireFile ( cache , factory , hashKey , durl , buffer _ size , cancelTask , spiObject ) ; */
static private NetcdfFile openOrAcquireFile ( FileCache cache , FileFactory factory , Object hashKey , DatasetUrl durl , int buffer_size , ucar . nc2 . util . CancelTask cancelTask , Object spiObject ) throws IOException { } }

implementation:
if ( durl . serviceType != null ) { switch ( durl . serviceType ) { case OPENDAP : return acquireDODS ( cache , factory , hashKey , durl . trueurl , buffer_size , cancelTask , spiObject ) ; case CdmRemote : return acquireCdmRemote ( cache , factory , hashKey , durl . trueurl , buffer_size , cancelTask , spiObject ) ; case DAP4 : return acquireDap4 ( cache , factory , hashKey , durl . trueurl , buffer_size , cancelTask , spiObject ) ; case NCML : return acquireNcml ( cache , factory , hashKey , durl . trueurl , buffer_size , cancelTask , spiObject ) ; case THREDDS : Formatter log = new Formatter ( ) ; DataFactory tdf = new DataFactory ( ) ; NetcdfFile ncfile = tdf . openDataset ( durl . trueurl , false , cancelTask , log ) ; // LOOK acquire ? ?
if ( ncfile == null ) throw new IOException ( log . toString ( ) ) ; return ncfile ; case File : case HTTPServer : break ; // fall through
default : throw new IOException ( "Unknown service type: " + durl . serviceType . toString ( ) ) ; } } // Next to last resort : find in the cache
if ( cache != null ) { if ( factory == null ) factory = defaultNetcdfFileFactory ; return ( NetcdfFile ) cache . acquire ( factory , hashKey , durl , buffer_size , cancelTask , spiObject ) ; } // Last resort : try to open as a file or remote file
return NetcdfFile . open ( durl . trueurl , buffer_size , cancelTask , spiObject ) ;


signature: public class NetcdfDataset { static private NetcdfFile acquireNcml ( FileCache cache , FileFactory factory , Object hashKey , String location , int buffer_size , ucar . nc2 . util . CancelTask cancelTask , Object spiObject ) throws IOException { } }

implementation:
if ( cache == null ) return NcMLReader . readNcML ( location , cancelTask ) ; if ( factory == null ) factory = new NcMLFactory ( ) ; // LOOK maybe always should use NcMLFactory ?
return ( NetcdfFile ) cache . acquire ( factory , hashKey , DatasetUrl . findDatasetUrl ( location ) , buffer_size , cancelTask , spiObject ) ;


signature:
public class NetcdfDataset { /** * Clear Coordinate System metadata , to allow them to be redone */
public void clearCoordinateSystems ( ) { } }

implementation: coordSys = new ArrayList < > ( ) ; coordAxes = new ArrayList < > ( ) ; coordTransforms = new ArrayList < > ( ) ; for ( Variable v : getVariables ( ) ) { VariableEnhanced ve = ( VariableEnhanced ) v ; ve . clearCoordinateSystems ( ) ; } enhanceMode . remove ( Enhance . CoordSystems ) ;


signature:
public class NetcdfDataset { /** * Retrieve the CoordinateAxis with the specified Axis Type .
 * @ param type axis type
 * @ return the first CoordinateAxis that has that type , or null if not found */
public CoordinateAxis findCoordinateAxis ( AxisType type ) { } }

implementation: if ( type == null ) return null ; for ( CoordinateAxis v : coordAxes ) { if ( type == v . getAxisType ( ) ) return v ; } return null ;


signature:
public class NetcdfDataset { /** * Retrieve the CoordinateAxis with the specified type .
 * @ param fullName full escaped name of the coordinate axis
 * @ return the CoordinateAxis , or null if not found */
public CoordinateAxis findCoordinateAxis ( String fullName ) { } }

implementation: if ( fullName == null ) return null ; for ( CoordinateAxis v : coordAxes ) { if ( fullName . equals ( v . getFullName ( ) ) ) return v ; } return null ;


signature:
public class NetcdfDataset { /** * Retrieve the CoordinateSystem with the specified name .
 * @ param name String which identifies the desired CoordinateSystem
 * @ return the CoordinateSystem , or null if not found */
public CoordinateSystem findCoordinateSystem ( String name ) { } }

implementation: if ( name == null ) return null ; for ( CoordinateSystem v : coordSys ) { if ( name . equals ( v . getName ( ) ) ) return v ; } return null ;


signature:
public class NetcdfDataset { /** * Retrieve the CoordinateTransform with the specified name .
 * @ param name String which identifies the desired CoordinateSystem
 * @ return the CoordinateSystem , or null if not found */
public CoordinateTransform findCoordinateTransform ( String name ) { } }

implementation: if ( name == null ) return null ; for ( CoordinateTransform v : coordTransforms ) { if ( name . equals ( v . getName ( ) ) ) return v ; } return null ;


signature:
public class NetcdfDataset { /** * Close all resources ( files , sockets , etc ) associated with this dataset .
 * If the underlying file was acquired , it will be released , otherwise closed . */
@ Override public synchronized void close ( ) throws java . io . IOException { } }

implementation:
if ( agg != null ) { agg . persistWrite ( ) ; // LOOK maybe only on real close ? ?
agg . close ( ) ; } if ( cache != null ) { // unlocked = true ;
if ( cache . release ( this ) ) return ; } if ( orgFile != null ) orgFile . close ( ) ; orgFile = null ;


signature: public class NetcdfDataset { @ Override protected Boolean makeRecordStructure ( ) { } }

implementation:
if ( this . orgFile == null ) return false ; Boolean hasRecord = ( Boolean ) this . orgFile . sendIospMessage ( NetcdfFile . IOSP_MESSAGE_ADD_RECORD_STRUCTURE ) ; if ( ( hasRecord == null ) || ! hasRecord ) return false ; Variable orgV = this . orgFile . getRootGroup ( ) . findVariable ( "record" ) ; if ( ( orgV == null ) || ! ( orgV instanceof Structure ) ) return false ; Structure orgStructure = ( Structure ) orgV ; Dimension udim = getUnlimitedDimension ( ) ; if ( udim == null ) return false ; Group root = getRootGroup ( ) ; StructureDS newStructure = new StructureDS ( this , root , null , "record" , udim . getShortName ( ) , null , null ) ; newStructure . setOriginalVariable ( orgStructure ) ; for ( Variable v : getVariables ( ) ) { if ( ! v . isUnlimited ( ) ) continue ; VariableDS memberV ; try { memberV = ( VariableDS ) v . slice ( 0 , 0 ) ; // set unlimited dimension to 0
} catch ( InvalidRangeException e ) { log . error ( "Cant slice variable " + v ) ; return false ; } memberV . setParentStructure ( newStructure ) ; // reparent
/* memberV . createNewCache ( ) ; / / decouple caching
 / / orgV = orgStructure . findVariable ( v . getShortName ( ) ) ;
 / / if ( orgV ! = null )
 / / memberV . setOriginalVariable ( orgV ) ;
 / / remove record dimension
 List < Dimension > dims = new ArrayList < Dimension > ( v . getDimensions ( ) ) ;
 dims . remove ( 0 ) ;
 memberV . setDimensions ( dims ) ; */
newStructure . addMemberVariable ( memberV ) ; } root . addVariable ( newStructure ) ; finish ( ) ; // if ( isEnhancedScaleOffset ( ) )
// newStructure . enhance ( ) ;
return true ;


signature:
public class NetcdfDataset { /** * Add a CoordinateAxis to the dataset , by turning the VariableDS into a CoordinateAxis ( if needed ) .
 * Also adds it to the list of variables . Replaces any existing Variable and CoordinateAxis with the same name .
 * @ param v make this VariableDS into a CoordinateAxis
 * @ return the CoordinateAxis */
public CoordinateAxis addCoordinateAxis ( VariableDS v ) { } }

implementation:
if ( v == null ) return null ; CoordinateAxis oldVar = findCoordinateAxis ( v . getFullName ( ) ) ; if ( oldVar != null ) coordAxes . remove ( oldVar ) ; CoordinateAxis ca = ( v instanceof CoordinateAxis ) ? ( CoordinateAxis ) v : CoordinateAxis . factory ( this , v ) ; coordAxes . add ( ca ) ; if ( v . isMemberOfStructure ( ) ) { Structure parentOrg = v . getParentStructure ( ) ; // gotta be careful to get the wrapping parent
Structure parent = ( Structure ) findVariable ( parentOrg . getFullNameEscaped ( ) ) ; parent . replaceMemberVariable ( ca ) ; } else { removeVariable ( v . getParentGroup ( ) , v . getShortName ( ) ) ; // remove by short name if it exists
addVariable ( ca . getParentGroup ( ) , ca ) ; } return ca ;


signature:
public class NetcdfDataset { /** * is this enhancement already done ?
 * @ param want enhancements wanted
 * @ return true if wanted enhancement is not done
 * @ throws java . io . IOException on error */
public boolean enhanceNeeded ( Set < Enhance > want ) throws IOException { } }

implementation: if ( want == null ) return false ; for ( Enhance mode : want ) { if ( ! this . enhanceMode . contains ( mode ) ) return true ; } return false ;


signature:
public class NetcdfDataset { /** * Generate the list of values from a starting value and an increment .
 * Will reshape to variable if needed .
 * @ param v for this variable
 * @ param npts number of values , must = v . getSize ( )
 * @ param start starting value
 * @ param incr increment
 * @ deprecated use Variable . setValues ( ) */
public void setValues ( Variable v , int npts , double start , double incr ) { } }

implementation: if ( npts != v . getSize ( ) ) throw new IllegalArgumentException ( "bad npts = " + npts + " should be " + v . getSize ( ) ) ; Array data = Array . makeArray ( v . getDataType ( ) , npts , start , incr ) ; if ( v . getRank ( ) != 1 ) data = data . reshape ( v . getShape ( ) ) ; v . setCachedData ( data , true ) ;


signature:
public class NetcdfDataset { /** * Set the data values from a list of Strings .
 * @ param v for this variable
 * @ param values list of Strings
 * @ throws IllegalArgumentException if values array not correct size , or values wont parse to the correct type
 * @ deprecated use Variable . setValues ( ) */
public void setValues ( Variable v , List < String > values ) throws IllegalArgumentException { } }

implementation:
Array data = Array . makeArray ( v . getDataType ( ) , values ) ; if ( data . getSize ( ) != v . getSize ( ) ) throw new IllegalArgumentException ( "Incorrect number of values specified for the Variable " + v . getFullName ( ) + " needed= " + v . getSize ( ) + " given=" + data . getSize ( ) ) ; if ( v . getRank ( ) != 1 ) // dont have to reshape for rank 1
data = data . reshape ( v . getShape ( ) ) ; v . setCachedData ( data , true ) ;


signature:
public class NetcdfDataset { /** * Make a 1D array from a list of strings .
 * @ param dtype data type of the array .
 * @ param stringValues list of strings .
 * @ return resulting 1D array .
 * @ throws NumberFormatException if string values not parssable to specified data type
 * @ deprecated use Array # makeArray directly */
static public Array makeArray ( DataType dtype , List < String > stringValues ) throws NumberFormatException { } }

implementation: return Array . makeArray ( dtype , stringValues ) ;


signature:
public class NetcdfDataset { /** * Show debug / underlying implementation details */
@ Override public void getDetailInfo ( Formatter f ) { } }

implementation: f . format ( "NetcdfDataset location= %s%n" , getLocation ( ) ) ; f . format ( "  title= %s%n" , getTitle ( ) ) ; f . format ( "  id= %s%n" , getId ( ) ) ; f . format ( "  fileType= %s%n" , getFileTypeId ( ) ) ; f . format ( "  fileDesc= %s%n" , getFileTypeDescription ( ) ) ; f . format ( "  class= %s%n" , getClass ( ) . getName ( ) ) ; if ( agg == null ) { f . format ( "  has no Aggregation element%n" ) ; } else { f . format ( "%nAggregation:%n" ) ; agg . getDetailInfo ( f ) ; } if ( orgFile == null ) { f . format ( "  has no referenced NetcdfFile%n" ) ; showCached ( f ) ; showProxies ( f ) ; } else { f . format ( "%nReferenced File:%n" ) ; f . format ( "%s" , orgFile . getDetailInfo ( ) ) ; }


signature:
public class NetcdfDataset { /** * Debugging : get the information from parsing
 * @ return NetcdfDatasetInfo object
 * public NetcdfDatasetInfo getInfo ( ) {
 * return new NetcdfDatasetInfo ( this ) ; */
void dumpClasses ( Group g , PrintWriter out ) { } }

implementation: out . println ( "Dimensions:" ) ; for ( Dimension ds : g . getDimensions ( ) ) { out . println ( "  " + ds . getShortName ( ) + " " + ds . getClass ( ) . getName ( ) ) ; } out . println ( "Atributes:" ) ; for ( Attribute a : g . getAttributes ( ) ) { out . println ( "  " + a . getShortName ( ) + " " + a . getClass ( ) . getName ( ) ) ; } out . println ( "Variables:" ) ; dumpVariables ( g . getVariables ( ) , out ) ; out . println ( "Groups:" ) ; for ( Group nested : g . getGroups ( ) ) { out . println ( "  " + nested . getFullName ( ) + " " + nested . getClass ( ) . getName ( ) ) ; dumpClasses ( nested , out ) ; }


signature:
public class NetcdfDataset { /** * Debugging
 * @ param out write here
 * @ param ncd info about this */
public static void debugDump ( PrintWriter out , NetcdfDataset ncd ) { } }

implementation: String referencedLocation = ncd . orgFile == null ? "(null)" : ncd . orgFile . getLocation ( ) ; out . println ( "\nNetcdfDataset dump = " + ncd . getLocation ( ) + " url= " + referencedLocation + "\n" ) ; ncd . dumpClasses ( ncd . getRootGroup ( ) , out ) ;


signature:
public class NetcdfDataset { /** * LOOK : Can we use CFPointWriter . CommandLine for CLI parsing instead ? Would that break existing scripts ? */
public static void main ( String arg [ ] ) throws IOException { } }

implementation: String usage = "usage: ucar.nc2.dataset.NetcdfDataset -in <fileIn> -out <fileOut> [-isLargeFile] [-netcdf4]" ; if ( arg . length < 4 ) { System . out . println ( usage ) ; System . exit ( 0 ) ; } boolean isLargeFile = false ; boolean netcdf4 = false ; String datasetIn = null , datasetOut = null ; for ( int i = 0 ; i < arg . length ; i ++ ) { String s = arg [ i ] ; if ( s . equalsIgnoreCase ( "-in" ) ) datasetIn = arg [ i + 1 ] ; if ( s . equalsIgnoreCase ( "-out" ) ) datasetOut = arg [ i + 1 ] ; if ( s . equalsIgnoreCase ( "-isLargeFile" ) ) isLargeFile = true ; if ( s . equalsIgnoreCase ( "-netcdf4" ) ) netcdf4 = true ; } if ( ( datasetIn == null ) || ( datasetOut == null ) ) { System . out . println ( usage ) ; System . exit ( 0 ) ; } CancelTaskImpl cancel = new CancelTaskImpl ( ) ; NetcdfFile ncfileIn = ucar . nc2 . dataset . NetcdfDataset . openFile ( datasetIn , cancel ) ; System . out . printf ( "NetcdfDatataset read from %s write to %s " , datasetIn , datasetOut ) ; NetcdfFileWriter . Version version = netcdf4 ? NetcdfFileWriter . Version . netcdf4 : NetcdfFileWriter . Version . netcdf3 ; FileWriter2 writer = new ucar . nc2 . FileWriter2 ( ncfileIn , datasetOut , version , null ) ; writer . getNetcdfFileWriter ( ) . setLargeFile ( isLargeFile ) ; NetcdfFile ncfileOut = writer . write ( cancel ) ; if ( ncfileOut != null ) ncfileOut . close ( ) ; ncfileIn . close ( ) ; cancel . setDone ( true ) ; System . out . printf ( "%s%n" , cancel ) ;


signature:
public class TdsRequestedDataset { /** * return null means request has been handled , and calling routine should exit without further processing */
public static FeatureDatasetPoint getPointDataset ( HttpServletRequest request , HttpServletResponse response , String path ) throws IOException { } }

implementation: TdsRequestedDataset trd = new TdsRequestedDataset ( request , null ) ; if ( path != null ) trd . path = path ; return trd . openAsPointDataset ( request , response ) ;


signature:
public class TdsRequestedDataset { /** * return null means request has been handled , and calling routine should exit without further processing */
public static GridDataset getGridDataset ( HttpServletRequest request , HttpServletResponse response , String path ) throws IOException { } }

implementation: TdsRequestedDataset trd = new TdsRequestedDataset ( request , null ) ; if ( path != null ) trd . path = path ; return trd . openAsGridDataset ( request , response ) ;


signature:
public class TdsRequestedDataset { /** * return null means request has been handled , and calling routine should exit without further processing */
public static CoverageCollection getCoverageCollection ( HttpServletRequest request , HttpServletResponse response , String path ) throws IOException { } }

implementation: TdsRequestedDataset trd = new TdsRequestedDataset ( request , null ) ; if ( path != null ) trd . path = path ; return trd . openAsCoverageDataset ( request , response ) ;


signature:
public class TdsRequestedDataset { /** * return null means request has been handled , and calling routine should exit without further processing */
public static NetcdfFile getNetcdfFile ( HttpServletRequest request , HttpServletResponse response , String path ) throws IOException { } }

implementation: TdsRequestedDataset trd = new TdsRequestedDataset ( request , null ) ; if ( path != null ) trd . path = path ; return trd . openAsNetcdfFile ( request , response ) ;


signature:
public class TdsRequestedDataset { /** * return null means request has been handled , and calling routine should exit without further processing */
public FeatureDatasetPoint openAsPointDataset ( HttpServletRequest request , HttpServletResponse response ) throws IOException { } }

implementation: return datasetManager . openPointDataset ( request , response , path ) ;


signature:
public class TdsRequestedDataset { /** * return null means request has been handled , and calling routine should exit without further processing */
public CoverageCollection openAsCoverageDataset ( HttpServletRequest request , HttpServletResponse response ) throws IOException { } }

implementation: return datasetManager . openCoverageDataset ( request , response , path ) ;


signature:
public class TdsRequestedDataset { /** * return null means request has been handled , and calling routine should exit without further processing */
public GridDataset openAsGridDataset ( HttpServletRequest request , HttpServletResponse response ) throws IOException { } }

implementation: return isRemote ? ucar . nc2 . dt . grid . GridDataset . open ( path ) : datasetManager . openGridDataset ( request , response , path ) ;


signature:
public class TdsRequestedDataset { /** * return null means request has been handled , and calling routine should exit without further processing */
public NetcdfFile openAsNetcdfFile ( HttpServletRequest request , HttpServletResponse response ) throws IOException { } }

implementation: return isRemote ? NetcdfDataset . openDataset ( path ) : datasetManager . openNetcdfFile ( request , response , path ) ;


signature:
public class ArraySequence { /** * when we dont know how many in the iteration */
private Array extractMemberArrayFromIteration ( StructureMembers . Member proxym , int [ ] rshape ) throws IOException { } }

implementation:
DataType dataType = proxym . getDataType ( ) ; Object dataArray = null ; int count = 0 ; int initial = 1000 ; try ( StructureDataIterator sdataIter = getStructureDataIterator ( ) ) { switch ( dataType ) { case DOUBLE : { ArrayList < Double > result = new ArrayList < > ( initial ) ; while ( sdataIter . hasNext ( ) ) { StructureData sdata = sdataIter . next ( ) ; StructureMembers . Member realm = sdata . getStructureMembers ( ) . findMember ( proxym . getName ( ) ) ; double [ ] data = sdata . getJavaArrayDouble ( realm ) ; for ( double aData : data ) result . add ( aData ) ; count ++ ; } double [ ] da = new double [ result . size ( ) ] ; int i = 0 ; for ( Double d : result ) da [ i ++ ] = d ; dataArray = da ; break ; } case FLOAT : { ArrayList < Float > result = new ArrayList < > ( initial ) ; while ( sdataIter . hasNext ( ) ) { StructureData sdata = sdataIter . next ( ) ; StructureMembers . Member realm = sdata . getStructureMembers ( ) . findMember ( proxym . getName ( ) ) ; float [ ] data = sdata . getJavaArrayFloat ( realm ) ; for ( float aData : data ) result . add ( aData ) ; count ++ ; } float [ ] da = new float [ result . size ( ) ] ; int i = 0 ; for ( Float d : result ) da [ i ++ ] = d ; dataArray = da ; break ; } case UBYTE : case BYTE : case ENUM1 : { ArrayList < Byte > result = new ArrayList < > ( initial ) ; while ( sdataIter . hasNext ( ) ) { StructureData sdata = sdataIter . next ( ) ; StructureMembers . Member realm = sdata . getStructureMembers ( ) . findMember ( proxym . getName ( ) ) ; byte [ ] data = sdata . getJavaArrayByte ( realm ) ; for ( byte aData : data ) result . add ( aData ) ; count ++ ; } byte [ ] da = new byte [ result . size ( ) ] ; int i = 0 ; for ( Byte d : result ) da [ i ++ ] = d ; dataArray = da ; break ; } case USHORT : case SHORT : case ENUM2 : { ArrayList < Short > result = new ArrayList < > ( initial ) ; while ( sdataIter . hasNext ( ) ) { StructureData sdata = sdataIter . next ( ) ; StructureMembers . Member realm = sdata . getStructureMembers ( ) . findMember ( proxym . getName ( ) ) ; short [ ] data = sdata . getJavaArrayShort ( realm ) ; for ( short aData : data ) result . add ( aData ) ; count ++ ; } short [ ] da = new short [ result . size ( ) ] ; int i = 0 ; for ( Short d : result ) da [ i ++ ] = d ; dataArray = da ; break ; } case UINT : case INT : case ENUM4 : { ArrayList < Integer > result = new ArrayList < > ( initial ) ; while ( sdataIter . hasNext ( ) ) { StructureData sdata = sdataIter . next ( ) ; StructureMembers . Member realm = sdata . getStructureMembers ( ) . findMember ( proxym . getName ( ) ) ; int [ ] data = sdata . getJavaArrayInt ( realm ) ; for ( int aData : data ) result . add ( aData ) ; count ++ ; } int [ ] da = new int [ result . size ( ) ] ; int i = 0 ; for ( Integer d : result ) da [ i ++ ] = d ; dataArray = da ; break ; } case ULONG : case LONG : { ArrayList < Long > result = new ArrayList < > ( initial ) ; while ( sdataIter . hasNext ( ) ) { StructureData sdata = sdataIter . next ( ) ; StructureMembers . Member realm = sdata . getStructureMembers ( ) . findMember ( proxym . getName ( ) ) ; long [ ] data = sdata . getJavaArrayLong ( realm ) ; for ( long aData : data ) result . add ( aData ) ; count ++ ; } long [ ] da = new long [ result . size ( ) ] ; int i = 0 ; for ( Long d : result ) da [ i ++ ] = d ; dataArray = da ; break ; } case CHAR : { ArrayList < Character > result = new ArrayList < > ( initial ) ; while ( sdataIter . hasNext ( ) ) { StructureData sdata = sdataIter . next ( ) ; StructureMembers . Member realm = sdata . getStructureMembers ( ) . findMember ( proxym . getName ( ) ) ; char [ ] data = sdata . getJavaArrayChar ( realm ) ; for ( char aData : data ) result . add ( aData ) ; count ++ ; } char [ ] da = new char [ result . size ( ) ] ; int i = 0 ; for ( Character d : result ) da [ i ++ ] = d ; dataArray = da ; break ; } case STRING : { ArrayList < String > result = new ArrayList < > ( initial ) ; while ( sdataIter . hasNext ( ) ) { StructureData sdata = sdataIter . next ( ) ; StructureMembers . Member realm = sdata . getStructureMembers ( ) . findMember ( proxym . getName ( ) ) ; String [ ] data = sdata . getJavaArrayString ( realm ) ; result . addAll ( Arrays . asList ( data ) ) ; count ++ ; } String [ ] da = new String [ result . size ( ) ] ; int i = 0 ; for ( String d : result ) da [ i ++ ] = d ; dataArray = da ; break ; } case STRUCTURE : { ArrayList < StructureData > result = new ArrayList < > ( initial ) ; while ( sdataIter . hasNext ( ) ) { StructureData sdata = sdataIter . next ( ) ; StructureMembers . Member realm = sdata . getStructureMembers ( ) . findMember ( proxym . getName ( ) ) ; ArrayStructure as = sdata . getArrayStructure ( realm ) ; StructureDataIterator innerIter = as . getStructureDataIterator ( ) ; while ( innerIter . hasNext ( ) ) result . add ( innerIter . next ( ) ) ; count ++ ; } rshape [ 0 ] = count ; StructureMembers membersw = new StructureMembers ( proxym . getStructureMembers ( ) ) ; // no data arrays get propagated
return new ArrayStructureW ( membersw , rshape , result . toArray ( new StructureData [ 0 ] ) ) ; } } } // create an array to hold the result
rshape [ 0 ] = count ; return Array . factory ( dataType , rshape , dataArray ) ;


signature:
public class Index { /** * Compute the linear index
 * from the current odometer indices . */
public long index ( ) { } }

implementation: long offset = 0 ; for ( int i = 0 ; i < this . indices . length ; i ++ ) { offset *= this . dimsizes [ i ] ; offset += this . indices [ i ] ; } return offset ;


signature:
public class MFileOS7 { /** * Make MFileOS7 if file exists , otherwise return null
 * @ param filename full path name
 * @ return MFileOS or null */
static public MFileOS7 getExistingFile ( String filename ) throws IOException { } }

implementation: if ( filename == null ) return null ; Path path = Paths . get ( filename ) ; if ( Files . exists ( path ) ) return new MFileOS7 ( path ) ; return null ;


signature:
public class ServiceType { /** * Return the known ServiceType that matches the given name ( ignoring case )
 * or null if the name is unknown .
 * @ param name name of the desired ServiceType .
 * @ return ServiceType or null if no match . */
public static ServiceType findType ( String name ) { } }

implementation: if ( name == null ) return null ; for ( ServiceType serviceType : members ) { if ( serviceType . name . equalsIgnoreCase ( name ) ) return serviceType ; } return null ;


signature:
public class ServiceType { /** * Return a ServiceType that matches the given name by either matching
 * a known type ( ignoring case ) or creating an unknown type .
 * @ param name name of the desired ServiceType
 * @ return the named ServiceType or null if given name is null . */
public static ServiceType getType ( String name ) { } }

implementation: if ( name == null ) return null ; ServiceType type = findType ( name ) ; return type != null ? type : new ServiceType ( name , false ) ;


signature:
public class Grib2DataPanel { /** * / * public void setCollection ( String filename ) throws IOException {
 * if ( filename . endsWith ( GribCollection . IDX _ EXT ) ) {
 * openIndex ( filename ) ;
 * } else {
 * openCollection ( filename ) ;
 * private void openIndex ( String filename ) throws IOException {
 * GribCollection gribCollection = new GribCollection ( null ) ;
 * if ( ! gribCollection . readIndex ( filename ) )
 * throw new FileNotFoundException ( ) ;
 * this . cust = GribTables . factory ( gribCollection . center , gribCollection . subcenter , gribCollection . master , gribCollection . local ) ;
 * java . util . List < Grib2ParameterBean > params = new ArrayList < Grib2ParameterBean > ( ) ;
 * java . util . List < Gds2Bean > gdsList = new ArrayList < Gds2Bean > ( ) ;
 * for ( GribCollection . GroupHcs gHcs : gribCollection . getGroups ( ) ) {
 * for ( GribCollection . VariableIndex vi : gHcs . varIndex ) {
 * for ( vi . records )
 * addGroup ( ncfile , g , useGroups ) ;
 * int fileno = 0;
 * fileList = dcm . getFiles ( ) ;
 * for ( MFile mfile : fileList ) {
 * f . format ( " % n % s % n " , mfile . getPath ( ) ) ;
 * processGribFile ( mfile . getPath ( ) , fileno + + , pdsSet , gdsSet , params ) ;
 * param2BeanTable . setBeans ( params ) ;
 * for ( Grib2SectionGridDefinition gds : gdsSet . values ( ) ) {
 * gdsList . add ( new Gds2Bean ( gds ) ) ;
 * gds2Table . setBeans ( gdsList ) ; */
public void setCollection ( String spec ) throws IOException { } }

implementation: this . spec = spec ; this . cust = null ; Formatter f = new Formatter ( ) ; this . dcm = scanCollection ( spec , f ) ; if ( dcm == null ) { javax . swing . JOptionPane . showMessageDialog ( this , "Collection is null\n" + f . toString ( ) ) ; return ; } Map < Grib2Variable , Grib2ParameterBean > pdsSet = new HashMap < > ( ) ; Map < Integer , Grib2SectionGridDefinition > gdsSet = new HashMap < > ( ) ; java . util . List < Grib2ParameterBean > params = new ArrayList < > ( ) ; int fileno = 0 ; for ( MFile mfile : fileList ) { f . format ( "%n %s%n" , mfile . getPath ( ) ) ; try ( ucar . unidata . io . RandomAccessFile raf = new ucar . unidata . io . RandomAccessFile ( mfile . getPath ( ) , "r" ) ) { raf . order ( ByteOrder . BIG_ENDIAN ) ; processGribFile ( mfile , fileno ++ , raf , pdsSet , gdsSet , params , f ) ; } } param2BeanTable . setBeans ( params ) ;


signature:
public class Grib2DataPanel { /** * / * public boolean writeIndex ( Formatter f ) throws IOException {
 * MCollection dcm = scanCollection ( spec , f ) ;
 * if ( fileChooser = = null )
 * fileChooser = new FileManager ( null , null , null , ( PreferencesExt ) prefs . node ( " FileManager " ) ) ;
 * String name = dcm . getCollectionName ( ) ;
 * int pos = name . lastIndexOf ( ' / ' ) ;
 * if ( pos < 0 ) pos = name . lastIndexOf ( ' \ \ ' ) ;
 * if ( pos > 0 ) name = name . substring ( pos + 1 ) ;
 * File def = new File ( dcm . getRoot ( ) , name + GribCollection . NCX _ IDX ) ;
 * String filename = fileChooser . chooseFilename ( def ) ;
 * if ( filename = = null ) return false ;
 * if ( ! filename . endsWith ( GribCollection . NCX _ IDX ) )
 * filename + = GribCollection . NCX _ IDX ;
 * File idxFile = new File ( filename ) ;
 * Grib2CollectionBuilder . makeIndex ( dcm , new Formatter ( ) , logger ) ;
 * return true ; */
public void showInfo ( Formatter f ) { } }

implementation:
if ( dcm == null ) { if ( spec == null ) return ; dcm = scanCollection ( spec , f ) ; if ( dcm == null ) return ; } // just a list of the files
f . format ( "dcm = %s%n" , dcm ) ; try { for ( MFile mfile : dcm . getFilesSorted ( ) ) { f . format ( "  %s%n" , mfile . getPath ( ) ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; // To change body of catch statement use File | Settings | File Templates .
} // show nrecords , data size
int nrecords = 0 ; long dataSize = 0 ; long msgSize = 0 ; for ( Object o : param2BeanTable . getBeans ( ) ) { Grib2ParameterBean p = ( Grib2ParameterBean ) o ; for ( Grib2RecordBean r : p . getRecordBeans ( ) ) { nrecords ++ ; dataSize += r . getDataLength ( ) ; msgSize += r . getMsgLength ( ) ; } } f . format ( "nrecords = %d, total grib data size = %d, total grib msg sizes = %d" , nrecords , dataSize , msgSize ) ;


signature:
public class Grib2DataPanel { /** * / * private void checkRuntimes ( Formatter f ) {
 * Map < Date , DateCount > runs = new HashMap < Date , DateCount > ( ) ;
 * List < Grib2ParameterBean > params = param2BeanTable . getBeans ( ) ;
 * for ( Grib2ParameterBean pb : params ) {
 * List < Grib2RecordBean > records = pb . getRecordBeans ( ) ;
 * for ( Grib2RecordBean record : records ) {
 * Date d = record . getBaseTime ( ) ;
 * DateCount dc = runs . get ( d ) ;
 * if ( dc = = null ) {
 * dc = new DateCount ( d ) ;
 * runs . put ( d , dc ) ;
 * dc . count + + ;
 * List < DateCount > dcList = new ArrayList < DateCount > ( runs . values ( ) ) ;
 * Collections . sort ( dcList ) ;
 * f . format ( " Run Dates % n " ) ;
 * for ( DateCount dc : dcList )
 * f . format ( " % s = = % d % n " , df . toDateTimeStringISO ( dc . d ) , dc . count ) ; */
private void checkDuplicates ( Formatter f ) { } }

implementation:
// how unique are the pds ?
Set < Long > pdsMap = new HashSet < > ( ) ; int dups = 0 ; int count = 0 ; // do all records have the same runtime ?
Map < CalendarDate , DateCount > dateMap = new HashMap < > ( ) ; List < Grib2ParameterBean > params = param2BeanTable . getBeans ( ) ; for ( Grib2ParameterBean param : params ) { for ( Grib2RecordBean record : param . getRecordBeans ( ) ) { CalendarDate d = record . gr . getReferenceDate ( ) ; DateCount dc = dateMap . get ( d ) ; if ( dc == null ) { dc = new DateCount ( d ) ; dateMap . put ( d , dc ) ; } dc . count ++ ; Grib2SectionProductDefinition pdss = record . gr . getPDSsection ( ) ; long crc = pdss . calcCRC ( ) ; if ( pdsMap . contains ( crc ) ) dups ++ ; else pdsMap . add ( crc ) ; count ++ ; } } f . format ( "PDS duplicates = %d / %d%n%n" , dups , count ) ; List < DateCount > dcList = new ArrayList < > ( dateMap . values ( ) ) ; Collections . sort ( dcList ) ; f . format ( "Run Dates%n" ) ; int total = 0 ; for ( DateCount dc : dcList ) { f . format ( " %s == %d%n" , dc . d , dc . count ) ; total += dc . count ; } f . format ( "total records = %d%n" , total ) ;


signature: public class Grib2DataPanel { private void writeToFile ( List beans ) { } }

implementation: if ( fileChooser == null ) fileChooser = new FileManager ( null , null , null , ( PreferencesExt ) prefs . node ( "FileManager" ) ) ; FileOutputStream fos = null ; RandomAccessFile raf = null ; try { String filename = null ; boolean append = false ; int n = 0 ; MFile curr = null ; for ( Object o : beans ) { Grib2RecordBean bean = ( Grib2RecordBean ) o ; MFile mfile = fileList . get ( bean . gr . getFile ( ) ) ; if ( curr == null || curr != mfile ) { if ( raf != null ) raf . close ( ) ; raf = new RandomAccessFile ( mfile . getPath ( ) , "r" ) ; curr = mfile ; } if ( fos == null ) { String defloc = mfile . getPath ( ) ; filename = fileChooser . chooseFilenameToSave ( defloc + ".grib2" ) ; if ( filename == null ) return ; File f = new File ( filename ) ; append = f . exists ( ) ; fos = new FileOutputStream ( filename , append ) ; } Grib2SectionIndicator is = bean . gr . getIs ( ) ; int size = ( int ) ( is . getMessageLength ( ) ) ; long startPos = is . getStartPos ( ) ; if ( startPos < 0 ) { JOptionPane . showMessageDialog ( Grib2DataPanel . this , "Old index does not have message start - record not written" ) ; } byte [ ] rb = new byte [ size ] ; raf . seek ( startPos ) ; raf . readFully ( rb ) ; fos . write ( rb ) ; n ++ ; } JOptionPane . showMessageDialog ( Grib2DataPanel . this , filename + ": " + n + " records successfully written, append=" + append ) ; } catch ( Exception ex ) { JOptionPane . showMessageDialog ( Grib2DataPanel . this , "ERROR: " + ex . getMessage ( ) ) ; ex . printStackTrace ( ) ; } finally { try { if ( fos != null ) fos . close ( ) ; if ( raf != null ) raf . close ( ) ; } catch ( IOException ioe ) { } }


signature:
public class EsriShapefile { /** * Get a List of all the features in the shapefile that intersect
 * the specified bounding box . This requires testing every
 * feature in the List created at construction , so it ' s faster to
 * just give a bounding box o the constructor if you will only do
 * this once .
 * @ param bBox specifying the bounding box with which all
 * the returned features bounding boxes have a non - empty
 * intersection .
 * @ return a new list of features in the shapefile whose bounding
 * boxes intersect the specified bounding box . */
public List < EsriFeature > getFeatures ( Rectangle2D bBox ) { } }

implementation: if ( bBox == null ) return features ; List < EsriFeature > list = new ArrayList < > ( ) ; for ( EsriFeature gf : features ) { if ( gf . getBounds2D ( ) . intersects ( bBox ) ) list . add ( gf ) ; } return list ;


signature:
public class EsriShapefile { /** * Discretize elements of array to a lower resolution . For
 * example , if resolution = 100 . , the value 3.14159265358979 will
 * be changed to 3.14.
 * @ param d array of values to discretize to lower resolution
 * @ param n number of values in array to discretize */
private void discretize ( double [ ] d , int n ) { } }

implementation: if ( coarseness == 0.0 ) return ; for ( int i = 0 ; i < n ; i ++ ) { d [ i ] = ( Math . rint ( resolution * d [ i ] ) / resolution ) ; }


signature:
public class Jason2Convention { /** * _ more _
 * @ param ncDataset _ more _
 * @ param v _ more _
 * @ return _ more _ */
protected AxisType getAxisType ( NetcdfDataset ncDataset , VariableEnhanced v ) { } }

implementation:
String name = v . getShortName ( ) ; if ( name . equals ( "time" ) ) { return AxisType . Time ; } if ( name . equals ( "lat" ) ) { return AxisType . Lat ; } if ( name . equals ( "lon" ) ) { return AxisType . Lon ; } // if ( name . equals ( " xLeo " ) ) return AxisType . GeoX ;
// if ( name . equals ( " yLeo " ) ) return AxisType . GeoY ;
if ( name . equals ( "alt" ) ) { return AxisType . Height ; } return null ;


signature:
public class UnidataObsConvention { /** * create a NetcdfDataset out of this NetcdfFile , adding coordinates etc . */
public void augmentDataset ( NetcdfDataset ds , CancelTask cancelTask ) throws IOException { } }

implementation:
// latitude
if ( ! hasAxisType ( ds , AxisType . Lat ) ) { // already has _ CoordinateAxisType
if ( ! addAxisType ( ds , "latitude" , AxisType . Lat ) ) { // directly named
String vname = ds . findAttValueIgnoreCase ( null , "latitude_coordinate" , null ) ; if ( ! addAxisType ( ds , vname , AxisType . Lat ) ) { // attribute named
Variable v = hasUnits ( ds , "degrees_north,degrees_N,degreesN,degree_north,degree_N,degreeN" ) ; if ( v != null ) addAxisType ( v , AxisType . Lat ) ; // CF - 1
} } } // longitude
if ( ! hasAxisType ( ds , AxisType . Lon ) ) { // already has _ CoordinateAxisType
if ( ! addAxisType ( ds , "longitude" , AxisType . Lon ) ) { // directly named
String vname = ds . findAttValueIgnoreCase ( null , "longitude_coordinate" , null ) ; if ( ! addAxisType ( ds , vname , AxisType . Lon ) ) { // attribute named
Variable v = hasUnits ( ds , "degrees_east,degrees_E,degreesE,degree_east,degree_E,degreeE" ) ; if ( v != null ) addAxisType ( v , AxisType . Lon ) ; // CF - 1
} } } // altitude
if ( ! hasAxisType ( ds , AxisType . Height ) ) { // already has _ CoordinateAxisType
if ( ! addAxisType ( ds , "altitude" , AxisType . Height ) ) { // directly named
if ( ! addAxisType ( ds , "depth" , AxisType . Height ) ) { // directly named
String vname = ds . findAttValueIgnoreCase ( null , "altitude_coordinate" , null ) ; if ( ! addAxisType ( ds , vname , AxisType . Height ) ) { // attribute named
for ( int i = 0 ; i < ds . getVariables ( ) . size ( ) ; i ++ ) { VariableEnhanced ve = ( VariableEnhanced ) ds . getVariables ( ) . get ( i ) ; String positive = ds . findAttValueIgnoreCase ( ( Variable ) ve , CF . POSITIVE , null ) ; if ( positive != null ) { addAxisType ( ( Variable ) ve , AxisType . Height ) ; // CF - 1
break ; } } } } } } // time
if ( ! hasAxisType ( ds , AxisType . Time ) ) { // already has _ CoordinateAxisType
if ( ! addAxisType ( ds , "time" , AxisType . Time ) ) { // directly named
String vname = ds . findAttValueIgnoreCase ( null , "time_coordinate" , null ) ; if ( ! addAxisType ( ds , vname , AxisType . Time ) ) { // attribute named
for ( int i = 0 ; i < ds . getVariables ( ) . size ( ) ; i ++ ) { VariableEnhanced ve = ( VariableEnhanced ) ds . getVariables ( ) . get ( i ) ; String unit = ve . getUnitsString ( ) ; if ( unit == null ) continue ; if ( SimpleUnit . isDateUnit ( unit ) ) { addAxisType ( ( Variable ) ve , AxisType . Time ) ; // CF - 1
break ; } } } } }


signature:
public class ThreddsMetadata { /** * Add all the content from another ThreddsMetadata
 * @ param tmd get content from here
 * @ param includeInherited if false , dont add inherited InvMetadata */
public void add ( ThreddsMetadata tmd , boolean includeInherited ) { } }

implementation:
creators . addAll ( tmd . getCreators ( ) ) ; contributors . addAll ( tmd . getContributors ( ) ) ; dates . addAll ( tmd . getDates ( ) ) ; docs . addAll ( tmd . getDocumentation ( ) ) ; keywords . addAll ( tmd . getKeywords ( ) ) ; projects . addAll ( tmd . getProjects ( ) ) ; properties . addAll ( tmd . getProperties ( ) ) ; publishers . addAll ( tmd . getPublishers ( ) ) ; variables . addAll ( tmd . getVariables ( ) ) ; if ( includeInherited ) metadata . addAll ( tmd . getMetadata ( ) ) ; else { for ( InvMetadata mdata : tmd . getMetadata ( ) ) { if ( ! mdata . isInherited ( ) ) metadata . add ( mdata ) ; } } // LOOK ! should be copies ? ? ! !
if ( gc == null ) gc = tmd . getGeospatialCoverage ( ) ; if ( timeCoverage == null ) timeCoverage = tmd . getTimeCoverage ( ) ; if ( serviceName == null ) serviceName = tmd . getServiceName ( ) ; if ( dataType == null ) dataType = tmd . getDataType ( ) ; if ( dataSize == 0.0 ) dataSize = tmd . getDataSize ( ) ; if ( dataFormat == null ) dataFormat = tmd . getDataFormatType ( ) ; if ( authorityName == null ) authorityName = tmd . getAuthority ( ) ; if ( variableMapLink == null ) variableMapLink = tmd . getVariableMap ( ) ;


signature:
public class ThreddsMetadata { /** * set specified type of documentation
 * @ param type type of documentation
 * @ param content documentation contenet */
public void addDocumentation ( String type , String content ) { } }

implementation: if ( content == null ) { removeDocumentation ( type ) ; return ; } content = content . trim ( ) ; for ( InvDocumentation doc : getDocumentation ( ) ) { String dtype = doc . getType ( ) ; if ( ( dtype != null ) && dtype . equalsIgnoreCase ( type ) ) { doc . setInlineContent ( content ) ; return ; } } if ( content . length ( ) > 0 ) addDocumentation ( new InvDocumentation ( null , null , null , type , content ) ) ;


signature:
public class ThreddsMetadata { /** * remove all instances of specified type of documentation
 * @ param type type of documentation */
public void removeDocumentation ( String type ) { } }

implementation: Iterator iter = docs . iterator ( ) ; while ( iter . hasNext ( ) ) { InvDocumentation doc = ( InvDocumentation ) iter . next ( ) ; String dtype = doc . getType ( ) ; if ( ( dtype != null ) && dtype . equalsIgnoreCase ( type ) ) iter . remove ( ) ; }


signature: public class LayoutSegmented { private long getFilePos ( long elem ) { } }

implementation: int segno = 0 ; while ( elem >= segMax [ segno ] ) segno ++ ; return segPos [ segno ] + elem - segMin [ segno ] ;


signature:
public class LayoutSegmented { /** * how many more bytes are in this segment ? */
private int getMaxBytes ( long start ) { } }

implementation: int segno = 0 ; while ( start >= segMax [ segno ] ) segno ++ ; return ( int ) ( segMax [ segno ] - start ) ;


signature:
public class GribUtils { /** * Convert a time unit to a CalendarPeriod
 * GRIB1 and GRIB2 are the same ( ! )
 * @ param timeUnit ( GRIB1 table 4 ) ( GRIB2 Code table 4.4 : Indicator of unit of time range )
 * @ return equivalent CalendarPeriod */
public static CalendarPeriod getCalendarPeriod ( int timeUnit ) { } }

implementation:
// LOOK - some way to intern these ? put in hash table ?
switch ( timeUnit ) { // code table 4.4
case 0 : return CalendarPeriod . of ( 1 , CalendarPeriod . Field . Minute ) ; case 1 : return CalendarPeriod . of ( 1 , CalendarPeriod . Field . Hour ) ; case 2 : return CalendarPeriod . of ( 1 , CalendarPeriod . Field . Day ) ; case 3 : return CalendarPeriod . of ( 1 , CalendarPeriod . Field . Month ) ; case 4 : return CalendarPeriod . of ( 1 , CalendarPeriod . Field . Year ) ; case 5 : return CalendarPeriod . of ( 10 , CalendarPeriod . Field . Year ) ; case 6 : return CalendarPeriod . of ( 30 , CalendarPeriod . Field . Year ) ; case 7 : return CalendarPeriod . of ( 100 , CalendarPeriod . Field . Year ) ; case 10 : return CalendarPeriod . of ( 3 , CalendarPeriod . Field . Hour ) ; case 11 : return CalendarPeriod . of ( 6 , CalendarPeriod . Field . Hour ) ; case 12 : return CalendarPeriod . of ( 12 , CalendarPeriod . Field . Hour ) ; case 13 : return CalendarPeriod . of ( 15 , CalendarPeriod . Field . Minute ) ; case 14 : return CalendarPeriod . of ( 30 , CalendarPeriod . Field . Minute ) ; default : throw new UnsupportedOperationException ( "Unknown time unit = " + timeUnit ) ; }


signature:
public class UInt16PrimitiveVector { /** * Prints the value of all variables in this vector . This
 * method is primarily intended for debugging OPeNDAP applications and
 * text - based clients such as geturl .
 * @ param os the < code > PrintWriter < / code > on which to print the value .
 * @ param space this value is passed to the < code > printDecl < / code > method ,
 * and controls the leading spaces of the output .
 * @ see BaseType # printVal ( PrintWriter , String , boolean ) */
public void printVal ( PrintWriter os , String space ) { } }

implementation:
int len = getLength ( ) ; for ( int i = 0 ; i < len - 1 ; i ++ ) { // to print properly , cast to long and convert to unsigned
os . print ( ( ( long ) getValue ( i ) ) & 0xFFFFL ) ; os . print ( ", " ) ; } // print last value , if any , without trailing comma
if ( len > 0 ) os . print ( ( ( long ) getValue ( len - 1 ) ) & 0xFFFFL ) ;


signature:
public class BytePrimitiveVector { /** * Reads data from a < code > DataInputStream < / code > . This method is only used
 * on the client side of the OPeNDAP client / server connection .
 * @ param source a < code > DataInputStream < / code > to read from .
 * @ param sv The < code > ServerVersion < / code > returned by the server .
 * ( used by < code > DSequence < / code > to determine which protocol version was
 * used ) .
 * @ param statusUI The < code > StatusUI < / code > object to use for GUI updates
 * and user cancellation notification ( may be null ) .
 * @ throws DataReadException when invalid data is read , or if the user
 * cancels the download .
 * @ throws EOFException if EOF is found before the variable is completely
 * deserialized .
 * @ throws IOException thrown on any other InputStream exception .
 * @ see ClientIO # deserialize ( DataInputStream , ServerVersion , StatusUI ) */
public synchronized void deserialize ( DataInputStream source , ServerVersion sv , StatusUI statusUI ) throws IOException , EOFException , DataReadException { } }

implementation:
int modFour = vals . length % 4 ; // number of bytes to pad
int pad = ( modFour != 0 ) ? ( 4 - modFour ) : 0 ; for ( int i = 0 ; i < vals . length ; i ++ ) { vals [ i ] = source . readByte ( ) ; if ( statusUI != null ) { statusUI . incrementByteCount ( 1 ) ; if ( statusUI . userCancelled ( ) ) throw new DataReadException ( "User cancelled" ) ; } } // pad out to a multiple of four bytes
byte unused ; for ( int i = 0 ; i < pad ; i ++ ) unused = source . readByte ( ) ; if ( statusUI != null ) statusUI . incrementByteCount ( pad ) ;


signature:
public class BytePrimitiveVector { /** * Writes data to a < code > DataOutputStream < / code > . This method is used
 * primarily by GUI clients which need to download OPeNDAP data , manipulate
 * it , and then re - save it as a binary file .
 * @ param sink a < code > DataOutputStream < / code > to write to .
 * @ throws IOException thrown on any < code > OutputStream < / code >
 * exception . */
public void externalize ( DataOutputStream sink ) throws IOException { } }

implementation:
int modFour = vals . length % 4 ; // number of bytes to pad
int pad = ( modFour != 0 ) ? ( 4 - modFour ) : 0 ; for ( int i = 0 ; i < vals . length ; i ++ ) { sink . writeByte ( vals [ i ] ) ; } // pad out to a multiple of four bytes
for ( int i = 0 ; i < pad ; i ++ ) sink . writeByte ( 0 ) ;


signature:
public class BytePrimitiveVector { /** * Write a subset of the data to a < code > DataOutputStream < / code > .
 * @ param sink a < code > DataOutputStream < / code > to write to .
 * @ param start starting index ( i = start )
 * @ param stop ending index ( i < = stop )
 * @ param stride index stride ( i + = stride )
 * @ throws IOException thrown on any < code > OutputStream < / code > exception . */
public void externalize ( DataOutputStream sink , int start , int stop , int stride ) throws IOException { } }

implementation:
int count = 0 ; for ( int i = start ; i <= stop ; i += stride ) { sink . writeByte ( vals [ i ] ) ; count ++ ; } // pad out to a multiple of four bytes
int modFour = count % 4 ; int pad = ( modFour != 0 ) ? ( 4 - modFour ) : 0 ; for ( int i = 0 ; i < pad ; i ++ ) sink . writeByte ( 0 ) ;


signature:
public class GribResourceReader { /** * Get the input stream to the given resource
 * @ param resourceName The resource name . May be a resource on the class path or a file
 * @ return The input stream to the resource */
public static InputStream getInputStream ( String resourceName ) throws FileNotFoundException { } }

implementation:
// Try class loader to get resource
ClassLoader cl = GribResourceReader . class . getClassLoader ( ) ; InputStream s = cl . getResourceAsStream ( resourceName ) ; if ( s != null ) { return s ; } // Try the file system
File f = new File ( resourceName ) ; if ( f . exists ( ) ) return new FileInputStream ( f ) ; // give up
throw new FileNotFoundException ( "Cant find resource " + resourceName ) ;


signature:
public class NsslRadarMosaicConvention { /** * Is this my file ?
 * @ param ncfile test this NetcdfFile
 * @ return true if we think this is a NsslRadarMosaicConvention file . */
public static boolean isMine ( NetcdfFile ncfile ) { } }

implementation: String cs = ncfile . findAttValueIgnoreCase ( null , CDM . CONVENTIONS , null ) ; if ( cs != null ) return false ; String s = ncfile . findAttValueIgnoreCase ( null , "DataType" , null ) ; if ( ( s == null ) || ! ( s . equalsIgnoreCase ( "LatLonGrid" ) || s . equalsIgnoreCase ( "LatLonHeightGrid" ) ) ) return false ; if ( ( null == ncfile . findGlobalAttribute ( "Latitude" ) ) || ( null == ncfile . findGlobalAttribute ( "Longitude" ) ) || ( null == ncfile . findGlobalAttribute ( "LatGridSpacing" ) ) || ( null == ncfile . findGlobalAttribute ( "LonGridSpacing" ) ) || ( null == ncfile . findGlobalAttribute ( "Time" ) ) ) return false ; return ! ( null == ncfile . findDimension ( "Lat" ) || null == ncfile . findDimension ( "Lon" ) ) ;


signature:
public class StructureDataFactory { /** * / * static public StructureData make ( String name , String value ) {
 * StructureMembers members = new StructureMembers ( " " ) ;
 * StructureMembers . Member m = members . addMember ( name , null , null , DataType . STRING , new int [ ] { 1 } ) ;
 * StructureDataW sw = new StructureDataW ( members ) ;
 * Array dataArray = Array . factory ( DataType . STRING , new int [ ] { 1 } ) ;
 * dataArray . setObject ( dataArray . getIndex ( ) , value ) ;
 * sw . setMemberData ( m , dataArray ) ;
 * return sw ; */
static public StructureData make ( String name , Object value ) { } }

implementation:
StructureMembers members = new StructureMembers ( "" ) ; DataType dtype = DataType . getType ( value . getClass ( ) , false ) ; // LOOK unsigned
StructureMembers . Member m = members . addMember ( name , null , null , dtype , new int [ ] { 1 } ) ; StructureDataW sw = new StructureDataW ( members ) ; Array dataArray = Array . factory ( dtype , new int [ ] { 1 } ) ; dataArray . setObject ( dataArray . getIndex ( ) , value ) ; sw . setMemberData ( m , dataArray ) ; return sw ;


signature:
public class CollectionManagerCatalog { /** * CatalogCrawler . Listener */
@ Override public void getDataset ( Dataset ds , Object context ) { } }

implementation:
if ( ds . hasAccess ( ) ) { DataFactory tdataFactory = new DataFactory ( ) ; Access access = tdataFactory . chooseDatasetAccess ( ds . getAccess ( ) ) ; if ( access == null ) throw new IllegalStateException ( ) ; MFileRemote mfile = new MFileRemote ( access ) ; if ( mfile . getPath ( ) . endsWith ( ".xml" ) ) return ; // eliminate latest . xml LOOK kludge - o - rama
mfiles . add ( mfile ) ; if ( debug ) System . out . format ( "add %s %n" , mfile . getPath ( ) ) ; }


signature:
public class CoordSysBuilder { /** * Register a class that implements a Convention .
 * @ param conventionName name of Convention .
 * This name will be used to look in the " Conventions " global attribute .
 * Otherwise , you must implement the isMine ( ) static method .
 * @ param match pass in your own matcher . if null , equalsIgnoreCase ( ) will be used .
 * @ param c implementation of CoordSysBuilderIF that parses those kinds of netcdf files . */
static public void registerConvention ( String conventionName , Class c , ConventionNameOk match ) { } }

implementation:
if ( ! ( CoordSysBuilderIF . class . isAssignableFrom ( c ) ) ) throw new IllegalArgumentException ( "CoordSysBuilderIF Class " + c . getName ( ) + " must implement CoordSysBuilderIF" ) ; // fail fast - check newInstance works
try { c . newInstance ( ) ; } catch ( InstantiationException e ) { throw new IllegalArgumentException ( "CoordSysBuilderIF Class " + c . getName ( ) + " cannot instantiate, probably need default Constructor" ) ; } catch ( IllegalAccessException e ) { throw new IllegalArgumentException ( "CoordSysBuilderIF Class " + c . getName ( ) + " is not accessible" ) ; } // user stuff gets put at top
if ( userMode ) conventionList . add ( 0 , new Convention ( conventionName , c , match ) ) ; else conventionList . add ( new Convention ( conventionName , c , match ) ) ;


signature:
public class CoordSysBuilder { /** * Register a class that implements a Convention .
 * @ param conventionName name of Convention .
 * This name will be used to look in the " Conventions " global attribute .
 * Otherwise , you must implement the isMine ( ) static method .
 * @ param className name of class that implements CoordSysBuilderIF .
 * @ throws ClassNotFoundException if class could not be loaded */
static public void registerConvention ( String conventionName , String className ) throws ClassNotFoundException { } }

implementation: Class c = Class . forName ( className ) ; registerConvention ( conventionName , c , null ) ;


signature:
public class CoordSysBuilder { /** * Breakup list of Convention names in the Convention attribute in CF compliant way .
 * @ param convAttValue original value of Convention attribute
 * @ return list of Convention names */
static public List < String > breakupConventionNames ( String convAttValue ) { } }

implementation: List < String > names = new ArrayList < > ( ) ; if ( ( convAttValue . indexOf ( ',' ) > 0 ) || ( convAttValue . indexOf ( ';' ) > 0 ) ) { StringTokenizer stoke = new StringTokenizer ( convAttValue , ",;" ) ; while ( stoke . hasMoreTokens ( ) ) { String name = stoke . nextToken ( ) ; names . add ( name . trim ( ) ) ; } } else if ( ( convAttValue . indexOf ( '/' ) > 0 ) ) { StringTokenizer stoke = new StringTokenizer ( convAttValue , "/" ) ; while ( stoke . hasMoreTokens ( ) ) { String name = stoke . nextToken ( ) ; names . add ( name . trim ( ) ) ; } } else { StringTokenizer stoke = new StringTokenizer ( convAttValue , " " ) ; while ( stoke . hasMoreTokens ( ) ) { String name = stoke . nextToken ( ) ; names . add ( name . trim ( ) ) ; } } return names ;


signature:
public class CoordSysBuilder { /** * Build a list of Conventions
 * @ param mainConv this is the main convention
 * @ param convAtts list of others , onbly use " extra " Conventions
 * @ return comma separated list of Conventions */
static public String buildConventionAttribute ( String mainConv , String ... convAtts ) { } }

implementation:
List < String > result = new ArrayList < > ( ) ; result . add ( mainConv ) ; for ( String convs : convAtts ) { if ( convs == null ) continue ; List < String > ss = breakupConventionNames ( convs ) ; // may be a list
for ( String s : ss ) { if ( matchConvention ( s ) == null ) // only add extra ones , not ones that compete with mainConv
result . add ( s ) ; } } // now form comma separated result
boolean start = true ; Formatter f = new Formatter ( ) ; for ( String s : result ) { if ( start ) f . format ( "%s" , s ) ; else f . format ( ", %s" , s ) ; start = false ; } return f . toString ( ) ;


signature:
public class CoordSysBuilder { /** * Get a CoordSysBuilder whose job it is to add Coordinate information to a NetcdfDataset .
 * @ param ds the NetcdfDataset to modify
 * @ param cancelTask allow user to bail out .
 * @ return the builder used
 * @ throws java . io . IOException on io error
 * @ see ucar . nc2 . dataset . NetcdfDataset # enhance */
static public @ Nonnull CoordSysBuilderIF factory ( NetcdfDataset ds , CancelTask cancelTask ) throws IOException { } }

implementation:
// look for the Conventions attribute
String convName = ds . findAttValueIgnoreCase ( null , CDM . CONVENTIONS , null ) ; if ( convName == null ) convName = ds . findAttValueIgnoreCase ( null , "Convention" , null ) ; // common mistake Convention instead of Conventions
if ( convName != null ) convName = convName . trim ( ) ; // look for ncml first
if ( convName != null ) { String convNcML = ncmlHash . get ( convName ) ; if ( convNcML != null ) { CoordSysBuilder csb = new CoordSysBuilder ( ) ; NcMLReader . wrapNcML ( ds , convNcML , cancelTask ) ; return csb ; } } // look for registered conventions using convention name
Class convClass = null ; if ( convName != null ) { convClass = matchConvention ( convName ) ; // now look for comma or semicolon or / delimited list
if ( convClass == null ) { List < String > names = breakupConventionNames ( convName ) ; if ( names . size ( ) > 0 ) { // search the registered conventions , in order
for ( Convention conv : conventionList ) { for ( String name : names ) { if ( name . equalsIgnoreCase ( conv . convName ) ) { convClass = conv . convClass ; convName = name ; } } if ( convClass != null ) break ; } } } } // look for ones that dont use Convention attribute , in order added .
// call static isMine ( ) using reflection .
if ( convClass == null ) { for ( Convention conv : conventionList ) { Class c = conv . convClass ; Method m ; try { m = c . getMethod ( "isMine" , NetcdfFile . class ) ; // LOOK cant we test if method exists ?
} catch ( NoSuchMethodException ex ) { continue ; } try { Boolean result = ( Boolean ) m . invoke ( null , ds ) ; if ( result ) { convClass = c ; break ; } } catch ( Exception ex ) { log . error ( "ERROR: Class " + c . getName ( ) + " Exception invoking isMine method\n" + ex ) ; } } } // use service loader mechanism
// call static isMine ( ) using reflection .
CoordSysBuilderIF builder = null ; if ( convClass == null ) { for ( CoordSysBuilderIF csb : ServiceLoader . load ( CoordSysBuilderIF . class ) ) { Class c = csb . getClass ( ) ; Method m ; try { m = c . getMethod ( "isMine" , NetcdfFile . class ) ; } catch ( NoSuchMethodException ex ) { continue ; } try { Boolean result = ( Boolean ) m . invoke ( null , ds ) ; if ( result ) { builder = csb ; convClass = c ; break ; } } catch ( Exception ex ) { log . error ( "ERROR: Class " + c . getName ( ) + " Exception invoking isMine method%n" + ex ) ; } } } // if no convention class found , use the default
if ( convClass == null ) convClass = DefaultConvention . class ; if ( builder == null ) { // get an instance of the class
try { builder = ( CoordSysBuilderIF ) convClass . newInstance ( ) ; } catch ( Exception e ) { log . error ( "failed on CoordSysBuilderIF for " + convClass . getName ( ) , e ) ; throw new RuntimeException ( e ) ; } } if ( convName == null ) builder . addUserAdvice ( "No 'Conventions' global attribute." ) ; else if ( convClass == DefaultConvention . class ) builder . addUserAdvice ( "No CoordSysBuilder is defined for Conventions= '" + convName + "'\n" ) ; else builder . setConventionUsed ( convClass . getName ( ) ) ; ds . addAttribute ( null , new Attribute ( _Coordinate . _CoordSysBuilder , convClass . getName ( ) ) ) ; return builder ;


signature:
public class CoordSysBuilder { /** * Heres where the work is to identify coordinate axes and coordinate systems .
 * @ param ncDataset modify this dataset */
@ Override public void buildCoordinateSystems ( NetcdfDataset ncDataset ) { } }

implementation:
// put status info into parseInfo that can be shown to someone trying to debug this process
parseInfo . format ( "Parsing with Convention = %s%n" , conventionName ) ; // Bookkeeping info for each variable is kept in the VarProcess inner class
addVariables ( ncDataset , ncDataset . getVariables ( ) , varList ) ; // identify which variables are coordinate axes
findCoordinateAxes ( ncDataset ) ; // identify which variables are used to describe coordinate system
findCoordinateSystems ( ncDataset ) ; // identify which variables are used to describe coordinate transforms
findCoordinateTransforms ( ncDataset ) ; // turn Variables into CoordinateAxis objects
makeCoordinateAxes ( ncDataset ) ; // make Coordinate Systems for all Coordinate Systems Variables
makeCoordinateSystems ( ncDataset ) ; // assign explicit CoordinateSystem objects to variables
assignCoordinateSystemsExplicit ( ncDataset ) ; // assign implicit CoordinateSystem objects to variables
makeCoordinateSystemsImplicit ( ncDataset ) ; // optionally assign implicit CoordinateSystem objects to variables that dont have one yet
if ( useMaximalCoordSys ) makeCoordinateSystemsMaximal ( ncDataset ) ; // make Coordinate Transforms
makeCoordinateTransforms ( ncDataset ) ; // assign Coordinate Transforms
assignCoordinateTransforms ( ncDataset ) ; if ( debug ) System . out . println ( "parseInfo = \n" + parseInfo . toString ( ) ) ;


signature:
public class CoordSysBuilder { /** * Identify coordinate axes , set VarProcess . isCoordinateAxis = true .
 * Default is to look for those referenced by _ CoordinateAxes attribute .
 * Note coordinate variables are already identified .
 * @ param ncDataset why */
protected void findCoordinateAxes ( NetcdfDataset ncDataset ) { } }

implementation: for ( VarProcess vp : varList ) { if ( vp . coordAxes != null ) findCoordinateAxes ( vp , vp . coordAxes ) ; if ( vp . coordinates != null ) findCoordinateAxes ( vp , vp . coordinates ) ; }


signature:
public class CoordSysBuilder { /** * Identify coordinate systems , set VarProcess . isCoordinateSystem = true .
 * Default is to look for those referenced by _ CoordinateSystems attribute .
 * @ param ncDataset why */
protected void findCoordinateSystems ( NetcdfDataset ncDataset ) { } }

implementation: for ( VarProcess vp : varList ) { if ( vp . coordSys != null ) { StringTokenizer stoker = new StringTokenizer ( vp . coordSys ) ; while ( stoker . hasMoreTokens ( ) ) { String vname = stoker . nextToken ( ) ; VarProcess ap = findVarProcess ( vname , vp ) ; if ( ap != null ) { if ( ! ap . isCoordinateSystem ) parseInfo . format ( " CoordinateSystem = %s added; referenced from var= %s%n" , vname , vp . v . getFullName ( ) ) ; ap . isCoordinateSystem = true ; } else { parseInfo . format ( "***Cant find coordSystem %s referenced from var= %s%n" , vname , vp . v . getFullName ( ) ) ; userAdvice . format ( "***Cant find coordSystem %s referenced from var= %s%n" , vname , vp . v . getFullName ( ) ) ; } } } }


signature:
public class CoordSysBuilder { /** * Identify coordinate transforms , set VarProcess . isCoordinateTransform = true .
 * Default is to look for those referenced by _ CoordinateTransforms attribute
 * ( or has a _ CoordinateTransformType attribute , done in VarProcess constructor )
 * @ param ncDataset why */
protected void findCoordinateTransforms ( NetcdfDataset ncDataset ) { } }

implementation: for ( VarProcess vp : varList ) { if ( vp . coordTransforms != null ) { StringTokenizer stoker = new StringTokenizer ( vp . coordTransforms ) ; while ( stoker . hasMoreTokens ( ) ) { String vname = stoker . nextToken ( ) ; VarProcess ap = findVarProcess ( vname , vp ) ; if ( ap != null ) { if ( ! ap . isCoordinateTransform ) parseInfo . format ( " CoordinateTransform = %s added; referenced from var= %s%n" , vname , vp . v . getFullName ( ) ) ; ap . isCoordinateTransform = true ; } else { parseInfo . format ( "***Cant find CoordinateTransform %s referenced from var= %s%n" , vname , vp . v . getFullName ( ) ) ; userAdvice . format ( "***Cant find CoordinateTransform %s referenced from var= %s%n" , vname , vp . v . getFullName ( ) ) ; } } } }


signature:
public class CoordSysBuilder { /** * Take previously identified Coordinate Axis and Coordinate Variables and make them into a
 * CoordinateAxis . Uses the getAxisType ( ) method to figure out the type , if not already set .
 * @ param ncDataset containing dataset */
protected void makeCoordinateAxes ( NetcdfDataset ncDataset ) { } }

implementation: for ( VarProcess vp : varList ) { if ( vp . isCoordinateAxis || vp . isCoordinateVariable ) { if ( vp . axisType == null ) vp . axisType = getAxisType ( ncDataset , ( VariableEnhanced ) vp . v ) ; if ( vp . axisType == null ) { userAdvice . format ( "Coordinate Axis %s does not have an assigned AxisType%n" , vp . v . getFullName ( ) ) ; } vp . makeIntoCoordinateAxis ( ) ; } }


signature:
public class CoordSysBuilder { /** * Take all previously identified Coordinate Systems and create a
 * CoordinateSystem object .
 * @ param ncDataset why */
protected void makeCoordinateSystems ( NetcdfDataset ncDataset ) { } }

implementation: for ( VarProcess vp : varList ) { if ( vp . isCoordinateSystem ) { vp . makeCoordinateSystem ( ) ; } }