signature:
public class SimpleGeometryIndexFinder { /** * Gets the beginning index of a geometry ' s points given the index of the geometry within the array .
 * @ param index
 * @ return beginning of the range */
public int getBeginning ( int index ) { } }

implementation:
// Test if the last end is the new beginning
if ( index == ( pastIndex + 1 ) ) { return previousEnd + 1 ; } // Otherwise , find it !
int newBeginning = 0 ; for ( int i = 0 ; i < index ; i ++ ) { newBeginning += getNodeCount ( i ) ; } pastIndex = index ; previousBegin = newBeginning ; return newBeginning ;


signature:
public class SimpleGeometryIndexFinder { /** * Gets the ending index of a geometry ' s points given the index of the geometry within the array .
 * @ param index of the geometry within the array
 * @ return end of the range */
public int getEnd ( int index ) { } }

implementation:
// Test if the last beginning is the new end
if ( index == ( pastIndex - 1 ) ) { return previousBegin - 1 ; } // Otherwise find it !
int new_end = 0 ; for ( int i = 0 ; i < index + 1 ; i ++ ) { new_end += getNodeCount ( i ) ; } pastIndex = index ; previousEnd = new_end ; return new_end - 1 ;


signature:
public class GetAsciiHandler { /** * Default handler for OPeNDAP ascii requests . Returns OPeNDAP DAP2 data in
 * comma delimited ascii columns for ingestion into some not so
 * OPeNDAP enabled application such as MS - Excel . Accepts constraint
 * expressions in exactly the same way as the regular OPeNDAP dataserver .
 * @ param rs
 * @ throws opendap . dap . DAP2Exception
 * @ throws ParseException */
public void sendASCII ( ReqState rs , String dataSet ) throws DAP2Exception , ParseException { } }

implementation:
if ( Debug . isSet ( "showResponse" ) ) System . out . println ( "Sending OPeNDAP ASCII Data For: " + dataSet + "    CE: '" + rs . getConstraintExpression ( ) + "'" ) ; String requestURL , ce ; DataDDS dds ; if ( rs . getConstraintExpression ( ) == null ) { ce = "" ; } else { ce = "?" + rs . getConstraintExpression ( ) ; } int suffixIndex = rs . getRequestURL ( ) . toString ( ) . lastIndexOf ( "." ) ; requestURL = rs . getRequestURL ( ) . substring ( 0 , suffixIndex ) ; if ( Debug . isSet ( "showResponse" ) ) { System . out . println ( "New Request URL Resource: '" + requestURL + "'" ) ; System . out . println ( "New Request Constraint Expression: '" + ce + "'" ) ; } if ( _Debug ) System . out . println ( "Making connection to .dods service..." ) ; try ( DConnect2 url = new DConnect2 ( requestURL , true ) ) { if ( _Debug ) System . out . println ( "Requesting data..." ) ; dds = url . getData ( ce , null , new asciiFactory ( ) ) ; if ( _Debug ) System . out . println ( " ASC DDS: " ) ; if ( _Debug ) dds . print ( System . out ) ; PrintWriter pw = new PrintWriter ( new OutputStreamWriter ( rs . getResponse ( ) . getOutputStream ( ) , Util . UTF8 ) ) ; PrintWriter pwDebug = new PrintWriter ( new OutputStreamWriter ( System . out , Util . UTF8 ) ) ; if ( dds != null ) { dds . print ( pw ) ; pw . println ( "---------------------------------------------" ) ; String s = "" ; Enumeration e = dds . getVariables ( ) ; while ( e . hasMoreElements ( ) ) { BaseType bt = ( BaseType ) e . nextElement ( ) ; if ( _Debug ) ( ( toASCII ) bt ) . toASCII ( pwDebug , true , null , true ) ; // bt . toASCII ( pw , addName , getNAme ( ) , true ) ;
( ( toASCII ) bt ) . toASCII ( pw , true , null , true ) ; } } else { String betterURL = rs . getRequestURL ( ) . substring ( 0 , rs . getRequestURL ( ) . lastIndexOf ( "." ) ) + ".dods?" + rs . getConstraintExpression ( ) ; pw . println ( "-- ASCII RESPONSE HANDLER PROBLEM --" ) ; pw . println ( "" ) ; pw . println ( "The ASCII response handler was unable to obtain requested data set." ) ; pw . println ( "" ) ; pw . println ( "Because this handler calls it's own OPeNDAP server to get the requested" ) ; pw . println ( "data the source error is obscured." ) ; pw . println ( "" ) ; pw . println ( "To get a better idea of what is going wrong, try requesting the URL:" ) ; pw . println ( "" ) ; pw . println ( "    " + betterURL ) ; pw . println ( "" ) ; pw . println ( "And then look carefully at the returned document. Note that if you" ) ; pw . println ( "are using a browser to access the URL the returned document will" ) ; pw . println ( "more than likely be treated as a download and written to your" ) ; pw . println ( "local disk. It should be a file with the extension \".dods\"" ) ; pw . println ( "" ) ; pw . println ( "Locate it, open it with a text editor, and find your" ) ; pw . println ( "way to happiness and inner peace." ) ; pw . println ( "" ) ; } // pw . println ( " < / pre > " ) ;
pw . flush ( ) ; if ( _Debug ) pwDebug . flush ( ) ; } catch ( FileNotFoundException fnfe ) { System . out . println ( "OUCH! FileNotFoundException: " + fnfe . getMessage ( ) ) ; fnfe . printStackTrace ( System . out ) ; } catch ( MalformedURLException mue ) { System . out . println ( "OUCH! MalformedURLException: " + mue . getMessage ( ) ) ; mue . printStackTrace ( System . out ) ; } catch ( IOException ioe ) { System . out . println ( "OUCH! IOException: " + ioe . getMessage ( ) ) ; ioe . printStackTrace ( System . out ) ; } catch ( Throwable t ) { System . out . println ( "OUCH! Throwable: " + t . getMessage ( ) ) ; t . printStackTrace ( System . out ) ; } if ( _Debug ) System . out . println ( " GetAsciiHandler done" ) ;


signature:
public class GribCollectionBuilder { /** * Throw exception if failure */
boolean createIndex ( FeatureCollectionConfig . PartitionType ptype , Formatter errlog ) throws IOException { } }

implementation: if ( ptype == FeatureCollectionConfig . PartitionType . all ) return createAllRuntimeCollections ( errlog ) ; else return createMultipleRuntimeCollections ( errlog ) ;


signature:
public class GribCollectionBuilder { /** * Throw exception if failure */
private boolean createMultipleRuntimeCollections ( Formatter errlog ) throws IOException { } }

implementation:
long start = System . currentTimeMillis ( ) ; List < MFile > files = new ArrayList < > ( ) ; List < ? extends Group > groups = makeGroups ( files , false , errlog ) ; List < MFile > allFiles = Collections . unmodifiableList ( files ) ; if ( allFiles . size ( ) == 0 ) { throw new IllegalStateException ( "No files in this collection =" + name + " topdir=" + dcm . getRoot ( ) ) ; } if ( groups . size ( ) == 0 ) { throw new IllegalStateException ( "No records in this collection =" + name + " topdir=" + dcm . getRoot ( ) ) ; } // Create the master runtimes , classify the result
CalendarDateRange calendarDateRangeAll = null ; // boolean allTimesAreOne = true ;
boolean allTimesAreUnique = true ; Set < Long > allRuntimes = new HashSet < > ( ) ; for ( Group g : groups ) { allRuntimes . addAll ( g . getCoordinateRuntimes ( ) ) ; for ( Coordinate coord : g . getCoordinates ( ) ) { if ( coord instanceof CoordinateTime2D ) { CoordinateTime2D coord2D = ( CoordinateTime2D ) coord ; if ( allTimesAreUnique ) { allTimesAreUnique = coord2D . hasUniqueTimes ( ) ; } } if ( coord instanceof CoordinateTimeAbstract ) { CalendarDateRange calendarDateRange = ( ( CoordinateTimeAbstract ) coord ) . makeCalendarDateRange ( null ) ; if ( calendarDateRangeAll == null ) calendarDateRangeAll = calendarDateRange ; else calendarDateRangeAll = calendarDateRangeAll . extend ( calendarDateRange ) ; } } } List < Long > sortedList = new ArrayList < > ( allRuntimes ) ; Collections . sort ( sortedList ) ; if ( sortedList . size ( ) == 0 ) throw new IllegalArgumentException ( "No runtimes in this collection =" + name ) ; else if ( sortedList . size ( ) == 1 ) this . type = GribCollectionImmutable . Type . SRC ; else if ( allTimesAreUnique ) this . type = GribCollectionImmutable . Type . MRUTC ; else this . type = GribCollectionImmutable . Type . MRC ; CoordinateRuntime masterRuntimes = new CoordinateRuntime ( sortedList , null ) ; MFile indexFileForRuntime = GribCollectionMutable . makeIndexMFile ( this . name , directory ) ; boolean ok = writeIndex ( this . name , indexFileForRuntime . getPath ( ) , masterRuntimes , groups , allFiles , calendarDateRangeAll ) ; /* if ( this . type = = GribCollectionImmutable . Type . MRC ) {
 GribBestDatasetBuilder . makeDatasetBest ( ) ; */
long took = System . currentTimeMillis ( ) - start ; logger . debug ( "That took {} msecs" , took ) ; return ok ;


signature:
public class GribCollectionBuilder { /** * creates seperate collection and index for each runtime . */
private boolean createAllRuntimeCollections ( Formatter errlog ) throws IOException { } }

implementation:
long start = System . currentTimeMillis ( ) ; this . type = GribCollectionImmutable . Type . SRC ; boolean ok = true ; List < MFile > files = new ArrayList < > ( ) ; List < ? extends Group > groups = makeGroups ( files , true , errlog ) ; List < MFile > allFiles = Collections . unmodifiableList ( files ) ; // gather into collections with a single runtime
Map < Long , List < Group > > runGroups = new HashMap < > ( ) ; for ( Group g : groups ) { List < Group > runGroup = runGroups . computeIfAbsent ( g . getRuntime ( ) . getMillis ( ) , k -> new ArrayList < > ( ) ) ; runGroup . add ( g ) ; } // write each rungroup separately
boolean multipleRuntimes = runGroups . values ( ) . size ( ) > 1 ; List < MFile > partitions = new ArrayList < > ( ) ; for ( List < Group > runGroupList : runGroups . values ( ) ) { Group g = runGroupList . get ( 0 ) ; // if multiple Runtimes , we will write a partition . otherwise , we need to use the standard name ( without runtime ) so we know the filename from the collection
String gcname = multipleRuntimes ? GribCollectionMutable . makeName ( this . name , g . getRuntime ( ) ) : this . name ; MFile indexFileForRuntime = GribCollectionMutable . makeIndexMFile ( gcname , directory ) ; // not using disk cache LOOK why ?
partitions . add ( indexFileForRuntime ) ; // create the master runtimes , consisting of the single runtime
List < Long > runtimes = new ArrayList < > ( 1 ) ; runtimes . add ( g . getRuntime ( ) . getMillis ( ) ) ; CoordinateRuntime masterRuntimes = new CoordinateRuntime ( runtimes , null ) ; CalendarDateRange calendarDateRangeAll = null ; for ( Coordinate coord : g . getCoordinates ( ) ) { if ( coord instanceof CoordinateTimeAbstract ) { CalendarDateRange calendarDateRange = ( ( CoordinateTimeAbstract ) coord ) . makeCalendarDateRange ( null ) ; if ( calendarDateRangeAll == null ) calendarDateRangeAll = calendarDateRange ; else calendarDateRangeAll = calendarDateRangeAll . extend ( calendarDateRange ) ; } } assert calendarDateRangeAll != null ; // for each Group write an index file
ok &= writeIndex ( gcname , indexFileForRuntime . getPath ( ) , masterRuntimes , runGroupList , allFiles , calendarDateRangeAll ) ; logger . info ( "GribCollectionBuilder write {} ok={}" , indexFileForRuntime . getPath ( ) , ok ) ; } // if theres more than one runtime , create a partition collection to collect all the runtimes together
if ( multipleRuntimes ) { Collections . sort ( partitions ) ; PartitionManager part = new PartitionManagerFromIndexList ( dcm , partitions , logger ) ; part . putAuxInfo ( FeatureCollectionConfig . AUX_CONFIG , dcm . getAuxInfo ( FeatureCollectionConfig . AUX_CONFIG ) ) ; ok &= GribCdmIndex . updateGribCollectionFromPCollection ( isGrib1 , part , CollectionUpdateType . always , errlog , logger ) ; } long took = System . currentTimeMillis ( ) - start ; logger . debug ( "That took {} msecs" , took ) ; return ok ;


signature:
public class DurationField { /** * See if edit value is valid , put error message in buff . */
protected boolean _validate ( StringBuffer buff ) { } }

implementation:
String editValue = tf . getText ( ) . trim ( ) ; if ( editValue . length ( ) == 0 ) return true ; // empty ok
try { new TimeDuration ( tf . getText ( ) ) ; return true ; } catch ( java . text . ParseException e ) { buff . append ( label ) . append ( ": " ) . append ( e . getMessage ( ) ) ; return false ; }


signature:
public class DurationField { /** * get current value from editComponent */
protected Object getEditValue ( ) { } }

implementation:
String editValue = tf . getText ( ) . trim ( ) ; if ( editValue . length ( ) == 0 ) return null ; // empty ok
try { return new TimeDuration ( editValue ) ; } catch ( java . text . ParseException e ) { return null ; }


signature:
public class DurationField { /** * set current value of editComponent */
protected void setEditValue ( Object value ) { } }

implementation: if ( value == null ) tf . setText ( "" ) ; else tf . setText ( value . toString ( ) ) ; // tf . repaint ( ) ;


signature:
public class Doradeheader { /** * Return the string of entity ID for the Dorade image file */
DataType getDataType ( int format ) { } }

implementation:
DataType p ; switch ( format ) { case 1 : // 8 - bit signed integer format .
p = DataType . SHORT ; break ; case 2 : // 16 - bit signed integer format .
p = DataType . FLOAT ; break ; case 3 : // 32 - bit signed integer format .
p = DataType . LONG ; break ; case 4 : // 32 - bit IEEE float format .
p = DataType . FLOAT ; break ; case 5 : // 16 - bit IEEE float format .
p = DataType . DOUBLE ; break ; default : p = null ; break ; } // end of switch
return p ;


signature:
public class Cosmic1Convention { /** * _ more _
 * @ param ds _ more _
 * @ param cancelTask _ more _
 * @ throws IOException _ more _ */
public void augmentDataset ( NetcdfDataset ds , CancelTask cancelTask ) throws IOException { } }

implementation:
Attribute leoAtt = ds . findGlobalAttribute ( "leoId" ) ; if ( leoAtt == null ) { if ( ds . findVariable ( "time" ) == null ) { // create a time variable - assume its linear along the vertical dimension
double start = ds . readAttributeDouble ( null , "start_time" , Double . NaN ) ; double stop = ds . readAttributeDouble ( null , "stop_time" , Double . NaN ) ; if ( Double . isNaN ( start ) && Double . isNaN ( stop ) ) { double top = ds . readAttributeDouble ( null , "toptime" , Double . NaN ) ; double bot = ds . readAttributeDouble ( null , "bottime" , Double . NaN ) ; this . conventionName = "Cosmic2" ; if ( top > bot ) { stop = top ; start = bot ; } else { stop = bot ; start = top ; } } Dimension dim = ds . findDimension ( "MSL_alt" ) ; Variable dimV = ds . findVariable ( "MSL_alt" ) ; Array dimU = dimV . read ( ) ; int inscr = ( dimU . getFloat ( 1 ) - dimU . getFloat ( 0 ) ) > 0 ? 1 : 0 ; int n = dim . getLength ( ) ; double incr = ( stop - start ) / n ; String timeUnits = "seconds since 1980-01-06 00:00:00" ; Variable timeVar = new VariableDS ( ds , null , null , "time" , DataType . DOUBLE , dim . getShortName ( ) , timeUnits , null ) ; ds . addVariable ( null , timeVar ) ; timeVar . addAttribute ( new Attribute ( CDM . UNITS , timeUnits ) ) ; timeVar . addAttribute ( new Attribute ( _Coordinate . AxisType , AxisType . Time . toString ( ) ) ) ; int dir = ds . readAttributeInteger ( null , "irs" , 1 ) ; ArrayDouble . D1 data = ( ArrayDouble . D1 ) Array . factory ( DataType . DOUBLE , new int [ ] { n } ) ; if ( inscr == 0 ) { if ( dir == 1 ) { for ( int i = 0 ; i < n ; i ++ ) { data . set ( i , start + i * incr ) ; } } else { for ( int i = 0 ; i < n ; i ++ ) { data . set ( i , stop - i * incr ) ; } } } else { for ( int i = 0 ; i < n ; i ++ ) { data . set ( i , stop - i * incr ) ; } } timeVar . setCachedData ( data , false ) ; } Variable v = ds . findVariable ( "Lat" ) ; if ( v == null ) { v = ds . findVariable ( "GEO_lat" ) ; } v . addAttribute ( new Attribute ( _Coordinate . AxisType , AxisType . Lat . toString ( ) ) ) ; Variable v1 = ds . findVariable ( "Lon" ) ; if ( v1 == null ) { v1 = ds . findVariable ( "GEO_lon" ) ; } v1 . addAttribute ( new Attribute ( _Coordinate . AxisType , AxisType . Lon . toString ( ) ) ) ; } else { Dimension dim = ds . findDimension ( "time" ) ; int n = dim . getLength ( ) ; Variable latVar = new VariableDS ( ds , null , null , "Lat" , DataType . FLOAT , dim . getShortName ( ) , "degree" , null ) ; latVar . addAttribute ( new Attribute ( _Coordinate . AxisType , AxisType . Lat . toString ( ) ) ) ; ds . addVariable ( null , latVar ) ; Variable lonVar = new VariableDS ( ds , null , null , "Lon" , DataType . FLOAT , dim . getShortName ( ) , "degree" , null ) ; lonVar . addAttribute ( new Attribute ( _Coordinate . AxisType , AxisType . Lon . toString ( ) ) ) ; ds . addVariable ( null , lonVar ) ; Variable altVar = new VariableDS ( ds , null , null , "MSL_alt" , DataType . FLOAT , dim . getShortName ( ) , "meter" , null ) ; altVar . addAttribute ( new Attribute ( _Coordinate . AxisType , AxisType . Height . toString ( ) ) ) ; ds . addVariable ( null , altVar ) ; // cal data array
ArrayFloat . D1 latData = ( ArrayFloat . D1 ) Array . factory ( DataType . FLOAT , new int [ ] { n } ) ; ArrayFloat . D1 lonData = ( ArrayFloat . D1 ) Array . factory ( DataType . FLOAT , new int [ ] { n } ) ; ArrayFloat . D1 altData = ( ArrayFloat . D1 ) Array . factory ( DataType . FLOAT , new int [ ] { n } ) ; ArrayDouble . D1 timeData = ( ArrayDouble . D1 ) Array . factory ( DataType . DOUBLE , new int [ ] { n } ) ; this . conventionName = "Cosmic3" ; int iyr = ds . readAttributeInteger ( null , "year" , 2009 ) ; int mon = ds . readAttributeInteger ( null , "month" , 0 ) ; int iday = ds . readAttributeInteger ( null , "day" , 0 ) ; int ihr = ds . readAttributeInteger ( null , "hour" , 0 ) ; int min = ds . readAttributeInteger ( null , "minute" , 0 ) ; int sec = ds . readAttributeInteger ( null , "second" , 0 ) ; double start = ds . readAttributeDouble ( null , "startTime" , Double . NaN ) ; double stop = ds . readAttributeDouble ( null , "stopTime" , Double . NaN ) ; double incr = ( stop - start ) / n ; int t = 0 ; // double julian = juday ( mon , iday , iyr ) ;
// cal the dtheta based pm attributes
double dtheta = gast ( iyr , mon , iday , ihr , min , sec , t ) ; Variable tVar = ds . findVariable ( "time" ) ; String timeUnits = "seconds since 1980-01-06 00:00:00" ; // dtime . getUnit ( ) . toString ( ) ;
tVar . removeAttributeIgnoreCase ( CDM . VALID_RANGE ) ; tVar . removeAttributeIgnoreCase ( CDM . UNITS ) ; tVar . addAttribute ( new Attribute ( CDM . UNITS , timeUnits ) ) ; tVar . addAttribute ( new Attribute ( _Coordinate . AxisType , AxisType . Time . toString ( ) ) ) ; Variable v = ds . findVariable ( "xLeo" ) ; Array xLeo = v . read ( ) ; v = ds . findVariable ( "yLeo" ) ; Array yLeo = v . read ( ) ; v = ds . findVariable ( "zLeo" ) ; Array zLeo = v . read ( ) ; double a = 6378.1370 ; double b = 6356.7523142 ; IndexIterator iiter0 = xLeo . getIndexIterator ( ) ; IndexIterator iiter1 = yLeo . getIndexIterator ( ) ; IndexIterator iiter2 = zLeo . getIndexIterator ( ) ; int i = 0 ; while ( iiter0 . hasNext ( ) ) { double [ ] v_inertial = new double [ 3 ] ; v_inertial [ 0 ] = iiter0 . getDoubleNext ( ) ; // . getDouble ( i ) ; / / . nextDouble ( ) ;
v_inertial [ 1 ] = iiter1 . getDoubleNext ( ) ; // . getDouble ( i ) ; / / . nextDouble ( ) ;
v_inertial [ 2 ] = iiter2 . getDoubleNext ( ) ; // . getDouble ( i ) ; / / . nextDouble ( ) ;
double [ ] uvz = new double [ 3 ] ; uvz [ 0 ] = 0.0 ; uvz [ 1 ] = 0.0 ; uvz [ 2 ] = 1.0 ; // v _ ecef should be in the ( approximate ) ECEF frame
// double [ ] v _ ecf = execute ( v _ inertial , julian ) ;
double [ ] v_ecf = spin ( v_inertial , uvz , - 1 * dtheta ) ; // cal lat / lon here
// double [ ] llh = ECFtoLLA ( v _ ecf [ 0 ] * 1000 , v _ ecf [ 1 ] * 1000 , v _ ecf [ 2 ] * 1000 , a , b ) ;
double [ ] llh = xyzell ( a , b , v_ecf ) ; latData . set ( i , ( float ) llh [ 0 ] ) ; lonData . set ( i , ( float ) llh [ 1 ] ) ; altData . set ( i , ( float ) llh [ 2 ] ) ; timeData . set ( i , start + i * incr ) ; i ++ ; } latVar . setCachedData ( latData , false ) ; lonVar . setCachedData ( lonData , false ) ; altVar . setCachedData ( altData , false ) ; tVar . setCachedData ( timeData , false ) ; } ds . finish ( ) ;


signature:
public class Cosmic1Convention { /** * NAME : XYZELL
 * CALL XYZELL ( A , B , XSTAT , XSTELL )
 * PURPOSE : COMPUTATION OF ELLIPSOIDAL COORDINATES " XSTELL "
 * GIVEN THE CARTESIAN COORDINATES " XSTAT "
 * PARAMETERS :
 * IN : A : SEMI - MAJOR AXIS OF THE REFERENCE R * 8
 * ELLIPSOID IN METERS
 * B : SEMI - MINOR AXIS OF THE REFERENCE R * 8
 * ELLIPSOID IN METERS
 * DXELL ( 3 ) : TRANSLATION COMPONENTS FROM THE R * 8
 * ORIGIN OF THE CART . COORD . SYSTEM
 * ( X , Y , Z ) TO THE CENTER OF THE REF .
 * ELLIPSOID ( IN METRES )
 * SCELL : SCALE FACTOR BETWEEN REF . ELLIPSOID R * 8
 * AND WGS - 84
 * XSTAT ( 3 ) : CARTESIAN COORDINATES ( M ) R * 8
 * OUT : XSTELL ( 3 ) : ELLIPSOIDAL COORDINATES R * 8
 * XSTELL ( 1 ) : ELL . LATITUDE ( RADIAN )
 * XSTELL ( 2 ) : ELL . LONGITUDE ( RADIAN )
 * XSTELL ( 3 ) : ELL . HEIGHT ( M )
 * SR CALLED : DMLMTV
 * REMARKS : - - -
 * AUTHOR : M . ROTHACHER
 * VERSION : 3.4 ( JAN 93)
 * CREATED : 87/11/03 12:32 LAST MODIFIED : 88/11/21 17:36
 * COPYRIGHT : ASTRONOMICAL INSTITUTE
 * 1987 UNIVERSITY OF BERNE
 * SWITZERLAND
 * @ param a _ more _
 * @ param b _ more _
 * @ param xstat _ more _
 * @ return _ more _ */
public double [ ] xyzell ( double a , double b , double [ ] xstat ) { } }

implementation: double [ ] xstell = new double [ 3 ] ; double e2 , s , rlam , zps , h , phi , n , hp , phip ; int i , niter ; e2 = ( a * a - b * b ) / ( a * a ) ; s = Math . sqrt ( xstat [ 0 ] * xstat [ 0 ] + xstat [ 1 ] * xstat [ 1 ] ) ; rlam = Math . atan2 ( xstat [ 1 ] , xstat [ 0 ] ) ; zps = xstat [ 2 ] / s ; h = Math . sqrt ( xstat [ 0 ] * xstat [ 0 ] + xstat [ 1 ] * xstat [ 1 ] + xstat [ 2 ] * xstat [ 2 ] ) - a ; phi = Math . atan ( zps / ( 1.0 - e2 * a / ( a + h ) ) ) ; niter = 0 ; for ( i = 1 ; i <= 10000000 ; i ++ ) { n = a / Math . sqrt ( 1.0 - e2 * Math . sin ( phi ) * Math . sin ( phi ) ) ; hp = h ; phip = phi ; h = s / Math . cos ( phi ) - n ; phi = Math . atan ( zps / ( 1.0 - e2 * n / ( n + h ) ) ) ; niter = niter + 1 ; if ( ( Math . abs ( phip - phi ) <= 1.e-11 ) && ( Math . abs ( hp - h ) <= 1.e-5 ) ) { break ; } if ( niter >= 10 ) { phi = - 999.0 ; rlam = - 999.0 ; h = - 999.0 ; break ; } } xstell [ 0 ] = phi * 180 / 3.1415926 ; xstell [ 1 ] = rlam * 180 / 3.1415926 ; xstell [ 2 ] = h ; return xstell ;


signature:
public class Cosmic1Convention { /** * gast . f
 * This subroutine computes the Greenwich Apparent Siderial
 * Time angle given a UTC date and time .
 * parameter Input parameters :
 * Inputs :
 * @ param iyr integer year 1995
 * @ param imon integer month 5
 * @ param iday integer day 5
 * @ param ihr integer hour 5
 * @ param imin integer minute 5
 * @ param sec double second 31.0
 * @ param dsec double second 0.0
 * Outputs :
 * @ return theta GAST angle in radians
 * author Bill Schreiner
 * @ since May 1995
 * version $ URL : svn : / / ursa . cosmic . ucar . edu / trunk / src / roam / gast . f $ $ Id : gast . f 10129 2008-07-30 17:10:52Z dhunt $ */
public double gast ( int iyr , int imon , int iday , int ihr , int imin , double sec , double dsec ) { } }

implementation:
// implicit double precision ( a - h , o - z )
// character ( len = * ) , parameter : : header = ' $ URL : svn : / / ursa . cosmic . ucar . edu / trunk / src / roam / gast . f $ $ Id : gast . f 10129 2008-07-30 17:10:52Z dhunt $ '
// Coordinate transform from the celestial inertial reference frame to the geo -
// centered Greenwich reference frame .
// Call a subroutine to calculate the Julian day " djd " :
double djd = juday ( imon , iday , iyr ) ; // djd = julean day .
double tu = ( djd - 2451545.0 ) / 36525.0 ; double gmst = 24110.548410 + 8640184.8128660 * tu + 0.093104 * tu * tu - 6.2E-6 * Math . pow ( tu , 3 ) ; // ! gmst = Greenwich mean . . .
double utco = ( ihr * 3600 ) + ( imin * 60 ) + sec ; return togreenw ( dsec , utco , gmst ) ;


signature:
public class Cosmic1Convention { /** * JDAY calculates the Julian Day number ( JD ) from the Gregorian month
 * , day , and year ( M , D , Y ) . ( NOT VALID BEFORE 10/15/1582)
 * @ param M _ more _
 * @ param D _ more _
 * @ param Y _ more _
 * @ return _ more _ */
public double juday ( int M , int D , int Y ) { } }


signature:
public class Cosmic1Convention { /** * This subroutine is to transform the locations and velocities of the GPS and
 * LEO satellites from the celestial inertial reference frame to the Earth
 * centered Greenwich reference frame .
 * The dummy arguments iyear , month and iday are the calender year , month and
 * day of the occultation event . The dummy arguments ihour , minute and sec
 * are the UTC time .
 * Reference : Astronomical Alamanus , 1993
 * Modified subroutine from Dasheng ' s code .
 * @ param rectt _ more _
 * @ param utco _ more _
 * @ param gmst _ more _
 * @ return _ more _ */
public double togreenw ( double rectt , double utco , double gmst ) { } }

implementation:
double pi = Math . acos ( - 1.00 ) ; // For each occultation ID , its TU and GMST are the same . However , every
// occultation event takes place at gmst + uts , uts is progressively increasing
// with every occultation event .
double utc = ( utco + rectt ) * 1.0027379093 ; gmst = gmst + utc ; // in seconds , without eoe correction .
// gmst may be a positive number or may be a negative number .
while ( gmst < 0.0 ) { gmst = gmst + 86400.00 ; } while ( gmst > 86400.00 ) { gmst = gmst - 86400.00 ; } // gmst = the Greenwich mean sidereal time .
// This gmst is without the corrections from the equation of equinoxes . For
// GPS / MET applications , the corrections from equation of equinoxes is not
// necessary because of the accurary needed .
return gmst * 2.0 * pi / 86400.0 ; // ! * * * This is the THETA in radian .


signature:
public class Cosmic1Convention { /** * file spin . f
 * This subroutine rotates vector V1 around vector VS
 * at angle A . V2 is the vector after the rotation .
 * parameter Input parameters :
 * v1 - Vector to be rotated
 * vs - Vector around which to rotate v1
 * a - angle of rotation
 * Output parameters :
 * v2 - output vector
 * S . V . Sokolovskiy
 * URL : svn : / / ursa . cosmic . ucar . edu / trunk / src / roam / spin . f $ $ Id : spin . f 10129 2008-07-30 17:10:52Z dhunt $
 * @ param v1 - Vector to be rotated
 * @ param vs - Vector around which to rotate v1
 * @ param a - angle of rotation
 * @ return _ more _ */
public double [ ] spin ( double [ ] v1 , double [ ] vs , double a ) { } }

implementation:
// implicit real * 8 ( a - h , o - z )
// dimension v1(3 ) , vs ( 3 ) , vsn ( 3 ) , v2(3 ) , v3(3 ) , s ( 3,3)
// Calculation of the unit vector around which
// the rotation should be done .
double [ ] v2 = new double [ 3 ] ; double [ ] vsn = new double [ 3 ] ; double [ ] v3 = new double [ 3 ] ; double vsabs = Math . sqrt ( vs [ 0 ] * vs [ 0 ] + vs [ 1 ] * vs [ 1 ] + vs [ 2 ] * vs [ 2 ] ) ; for ( int i = 0 ; i < 3 ; i ++ ) { vsn [ i ] = vs [ i ] / vsabs ; } // Calculation of the rotation matrix .
double a1 = Math . cos ( a ) ; double a2 = 1.0 - a1 ; double a3 = Math . sin ( a ) ; double [ ] [ ] s = new double [ 3 ] [ 3 ] ; s [ 0 ] [ 0 ] = a2 * vsn [ 0 ] * vsn [ 0 ] + a1 ; s [ 0 ] [ 1 ] = a2 * vsn [ 0 ] * vsn [ 1 ] - a3 * vsn [ 2 ] ; s [ 0 ] [ 2 ] = a2 * vsn [ 0 ] * vsn [ 2 ] + a3 * vsn [ 1 ] ; s [ 1 ] [ 0 ] = a2 * vsn [ 1 ] * vsn [ 0 ] + a3 * vsn [ 2 ] ; s [ 1 ] [ 1 ] = a2 * vsn [ 1 ] * vsn [ 1 ] + a1 ; s [ 1 ] [ 2 ] = a2 * vsn [ 1 ] * vsn [ 2 ] - a3 * vsn [ 0 ] ; s [ 2 ] [ 0 ] = a2 * vsn [ 2 ] * vsn [ 0 ] - a3 * vsn [ 1 ] ; s [ 2 ] [ 1 ] = a2 * vsn [ 2 ] * vsn [ 1 ] + a3 * vsn [ 0 ] ; s [ 2 ] [ 2 ] = a2 * vsn [ 2 ] * vsn [ 2 ] + a1 ; // Calculation of the rotated vector .
for ( int i = 0 ; i < 3 ; i ++ ) { v3 [ i ] = s [ i ] [ 0 ] * v1 [ 0 ] + s [ i ] [ 1 ] * v1 [ 1 ] + s [ i ] [ 2 ] * v1 [ 2 ] ; } System . arraycopy ( v3 , 0 , v2 , 0 , 3 ) ; return v2 ;


signature:
public class Cosmic1Convention { /** * _ more _
 * @ param eci _ more _
 * @ param julian _ more _
 * @ return _ more _ */
public double [ ] execute ( double [ ] eci , double julian ) { } }

implementation:
double Xi = eci [ 0 ] ; double Yi = eci [ 1 ] ; double Zi = eci [ 2 ] ; double c , s ; double GHA ; double [ ] ecef = new double [ 3 ] ; // Compute GHAD
/* System generated locals */
double d__1 , d__2 , d__3 ; /* Local variables */
double tsec , tday , gmst , t , omega , tfrac , tu , dat ; /* INPUT IS TIME " secondsSince1970 " IN SECONDS AND " TDAY " */
/* WHICH IS WHOLE DAYS FROM 1970 JAN 1 0H */
/* THE OUTPUT IS GREENWICH HOUR ANGLE IN DEGREES */
/* XOMEGA IS ROTATION RATE IN DEGREES / SEC */
/* FOR COMPATABILITY */
tday = ( double ) ( ( int ) ( julian / 86400. ) ) ; tsec = julian - tday * 86400 ; /* THE NUMBER OF DAYS FROM THE J2000 EPOCH */
/* TO 1970 JAN 1 0H UT1 IS - 10957.5 */
t = tday - ( float ) 10957.5 ; tfrac = tsec / 86400. ; dat = t ; tu = dat / 36525. ; /* Computing 2nd power */
d__1 = tu ; /* Computing 3rd power */
d__2 = tu ; d__3 = d__2 ; gmst = tu * 8640184.812866 + 24110.54841 + d__1 * d__1 * .093104 - d__3 * ( d__2 * d__2 ) * 6.2e-6 ; /* COMPUTE THE EARTH ' S ROTATION RATE */
/* Computing 2nd power */
d__1 = tu ; omega = tu * 5.098097e-6 + 86636.55536790872 - d__1 * d__1 * 5.09e-10 ; /* COMPUTE THE GMST AND GHA */
// da is earth nutation - currently unused
double da = 0.0 ; gmst = gmst + omega * tfrac + da * RTD * 86400. / 360. ; gmst = gmst % 86400 ; if ( gmst < 0. ) { gmst += 86400. ; } gmst = gmst / 86400. * 360. ; // ghan = gmst ;
// returns gha in radians
gmst = gmst * DTR ; GHA = gmst ; // RotateZ
c = Math . cos ( GHA ) ; s = Math . sin ( GHA ) ; double X = c * Xi + s * Yi ; double Y = - s * Xi + c * Yi ; // Set outputs
ecef [ 0 ] = X ; ecef [ 1 ] = Y ; ecef [ 2 ] = Zi ; return ecef ;


signature:
public class Cosmic1Convention { /** * comparing api to others
 * @ param x _ more _
 * @ param y _ more _
 * @ param z _ more _
 * @ param a _ more _
 * @ param b _ more _
 * @ return _ more _ */
public static double [ ] ECFtoLLA ( double x , double y , double z , double a , double b ) { } }

implementation:
double longitude = Math . atan2 ( y , x ) ; double ePrimeSquared = ( a * a - b * b ) / ( b * b ) ; double p = Math . sqrt ( x * x + y * y ) ; double theta = Math . atan ( ( z * a ) / ( p * b ) ) ; double sineTheta = Math . sin ( theta ) ; double cosTheta = Math . cos ( theta ) ; double f = 1 / 298.257223563 ; double e2 = 2 * f - f * f ; double top = z + ePrimeSquared * b * sineTheta * sineTheta * sineTheta ; double bottom = p - e2 * a * cosTheta * cosTheta * cosTheta ; double geodeticLat = Math . atan ( top / bottom ) ; double sineLat = Math . sin ( geodeticLat ) ; double N = a / Math . sqrt ( 1 - e2 * sineLat * sineLat ) ; double altitude = ( p / Math . cos ( geodeticLat ) ) - N ; // maintain longitude btw - PI and PI
if ( longitude > Math . PI ) { longitude -= 2 * Math . PI ; } else if ( longitude < - Math . PI ) { longitude += 2 * Math . PI ; } return new double [ ] { geodeticLat , longitude , altitude } ;


signature:
public class WorldMap { /** * read in lat / lon points one time for this class */
private static boolean readWorldMap ( ) { } }

implementation:
java . io . DataInputStream dis ; String filename = "/resources/nj22/ui/maps/cil_100km.mapr" ; java . io . InputStream is = null ; long secs = System . currentTimeMillis ( ) ; is = Resource . getFileResource ( filename ) ; if ( is == null ) { System . err . println ( "WorldMap read failed on resource " + filename ) ; return false ; } else { dis = new java . io . DataInputStream ( is ) ; } // need an AbstractGisFeature for visad
worldMapFeature = new WorldMapFeature ( ) ; // need an ArrayList of AbstractGisFeature ' s for GisFeatureRenderer
gisList = new ArrayList ( ) ; gisList . add ( worldMapFeature ) ; partList = new ArrayList ( ) ; while ( true ) { try { int npts = dis . readInt ( ) ; dis . readInt ( ) ; // minx - - not used .
dis . readInt ( ) ; // maxx - - not used .
dis . readInt ( ) ; // miny - - not used .
dis . readInt ( ) ; // maxy - - not used .
MapRun run = new MapRun ( npts ) ; for ( int i = 0 ; i < npts ; i ++ ) { run . wx [ i ] = ( ( double ) dis . readInt ( ) ) / SECS_PER_DEG ; run . wy [ i ] = ( ( double ) dis . readInt ( ) ) / SECS_PER_DEG ; } partList . add ( run ) ; total_pts += npts ; } catch ( EOFException ex ) { break ; } catch ( Exception ex ) { System . err . println ( "WorldMap exception " + ex ) ; break ; } } try { is . close ( ) ; } catch ( Exception ex ) { } if ( debugTime ) { secs = System . currentTimeMillis ( ) - secs ; System . out . println ( "WorldMap read file: " + secs * .001 + " seconds" ) ; } return true ;


signature:
public class Util { /** * Clean up strings to be used for unit string
 * @ param unit original
 * @ return cleaned up */
public static String cleanUnit ( String unit ) { } }

implementation:
if ( unit == null ) return null ; // These specific words become dimensionless
if ( unit . equalsIgnoreCase ( "Proportion" ) || unit . equalsIgnoreCase ( "Numeric" ) ) unit = "" ; // So does ' - '
else if ( unit . equalsIgnoreCase ( "-" ) ) { unit = "" ; // Make sure degree ( s ) true gets concatenated with ' _ '
} else if ( unit . startsWith ( "degree" ) && unit . endsWith ( "true" ) ) { unit = unit . replace ( ' ' , '_' ) ; // And only do the rest of the conversion if it ' s not a " * table * " entry
} else if ( ! unit . contains ( " table " ) ) { if ( unit . startsWith ( "/" ) ) unit = "1" + unit ; unit = unit . trim ( ) ; unit = StringUtil2 . remove ( unit , "**" ) ; StringBuilder sb = new StringBuilder ( unit ) ; StringUtil2 . remove ( sb , "^[]" ) ; StringUtil2 . replace ( sb , ' ' , "." ) ; StringUtil2 . replace ( sb , '*' , "." ) ; unit = sb . toString ( ) ; } return unit ;


signature:
public class Util { /** * Clean up strings to be used in Netcdf Object names
 * @ param name original name
 * @ return cleaned up name */
public static String cleanName ( String name ) { } }

implementation: if ( name == null ) return null ; int pos = name . indexOf ( "(see" ) ; if ( pos < 0 ) pos = name . indexOf ( "(See" ) ; if ( pos > 0 ) name = name . substring ( 0 , pos ) ; name = StringUtil2 . replace ( name , '/' , "-" ) ; StringBuilder sb = new StringBuilder ( name ) ; StringUtil2 . replace ( sb , '+' , "plus" ) ; StringUtil2 . remove ( sb , ".;,=[]()/*\"" ) ; return StringUtil2 . collapseWhitespace ( sb . toString ( ) . trim ( ) ) ;


signature:
public class Util { /** * Compare two names from tables , trying to ignore superfulous characters .
 * @ return true if these are equivilent */
public static boolean equivilantName ( String name1 , String name2 ) { } }

implementation: if ( name1 == null || name2 == null ) return ( name1 == name2 ) ; String name1clean = cleanName ( name1 ) . toLowerCase ( ) ; String name2clean = cleanName ( name2 ) . toLowerCase ( ) ; if ( name1 . equals ( name2 ) ) return true ; StringBuilder sb1 = new StringBuilder ( name1clean ) ; StringUtil2 . remove ( sb1 , " -’'" ) ; StringBuilder sb2 = new StringBuilder ( name2clean ) ; StringUtil2 . remove ( sb2 , " -’'" ) ; return sb1 . toString ( ) . equals ( sb2 . toString ( ) ) ;


signature:
public class Util { /** * The given unit is " unitless " . */
public static boolean isUnitless ( String unit ) { } }

implementation: if ( unit == null ) return true ; String munge = unit . toLowerCase ( ) . trim ( ) ; munge = StringUtil2 . remove ( munge , '(' ) ; return munge . length ( ) == 0 || munge . startsWith ( "numeric" ) || munge . startsWith ( "non-dim" ) || munge . startsWith ( "see" ) || munge . startsWith ( "proportion" ) || munge . startsWith ( "code" ) || munge . startsWith ( "0=" ) || munge . equals ( "1" ) ;


signature:
public class HtmlConfigBean { /** * Return a URL ready to use in a generated HTML page from a URL that
 * is either absolute or relative to the webapp context path . That is ,
 * if relative , it is relative to " http : / / server : port / thredds / " .
 * < p > For simplicity , all relative URLs are converted to URLs that are
 * absolute paths . For instance , " catalog . xml " becomes " / thredds / catalog . xml " .
 * @ param url the URL to prepare for use in HTML .
 * @ return a URL ready to use in a generated HTML page . */
public String prepareUrlStringForHtml ( String url ) { } }

implementation: if ( url == null ) return null ; URI uri ; try { uri = new URI ( url ) ; } catch ( URISyntaxException e ) { throw new IllegalArgumentException ( "Given a bad URL [" + url + "]." , e ) ; } if ( uri . isAbsolute ( ) ) return uri . toString ( ) ; if ( url . startsWith ( "/" ) ) return url ; return this . getWebappContextPath ( ) + "/" + url ;


signature:
public class FeatureCollectionReader { /** * input is xml file with just the < featureCollection > */
static public FeatureCollectionConfig getConfigFromSnippet ( String filename ) { } }

implementation: org . jdom2 . Document doc ; try { SAXBuilder builder = new SAXBuilder ( ) ; doc = builder . build ( filename ) ; } catch ( Exception e ) { System . out . printf ( "Error parsing featureCollection %s err = %s" , filename , e . getMessage ( ) ) ; return null ; } return FeatureCollectionReader . readFeatureCollection ( doc . getRootElement ( ) ) ;


signature:
public class AbstractGisFeature { /** * Convert this GisFeature to a java . awt . Shape , using the default
 * coordinate system , mapping gisFeature ( x , y ) - > screen ( x , y ) .
 * LOOK STILL HAVE TO crossSeam ( )
 * @ return shape corresponding to this feature . */
public Shape getShape ( ) { } }

implementation: int npts = getNumPoints ( ) ; GeneralPath path = new GeneralPath ( GeneralPath . WIND_EVEN_ODD , npts ) ; java . util . Iterator pi = getGisParts ( ) ; while ( pi . hasNext ( ) ) { GisPart gp = ( GisPart ) pi . next ( ) ; double [ ] xx = gp . getX ( ) ; double [ ] yy = gp . getY ( ) ; int np = gp . getNumPoints ( ) ; if ( np > 0 ) path . moveTo ( ( float ) xx [ 0 ] , ( float ) yy [ 0 ] ) ; for ( int i = 1 ; i < np ; i ++ ) { path . lineTo ( ( float ) xx [ i ] , ( float ) yy [ i ] ) ; } } return path ;


signature:
public class AbstractGisFeature { /** * Convert this GisFeature to a java . awt . Shape . The data coordinate system
 * is assumed to be ( lat , lon ) , use the projection to transform points , so
 * project . latLonToProj ( gisFeature ( x , y ) ) - > screen ( x , y ) .
 * @ param displayProject Projection to use to display
 * @ return shape corresponding to this feature */
public Shape getProjectedShape ( ProjectionImpl displayProject ) { } }

implementation:
LatLonPointImpl workL = new LatLonPointImpl ( ) ; ProjectionPointImpl lastW = new ProjectionPointImpl ( ) ; GeneralPath path = new GeneralPath ( GeneralPath . WIND_EVEN_ODD , getNumPoints ( ) ) ; boolean showPts = ucar . util . prefs . ui . Debug . isSet ( "projection/showPoints" ) ; java . util . Iterator pi = getGisParts ( ) ; while ( pi . hasNext ( ) ) { GisPart gp = ( GisPart ) pi . next ( ) ; double [ ] xx = gp . getX ( ) ; double [ ] yy = gp . getY ( ) ; boolean skipPrev = false ; int count = 0 ; for ( int i = 0 ; i < gp . getNumPoints ( ) ; i ++ ) { workL . set ( yy [ i ] , xx [ i ] ) ; ProjectionPoint pt = displayProject . latLonToProj ( workL ) ; if ( showPts ) { System . out . println ( "AbstractGisFeature getProjectedShape 1 " + xx [ i ] + " " + yy [ i ] + " === " + pt . getX ( ) + " " + pt . getY ( ) ) ; if ( displayProject . crossSeam ( pt , lastW ) ) System . out . println ( "***cross seam" ) ; } // deal with possible NaNs
if ( Double . isNaN ( pt . getX ( ) ) || Double . isNaN ( pt . getY ( ) ) ) { skipPrev = true ; continue ; } if ( ( count == 0 ) || skipPrev || displayProject . crossSeam ( pt , lastW ) ) path . moveTo ( ( float ) pt . getX ( ) , ( float ) pt . getY ( ) ) ; else path . lineTo ( ( float ) pt . getX ( ) , ( float ) pt . getY ( ) ) ; count ++ ; skipPrev = false ; lastW . setLocation ( pt ) ; } } return path ;


signature:
public class AbstractGisFeature { /** * Convert this GisFeature to a java . awt . Shape . The data coordinate system
 * is in the coordinates of dataProject , and the screen is in the coordinates of
 * displayProject . So :
 * displayProject . latLonToProj ( dataProject . projToLatLon ( gisFeature ( x , y ) ) ) - > screen ( x , y ) .
 * @ param dataProject data Projection to use .
 * @ param displayProject display Projection to use .
 * @ return shape corresponding to this feature */
public Shape getProjectedShape ( ProjectionImpl dataProject , ProjectionImpl displayProject ) { } }

implementation:
ProjectionPointImpl pt1 = new ProjectionPointImpl ( ) ; ProjectionPointImpl lastW = new ProjectionPointImpl ( ) ; GeneralPath path = new GeneralPath ( GeneralPath . WIND_EVEN_ODD , getNumPoints ( ) ) ; boolean showPts = ucar . util . prefs . ui . Debug . isSet ( "projection/showPoints" ) ; java . util . Iterator pi = getGisParts ( ) ; while ( pi . hasNext ( ) ) { GisPart gp = ( GisPart ) pi . next ( ) ; double [ ] xx = gp . getX ( ) ; double [ ] yy = gp . getY ( ) ; boolean skipPrev = false ; int count = 0 ; for ( int i = 0 ; i < gp . getNumPoints ( ) ; i ++ ) { pt1 . setLocation ( xx [ i ] , yy [ i ] ) ; LatLonPoint llpt = dataProject . projToLatLon ( pt1 ) ; ProjectionPoint pt2 = displayProject . latLonToProj ( llpt ) ; if ( showPts ) { System . out . println ( "AbstractGisFeature getProjectedShape 2 " + xx [ i ] + " " + yy [ i ] + " === " + pt2 . getX ( ) + " " + pt2 . getY ( ) ) ; if ( displayProject . crossSeam ( pt2 , lastW ) ) System . out . println ( "***cross seam" ) ; } // deal with possible NaNs
if ( Double . isNaN ( pt2 . getX ( ) ) || Double . isNaN ( pt2 . getY ( ) ) ) { skipPrev = true ; continue ; } if ( ( count == 0 ) || skipPrev || displayProject . crossSeam ( pt2 , lastW ) ) path . moveTo ( ( float ) pt2 . getX ( ) , ( float ) pt2 . getY ( ) ) ; else path . lineTo ( ( float ) pt2 . getX ( ) , ( float ) pt2 . getY ( ) ) ; count ++ ; skipPrev = false ; lastW . setLocation ( pt2 ) ; } } return path ;


signature:
public class MrmsLocalTables { /** * taken from http : / / www . nssl . noaa . gov / projects / mrms / operational / tables . php */
private void init ( ) { } }

implementation: add ( 209 , 2 , 0 , "LightningDensityNLDN1min" , "CG Lightning Density 1-min - NLDN" , "flashes/km^2/min" , - 3 , - 1 ) ; add ( 209 , 2 , 1 , "LightningDensityNLDN5min" , "CG Lightning Density 5-min - NLDN" , "flashes/km^2/min" , - 3 , - 1 ) ; add ( 209 , 2 , 2 , "LightningDensityNLDN15min" , "CG Lightning Density 15-min - NLDN" , "flashes/km^2/min" , - 3 , - 1 ) ; add ( 209 , 2 , 3 , "LightningDensityNLDN30min" , "CG Lightning Density 30-min - NLDN" , "flashes/km^2/min" , - 3 , - 1 ) ; add ( 209 , 2 , 4 , "LightningProbabilityNext30min" , "Lightning Probability 0-30 minutes - NLDN" , "%" , 0 , 0 ) ; add ( 209 , 3 , 0 , "MergedAzShear0to2kmAGL" , "Azimuth Shear 0-2km AGL" , "0.001/s" , 0 , 0 ) ; add ( 209 , 3 , 1 , "MergedAzShear3to6kmAGL" , "Azimuth Shear 3-6km AGL" , "0.001/s" , 0 , 0 ) ; add ( 209 , 3 , 2 , "RotationTrack30min" , "Rotation Track 0-2km AGL 30-min" , "0.001/s" , 0 , 0 ) ; add ( 209 , 3 , 3 , "RotationTrack60min" , "Rotation Track 0-2km AGL 60-min" , "0.001/s" , 0 , 0 ) ; add ( 209 , 3 , 4 , "RotationTrack120min" , "Rotation Track 0-2km AGL 120-min" , "0.001/s" , 0 , 0 ) ; add ( 209 , 3 , 5 , "RotationTrack240min" , "Rotation Track 0-2km AGL 240-min" , "0.001/s" , 0 , 0 ) ; add ( 209 , 3 , 6 , "RotationTrack360min" , "Rotation Track 0-2km AGL 360-min" , "0.001/s" , 0 , 0 ) ; add ( 209 , 3 , 7 , "RotationTrack1440min" , "Rotation Track 0-2km AGL 1440-min" , "0.001/s" , 0 , 0 ) ; add ( 209 , 3 , 14 , "RotationTrackML30min" , "Rotation Track 0-3km AGL 30-min" , "0.001/s" , 0 , 0 ) ; add ( 209 , 3 , 15 , "RotationTrackML60min" , "Rotation Track 0-3km AGL 60-min" , "0.001/s" , 0 , 0 ) ; add ( 209 , 3 , 16 , "RotationTrackML120min" , "Rotation Track 0-3km AGL 120-min" , "0.001/s" , 0 , 0 ) ; add ( 209 , 3 , 17 , "RotationTrackML240min" , "Rotation Track 0-3km AGL 240-min" , "0.001/s" , 0 , 0 ) ; add ( 209 , 3 , 18 , "RotationTrackML360min" , "Rotation Track 0-3km AGL 360-min" , "0.001/s" , 0 , 0 ) ; add ( 209 , 3 , 19 , "RotationTrackML1440min" , "Rotation Track 0-3km AGL 1440-min" , "0.001/s" , 0 , 0 ) ; add ( 209 , 3 , 26 , "SHI" , "Severe Hail Index" , "index" , - 3 , - 1 ) ; add ( 209 , 3 , 27 , "POSH" , "Prob of Severe Hail" , "%" , - 3 , - 1 ) ; add ( 209 , 3 , 28 , "MESH" , "Maximum Estimated Size of Hail (MESH)" , "mm" , - 3 , - 1 ) ; add ( 209 , 3 , 29 , "MESHMax30min" , "MESH Hail Swath 30-min" , "mm" , - 3 , - 1 ) ; add ( 209 , 3 , 30 , "MESHMax60min" , "MESH Hail Swath 60-min" , "mm" , - 3 , - 1 ) ; add ( 209 , 3 , 31 , "MESHMax120min" , "MESH Hail Swath 120-min" , "mm" , - 3 , - 1 ) ; add ( 209 , 3 , 32 , "MESHMax240min" , "MESH Hail Swath 240-min" , "mm" , - 3 , - 1 ) ; add ( 209 , 3 , 33 , "MESHMax360min" , "MESH Hail Swath 360-min" , "mm" , - 3 , - 1 ) ; add ( 209 , 3 , 34 , "MESHMax1440min" , "MESH Hail Swath 1440-min" , "mm" , - 3 , - 1 ) ; add ( 209 , 3 , 41 , "VIL" , "Vertically Integrated Liquid" , "kg/m^2" , - 3 , - 1 ) ; add ( 209 , 3 , 42 , "VILDensity" , "Vertically Integrated Liquid Density" , "g/m^3" , - 3 , - 1 ) ; add ( 209 , 3 , 43 , "VII" , "Vertically Integrated Ice" , "kg/m^2" , - 3 , - 1 ) ; add ( 209 , 3 , 44 , "EchoTop18" , "Echo Top - 18 dBZ MSL" , "km" , - 3 , - 1 ) ; add ( 209 , 3 , 45 , "EchoTop30" , "Echo Top - 30 dBZ MSL" , "km" , - 3 , - 1 ) ; add ( 209 , 3 , 46 , "EchoTop50" , "Echo Top - 50 dBZ MSL" , "km" , - 3 , - 1 ) ; add ( 209 , 3 , 47 , "EchoTop60" , "Echo Top - 60 dBZ MSL" , "km" , - 3 , - 1 ) ; add ( 209 , 3 , 48 , "H50AboveM20C" , "Thickness [50 dBZ top - (-20C)]" , "km" , - 999 , - 99 ) ; add ( 209 , 3 , 49 , "H50Above0C" , "Thickness [50 dBZ top - 0C]" , "km" , - 999 , - 99 ) ; add ( 209 , 3 , 50 , "H60AboveM20C" , "Thickness [60 dBZ top - (-20C)]" , "km" , - 999 , - 99 ) ; add ( 209 , 3 , 51 , "H60Above0C" , "Thickness [60 dBZ top - 0C]" , "km" , - 999 , - 99 ) ; add ( 209 , 3 , 52 , "Reflectivity0C" , "Isothermal Reflectivity at 0C" , "dBZ" , - 999 , - 99 ) ; add ( 209 , 3 , 53 , "ReflectivityM5C" , "Isothermal Reflectivity at -5C" , "dBZ" , - 999 , - 99 ) ; add ( 209 , 3 , 54 , "ReflectivityM10C" , "Isothermal Reflectivity at -10C" , "dBZ" , - 999 , - 99 ) ; add ( 209 , 3 , 55 , "ReflectivityM15C" , "Isothermal Reflectivity at -15C" , "dBZ" , - 999 , - 99 ) ; add ( 209 , 3 , 56 , "ReflectivityM20C" , "Isothermal Reflectivity at -20C" , "dBZ" , - 999 , - 99 ) ; add ( 209 , 3 , 57 , "ReflectivityAtLowestAltitude" , "ReflectivityAtLowestAltitude" , "dBZ" , - 999 , - 99 ) ; add ( 209 , 3 , 58 , "MergedReflectivityAtLowestAltitude" , "Non Quality Controlled Reflectivity At Lowest Altitude" , "dBZ" , - 999 , - 99 ) ; add ( 209 , 4 , 0 , "IRband4" , "Infrared (E/W blend)" , "K" , - 999 , - 99 ) ; add ( 209 , 4 , 1 , "Visible" , "Visible (E/W blend)" , "dimensionless" , - 3 , - 1 ) ; add ( 209 , 4 , 2 , "WaterVapor" , "Water Vapor (E/W blend)" , "K" , - 999 , - 99 ) ; add ( 209 , 4 , 3 , "CloudCover" , "Cloud Cover" , "K" , - 999 , - 99 ) ; add ( 209 , 6 , 0 , "PrecipFlag" , "Surface Precipitation Type (Convective, Stratiform, Tropical, Hail, Snow)" , "dimensionless" , - 3 , - 1 ) ; add ( 209 , 6 , 1 , "PrecipRate" , "Radar Precipitation Rate" , "mm/hr" , - 3 , - 1 ) ; add ( 209 , 6 , 2 , "RadarOnlyQPE01H" , "Radar precipitation accumulation 1-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 3 , "RadarOnlyQPE03H" , "Radar precipitation accumulation 3-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 4 , "RadarOnlyQPE06H" , "Radar precipitation accumulation 6-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 5 , "RadarOnlyQPE12H" , "Radar precipitation accumulation 12-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 6 , "RadarOnlyQPE24H" , "Radar precipitation accumulation 24-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 7 , "RadarOnlyQPE48H" , "Radar precipitation accumulation 48-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 8 , "RadarOnlyQPE72H" , "Radar precipitation accumulation 72-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 9 , "GaugeCorrQPE01H" , "Local gauge bias corrected radar precipitation accumulation 1-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 10 , "GaugeCorrQPE03H" , "Local gauge bias corrected radar precipitation accumulation 3-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 11 , "GaugeCorrQPE06H" , "Local gauge bias corrected radar precipitation accumulation 6-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 12 , "GaugeCorrQPE12H" , "Local gauge bias corrected radar precipitation accumulation 12-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 13 , "GaugeCorrQPE24H" , "Local gauge bias corrected radar precipitation accumulation 24-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 14 , "GaugeCorrQPE48H" , "Local gauge bias corrected radar precipitation accumulation 48-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 15 , "GaugeCorrQPE72H" , "Local gauge bias corrected radar precipitation accumulation 72-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 16 , "GaugeOnlyQPE01H" , "Gauge only precipitation accumulation 1-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 17 , "GaugeOnlyQPE03H" , "Gauge only precipitation accumulation 3-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 18 , "GaugeOnlyQPE06H" , "Gauge only precipitation accumulation 6-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 19 , "GaugeOnlyQPE12H" , "Gauge only precipitation accumulation 12-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 20 , "GaugeOnlyQPE24H" , "Gauge only precipitation accumulation 24-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 21 , "GaugeOnlyQPE48H" , "Gauge only precipitation accumulation 48-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 22 , "GaugeOnlyQPE72H" , "Gauge only precipitation accumulation 72-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 23 , "MountainMapperQPE01H" , "Mountain Mapper precipitation accumulation 1-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 24 , "MountainMapperQPE03H" , "Mountain Mapper precipitation accumulation 3-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 25 , "MountainMapperQPE06H" , "Mountain Mapper precipitation accumulation 6-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 26 , "MountainMapperQPE12H" , "Mountain Mapper precipitation accumulation 12-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 27 , "MountainMapperQPE24H" , "Mountain Mapper precipitation accumulation 24-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 28 , "MountainMapperQPE48H" , "Mountain Mapper precipitation accumulation 48-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 6 , 29 , "MountainMapperQPE72H" , "Mountain Mapper precipitation accumulation 72-hour" , "mm" , - 3 , - 1 ) ; add ( 209 , 7 , 0 , "ModelSurfaceTemp" , "Model Surface temperature [RAP 13km]" , "C" , - 999 , - 99 ) ; add ( 209 , 7 , 1 , "ModelWetBulbTemp" , "Model Surface wet bulb temperature [RAP 13km]" , "C" , - 999 , - 99 ) ; add ( 209 , 7 , 2 , "WarmRainProbability" , "Probability of warm rain [RAP 13km derived]" , "%" , - 3 , - 1 ) ; add ( 209 , 7 , 3 , "ModelHeight0C" , "Model Freezing Level Height [RAP 13km] MSL" , "m" , - 3 , - 1 ) ; add ( 209 , 7 , 4 , "BrightBandTopHeight" , "Brightband Top Radar [RAP 13km derived] AGL" , "m" , - 3 , - 1 ) ; add ( 209 , 7 , 5 , "BrightBandBottomHeight" , "Brightband Bottom Radar [RAP 13km derived] AGL" , "m" , - 3 , - 1 ) ; add ( 209 , 8 , 0 , "RadarQualityIndex" , "Radar Quality Index" , "dimensionless" , - 3 , - 1 ) ; add ( 209 , 8 , 1 , "GaugeInflIndex01H" , "Gauge Influence Index for 1-hour QPE" , "dimensionless" , - 3 , - 1 ) ; add ( 209 , 8 , 2 , "GaugeInflIndex03H" , "Gauge Influence Index for 3-hour QPE" , "dimensionless" , - 3 , - 1 ) ; add ( 209 , 8 , 3 , "GaugeInflIndex06H" , "Gauge Influence Index for 6-hour QPE" , "dimensionless" , - 3 , - 1 ) ; add ( 209 , 8 , 4 , "GaugeInflIndex12H" , "Gauge Influence Index for 12-hour QPE" , "dimensionless" , - 3 , - 1 ) ; add ( 209 , 8 , 5 , "GaugeInflIndex24H" , "Gauge Influence Index for 24-hour QPE" , "dimensionless" , - 3 , - 1 ) ; add ( 209 , 8 , 6 , "GaugeInflIndex48H" , "Gauge Influence Index for 48-hour QPE" , "dimensionless" , - 3 , - 1 ) ; add ( 209 , 8 , 7 , "GaugeInflIndex72H" , "Gauge Influence Index for 72-hour QPE" , "dimensionless" , - 3 , - 1 ) ; add ( 209 , 8 , 8 , "SeamlessHSR" , "Seamless Hybrid Scan Reflectivity with VPR correction" , "dBZ" , - 999 , - 99 ) ; add ( 209 , 8 , 9 , "SeamlessHSRHeight" , "Height of Seamless Hybrid Scan Reflectivity AGL" , "km" , - 3 , - 1 ) ; add ( 209 , 9 , 0 , "ConusMergedReflectivityQC" , "WSR-88D 3D Reflectivity Mosaic - 33 CAPPIS (500-19000m)" , "dBZ" , - 999 , - 99 ) ; add ( 209 , 9 , 1 , "ConusPlusMergedReflectivityQC" , "All Radar 3D Reflectivity Mosaic - 33 CAPPIS (500-19000m)" , "dBZ" , - 999 , - 99 ) ; add ( 209 , 10 , 0 , "MergedReflectivityQCComposite" , "Composite Reflectivity Mosaic (optimal method)" , "dBZ" , - 999 , - 99 ) ; add ( 209 , 10 , 1 , "HeightCompositeReflectivity" , "Height of Composite Reflectivity Mosaic (optimal method) MSL" , "m" , - 3 , - 1 ) ; add ( 209 , 10 , 2 , "LowLevelCompositeReflectivity" , "Low-Level Composite Reflectivity Mosaic (0-4km)" , "dBZ" , - 999 , - 99 ) ; add ( 209 , 10 , 3 , "HeightLowLevelCompositeReflectivity" , "Height of Low-Level Composite Reflectivity Mosaic (0-4km) MSL" , "m" , - 3 , - 1 ) ; add ( 209 , 10 , 4 , "LayerCompositeReflectivity_Low" , "Layer Composite Reflectivity Mosaic 0-24kft (low altitude)" , "dBZ" , - 999 , - 99 ) ; add ( 209 , 10 , 5 , "LayerCompositeReflectivity_High" , "Layer Composite Reflectivity Mosaic 24-60 kft (highest altitude)" , "dBZ" , - 999 , - 99 ) ; add ( 209 , 10 , 6 , "LayerCompositeReflectivity_Super" , "Layer Composite Reflectivity Mosaic 33-60 kft (super high altitude)" , "dBZ" , - 999 , - 99 ) ; add ( 209 , 10 , 7 , "ReflectivityCompositeHourlyMax" , "Composite Reflectivity Hourly Maximum" , "dBZ" , - 999 , - 99 ) ; add ( 209 , 10 , 8 , "ReflectivityMaxAboveM10C" , "Maximum Reflectivity at -10 deg C height and above" , "dBZ" , - 999 , - 99 ) ; add ( 209 , 11 , 0 , "MergedBaseReflectivityQC" , "Mosaic Base Reflectivity (optimal method)" , "dBZ" , - 999 , - 99 ) ; add ( 209 , 11 , 1 , "MergedReflectivityComposite" , "UnQc'd Composite Reflectivity Mosaic (max ref)" , "dBZ" , - 999 , - 99 ) ; add ( 209 , 11 , 2 , "MergedReflectivityQComposite" , "Composite Reflectivity Mosaic (max ref)" , "dBZ" , - 999 , - 99 ) ;


signature:
public class Nc4Notes { /** * Use a factory so we can debug constructor calls */
static Notes factory ( NoteSort ns , int g , int id , Nc4DSP dsp ) { } }

implementation: Notes note = null ; switch ( ns ) { case TYPE : note = new TypeNotes ( g , id , dsp ) ; break ; case VAR : note = new VarNotes ( g , id , dsp ) ; break ; case DIM : note = new DimNotes ( g , id , dsp ) ; break ; case GROUP : note = new GroupNotes ( g , id , dsp ) ; break ; } return note ;


signature:
public class Nc4Notes { /** * Manage the compound id for variables */
static public long getVarId ( VarNotes note ) { } }

implementation: return getVarId ( note . gid , note . id , note . getFieldIndex ( ) ) ;


signature:
public class DodsV { /** * Parse the DDS , creating a tree of DodsV objects . The root node is only a container , ie it has no BaseType .
 * The Darray object ( which has the dimension info ) becomes a field of the DodsV , rather than being in the tree .
 * @ param dds the DDS to parse
 * @ return the root dodsV object */
static DodsV parseDDS ( DDS dds ) { } }

implementation:
DodsV root = new DodsV ( null , null ) ; // recursively get the Variables from the DDS
Enumeration variables = dds . getVariables ( ) ; parseVariables ( root , variables ) ; // assign depth first sequence number
root . assignSequence ( root ) ; return root ;


signature:
public class DodsV { /** * Recursively build the dodsV tree .
 * 1 ) put all Variables into a DodsV
 * 2 ) unravel DConstructors ( DSequence , DStructure , DGrid )
 * 3 ) for Darray , we put Variable = elemType , and store the darray seperately , not in the heirarchy .
 * @ param parent of the tree
 * @ param children list of BaseType */
static private void parseVariables ( DodsV parent , Enumeration children ) { } }

implementation:
while ( children . hasMoreElements ( ) ) { opendap . dap . BaseType bt = ( opendap . dap . BaseType ) children . nextElement ( ) ; if ( bt instanceof DList ) { String mess = "Variables of type " + bt . getClass ( ) . getName ( ) + " are not supported." ; logger . warn ( mess ) ; continue ; } DodsV dodsV = new DodsV ( parent , bt ) ; if ( bt instanceof DConstructor ) { DConstructor dcon = ( DConstructor ) bt ; java . util . Enumeration enumerate2 = dcon . getVariables ( ) ; parseVariables ( dodsV , enumerate2 ) ; } else if ( bt instanceof DArray ) { DArray da = ( DArray ) bt ; // Check to see if the array has any zero - length dimension ; if so then ignore
for ( Enumeration e = da . getDimensions ( ) ; e . hasMoreElements ( ) ; ) { DArrayDimension dim = ( DArrayDimension ) e . nextElement ( ) ; if ( dim . getSize ( ) <= 0 ) return ; } BaseType elemType = da . getPrimitiveVector ( ) . getTemplate ( ) ; dodsV . bt = elemType ; dodsV . darray = da ; if ( ( elemType instanceof DGrid ) || ( elemType instanceof DSequence ) || ( elemType instanceof DList ) ) { String mess = "Arrays of type " + elemType . getClass ( ) . getName ( ) + " are not supported." ; logger . warn ( mess ) ; continue ; } if ( elemType instanceof DStructure ) { // note that for DataDDS , cant traverse this further to find the data .
DConstructor dcon = ( DConstructor ) elemType ; java . util . Enumeration nestedVariables = dcon . getVariables ( ) ; parseVariables ( dodsV , nestedVariables ) ; } } parent . children . add ( dodsV ) ; }


signature:
public class DodsV { /** * Parse the DDS , creating a tree of DodsV objects . The root node is only a container , ie it has no BaseType .
 * The Darray object ( which has the dimension info ) becomes a field of the DodsV , rather than being in the tree .
 * @ param dds the DataDDS to parse
 * @ return the root DodsV object
 * @ throws opendap . dap . NoSuchVariableException if DataDDS contains a Variable not in the DDS */
static DodsV parseDataDDS ( DataDDS dds ) throws NoSuchVariableException { } }

implementation:
DodsV root = new DodsV ( null , null ) ; // recursively get the Variables from the DDS
Enumeration variables = dds . getVariables ( ) ; parseDataVariables ( root , variables ) ; // assign depth first sequence number
root . assignSequence ( root ) ; return root ;


signature:
public class DodsV { /** * Recursively build the dodsV tree .
 * 1 ) put all Variables into a DodsV
 * 2 ) unravel DConstructors ( DSequence , DStructure , DGrid )
 * 3 ) for Darray , we put Variable = elemType , and store the darray seperately , not in the heirarchy .
 * @ param parent of the tree
 * @ param children list of BaseType
 * @ throws opendap . dap . NoSuchVariableException if children and parent are inconsistent */
static private void parseDataVariables ( DodsV parent , Enumeration children ) throws NoSuchVariableException { } }

implementation:
while ( children . hasMoreElements ( ) ) { opendap . dap . BaseType bt = ( opendap . dap . BaseType ) children . nextElement ( ) ; DodsV dodsV = new DodsV ( parent , bt ) ; parent . children . add ( dodsV ) ; if ( bt instanceof DGrid ) { DGrid dgrid = ( DGrid ) bt ; if ( dodsV . parent . bt == null ) { // is top level
// top level grids are replaced by their " data array "
dodsV . darray = ( DArray ) dgrid . getVar ( 0 ) ; processDArray ( dodsV ) ; } else { // nested grids are made into Structures
dodsV . makeAllDimensions ( ) ; } java . util . Enumeration enumerate2 = dgrid . getVariables ( ) ; parseDataVariables ( dodsV , enumerate2 ) ; } else if ( bt instanceof DSequence ) { DSequence dseq = ( DSequence ) bt ; int seqlen = dseq . getRowCount ( ) ; if ( seqlen > 0 ) { DArrayDimension ddim = new DArrayDimension ( seqlen , null ) ; dodsV . dimensions . add ( ddim ) ; } dodsV . makeAllDimensions ( ) ; java . util . Enumeration enumerate2 = dseq . getVariables ( ) ; parseDataVariables ( dodsV , enumerate2 ) ; } else if ( bt instanceof DConstructor ) { DStructure dcon = ( DStructure ) bt ; // LOOK DConstructor ! = DStructure ?
dodsV . makeAllDimensions ( ) ; java . util . Enumeration enumerate2 = dcon . getVariables ( ) ; parseDataVariables ( dodsV , enumerate2 ) ; } else if ( bt instanceof DArray ) { dodsV . darray = ( DArray ) bt ; processDArray ( dodsV ) ; dodsV . bt = dodsV . elemType ; if ( dodsV . elemType instanceof DStructure ) { DStructure dcon = ( DStructure ) dodsV . elemType ; java . util . Enumeration nestedVariables = dcon . getVariables ( ) ; parseDataVariables ( dodsV , nestedVariables ) ; } } else { dodsV . makeAllDimensions ( ) ; } }


signature:
public class DodsV { /** * Parse the DAS , assign attribute tables to the DodsV objects .
 * Nested attribute tables are supposed to follow the tree we construct with dodsV , so its easy to assign to correct dodsV .
 * @ param das parse this DAS
 * @ throws IOException on io error */
void parseDAS ( DAS das ) throws IOException { } }

implementation:
Enumeration tableNames = das . getNames ( ) ; while ( tableNames . hasMoreElements ( ) ) { String tableName = ( String ) tableNames . nextElement ( ) ; AttributeTable attTable = das . getAttributeTableN ( tableName ) ; if ( tableName . equals ( "NC_GLOBAL" ) || tableName . equals ( "HDF_GLOBAL" ) ) { addAttributeTable ( this , attTable , tableName , true ) ; } else if ( tableName . equals ( "DODS_EXTRA" ) || tableName . equals ( "EXTRA_DIMENSION" ) ) { // handled seperately in DODSNetcdfFile
continue ; } else { DodsV dodsV = findDodsV ( tableName , false ) ; // short name matches the table name
if ( dodsV != null ) { addAttributeTable ( dodsV , attTable , tableName , true ) ; } else { dodsV = findTableDotDelimited ( tableName ) ; if ( dodsV != null ) { addAttributeTable ( dodsV , attTable , tableName , true ) ; } else { if ( debugAttributes ) System . out . println ( "DODSNetcdf getAttributes CANT find <" + tableName + "> add to globals" ) ; addAttributeTable ( this , attTable , tableName , false ) ; } } } }


signature:
public class DodsV { /** * Search the immediate children for a BaseType with given name .
 * @ param name look for this name
 * @ param useDone
 * @ return child that matches if found , else null */
DodsV findDodsV ( String name , boolean useDone ) { } }

implementation:
for ( DodsV dodsV : children ) { if ( useDone && dodsV . isDone ) continue ; // LOOK useDone ? ?
if ( ( name == null ) || ( dodsV == null ) || ( dodsV . bt == null ) ) { logger . warn ( "Corrupted structure" ) ; continue ; } if ( name . equals ( dodsV . bt . getEncodedName ( ) ) ) return dodsV ; } return null ;


signature:
public class DodsV { /** * find the DodsV object in the dataVlist corresponding to the ddsV */
DodsV findDataV ( DodsV ddsV ) { } }

implementation:
if ( ddsV . parent . bt != null ) { DodsV parentV = findDataV ( ddsV . parent ) ; if ( parentV == null ) // dataDDS may not have the structure wrapper
return findDodsV ( ddsV . bt . getEncodedName ( ) , true ) ; return parentV . findDodsV ( ddsV . bt . getEncodedName ( ) , true ) ; } DodsV dataV = findDodsV ( ddsV . bt . getEncodedName ( ) , true ) ; /* if ( ( dataV = = null ) & & ( ddsV . bt instanceof DGrid ) ) { / / when asking for the Grid array
 DodsV gridArray = ( DodsV ) ddsV . children . get ( 0 ) ;
 return findDodsV ( gridArray . bt . getName ( ) , dataVlist , true ) ; */
return dataV ;


signature:
public class DodsV { /** * Return a child by index
 * @ param index return index ' th child
 * @ return index ' th child or null if index is too large */
DodsV findByIndex ( int index ) { } }

implementation: if ( children . size ( ) <= index ) return null ; return children . get ( index ) ;


signature: public class DodsV { private static void doit ( String urlName ) throws IOException , DAP2Exception { } }

implementation:
System . out . println ( "DODSV read =" + urlName ) ; try ( DConnect2 dodsConnection = new DConnect2 ( urlName , true ) ) { // get the DDS
DDS dds = dodsConnection . getDDS ( ) ; dds . print ( System . out ) ; DodsV root = DodsV . parseDDS ( dds ) ; // get the DAS
DAS das = dodsConnection . getDAS ( ) ; das . print ( System . out ) ; root . parseDAS ( das ) ; // show the dodsV tree
root . show ( System . out , "" ) ; }


signature:
public class Variable { /** * Get the shape : length of Variable in each dimension .
 * A scalar ( rank 0 ) will have an int [ 0 ] shape .
 * @ return int array whose length is the rank of this Variable
 * and whose values equal the length of that Dimension . */
public int [ ] getShape ( ) { } }

implementation:
int [ ] result = new int [ shape . length ] ; // optimization over clone ( )
System . arraycopy ( shape , 0 , result , 0 , shape . length ) ; return result ;


signature:
public class Variable { /** * Get the parent group .
 * @ return group of this variable ; if null return rootgroup */
public Group getParentGroup ( ) { } }

implementation: Group g = super . getParentGroup ( ) ; if ( g == null ) { g = ncfile . getRootGroup ( ) ; super . setParentGroup ( g ) ; } assert g != null ; return g ;


signature:
public class Variable { /** * Get the ith dimension .
 * @ param i index of the dimension .
 * @ return requested Dimension , or null if i is out of bounds . */
public Dimension getDimension ( int i ) { } }

implementation: if ( ( i < 0 ) || ( i >= getRank ( ) ) ) return null ; return dimensions . get ( i ) ;


signature:
public class Variable { /** * Find the index of the named Dimension in this Variable .
 * @ param name the name of the dimension
 * @ return the index of the named Dimension , or - 1 if not found . */
public int findDimensionIndex ( String name ) { } }

implementation: for ( int i = 0 ; i < dimensions . size ( ) ; i ++ ) { Dimension d = dimensions . get ( i ) ; if ( name . equals ( d . getShortName ( ) ) ) return i ; } return - 1 ;


signature:
public class Variable { /** * Get the Unit String for the Variable .
 * Looks for the CDM . UNITS attribute value
 * @ return unit string , or null if not found . */
public String getUnitsString ( ) { } }

implementation: String units = null ; Attribute att = findAttribute ( CDM . UNITS ) ; if ( att == null ) att = findAttributeIgnoreCase ( CDM . UNITS ) ; if ( ( att != null ) && att . isString ( ) ) { units = att . getStringValue ( ) ; if ( units != null ) units = units . trim ( ) ; } return units ;


signature:
public class Variable { /** * Get shape as a Section object .
 * @ return Section containing List < Range > , one for each Dimension . */
public Section getShapeAsSection ( ) { } }

implementation:
if ( shapeAsSection == null ) { try { List < Range > list = new ArrayList < > ( ) ; for ( Dimension d : dimensions ) { int len = d . getLength ( ) ; if ( len > 0 ) list . add ( new Range ( d . getShortName ( ) , 0 , len - 1 ) ) ; else if ( len == 0 ) list . add ( Range . EMPTY ) ; // LOOK empty not named
else { assert d . isVariableLength ( ) ; list . add ( Range . VLEN ) ; // LOOK vlen not named
} } shapeAsSection = new Section ( list ) . makeImmutable ( ) ; } catch ( InvalidRangeException e ) { log . error ( "Bad shape in variable " + getFullName ( ) , e ) ; throw new IllegalStateException ( e . getMessage ( ) ) ; } } return shapeAsSection ;


signature:
public class Variable { /** * Create a new Variable that is a logical subsection of this Variable .
 * No data is read until a read method is called on it .
 * @ param ranges List of type ucar . ma2 . Range , with size equal to getRank ( ) .
 * Each Range corresponds to a Dimension , and specifies the section of data to read in that Dimension .
 * A Range object may be null , which means use the entire dimension .
 * @ return a new Variable which is a logical section of this Variable .
 * @ throws InvalidRangeException */
public Variable section ( List < Range > ranges ) throws InvalidRangeException { } }

implementation: return section ( new Section ( ranges , shape ) . makeImmutable ( ) ) ;


signature:
public class Variable { /** * Create a new Variable that is a logical subsection of this Variable .
 * No data is read until a read method is called on it .
 * @ param subsection Section of this variable .
 * Each Range in the section corresponds to a Dimension , and specifies the section of data to read in that Dimension .
 * A Range object may be null , which means use the entire dimension .
 * @ return a new Variable which is a logical section of this Variable .
 * @ throws InvalidRangeException if section not compatible with shape */
public Variable section ( Section subsection ) throws InvalidRangeException { } }

implementation:
subsection = Section . fill ( subsection , shape ) ; // create a copy of this variable with a proxy reader
Variable sectionV = copy ( ) ; // subclasses must override
sectionV . setProxyReader ( new SectionReader ( this , subsection ) ) ; sectionV . shape = subsection . getShape ( ) ; sectionV . createNewCache ( ) ; // dont share the cache
sectionV . setCaching ( false ) ; // dont cache
// replace dimensions if needed ! ! LOOK not shared
sectionV . dimensions = new ArrayList < > ( ) ; for ( int i = 0 ; i < getRank ( ) ; i ++ ) { Dimension oldD = getDimension ( i ) ; Dimension newD = ( oldD . getLength ( ) == sectionV . shape [ i ] ) ? oldD : new Dimension ( oldD . getShortName ( ) , sectionV . shape [ i ] , false ) ; newD . setUnlimited ( oldD . isUnlimited ( ) ) ; sectionV . dimensions . add ( newD ) ; } sectionV . resetShape ( ) ; return sectionV ;


signature:
public class Variable { /** * Create a new Variable that is a logical slice of this Variable , by
 * fixing the specified dimension at the specified index value . This reduces rank by 1.
 * No data is read until a read method is called on it .
 * @ param dim which dimension to fix
 * @ param value at what index value
 * @ return a new Variable which is a logical slice of this Variable .
 * @ throws InvalidRangeException if dimension or value is illegal */
public Variable slice ( int dim , int value ) throws InvalidRangeException { } }

implementation:
if ( ( dim < 0 ) || ( dim >= shape . length ) ) throw new InvalidRangeException ( "Slice dim invalid= " + dim ) ; // ok to make slice of record dimension with length 0
boolean recordSliceOk = false ; if ( ( dim == 0 ) && ( value == 0 ) ) { Dimension d = getDimension ( 0 ) ; recordSliceOk = d . isUnlimited ( ) ; } // otherwise check slice in range
if ( ! recordSliceOk ) { if ( ( value < 0 ) || ( value >= shape [ dim ] ) ) throw new InvalidRangeException ( "Slice value invalid= " + value + " for dimension " + dim ) ; } // create a copy of this variable with a proxy reader
Variable sliceV = copy ( ) ; // subclasses must override
Section slice = new Section ( getShapeAsSection ( ) ) ; slice . replaceRange ( dim , new Range ( value , value ) ) . makeImmutable ( ) ; sliceV . setProxyReader ( new SliceReader ( this , dim , slice ) ) ; sliceV . createNewCache ( ) ; // dont share the cache
sliceV . setCaching ( false ) ; // dont cache
// remove that dimension - reduce rank
sliceV . dimensions . remove ( dim ) ; sliceV . resetShape ( ) ; return sliceV ;


signature:
public class Variable { /** * Create a new Variable that is a logical view of this Variable , by
 * eliminating the specified dimension ( s ) of length 1.
 * No data is read until a read method is called on it .
 * @ param dims list of dimensions of length 1 to reduce
 * @ return a new Variable which is a logical slice of this Variable .
 * @ throws InvalidRangeException if dimension or value is illegal */
public Variable reduce ( List < Dimension > dims ) throws InvalidRangeException { } }

implementation:
List < Integer > dimIdx = new ArrayList < > ( dims . size ( ) ) ; for ( Dimension d : dims ) { assert dimensions . contains ( d ) ; assert d . getLength ( ) == 1 ; dimIdx . add ( dimensions . indexOf ( d ) ) ; } // create a copy of this variable with a proxy reader
Variable sliceV = copy ( ) ; // subclasses must override
sliceV . setProxyReader ( new ReduceReader ( this , dimIdx ) ) ; sliceV . createNewCache ( ) ; // dont share the cache
sliceV . setCaching ( false ) ; // dont cache
// remove dimension ( s ) - reduce rank
for ( Dimension d : dims ) sliceV . dimensions . remove ( d ) ; sliceV . resetShape ( ) ; return sliceV ;


signature:
public class Variable { /** * Public by accident .
 * @ param enumTypedef set the EnumTypedef , only use if getDataType . isEnum ( ) */
public void setEnumTypedef ( EnumTypedef enumTypedef ) { } }

implementation: if ( immutable ) throw new IllegalStateException ( "Cant modify" ) ; if ( ! dataType . isEnum ( ) ) throw new UnsupportedOperationException ( "Can only call Variable.setEnumTypedef() on enum types" ) ; this . enumTypedef = enumTypedef ;


signature:
public class Variable { /** * Read a section of the data for this Variable and return a memory resident Array .
 * The Array has the same element type as the Variable , and the requested shape .
 * Note that this does not do rank reduction , so the returned Array has the same rank
 * as the Variable . Use Array . reduce ( ) for rank reduction .
 * < code > assert ( origin [ ii ] + shape [ ii ] * stride [ ii ] < = Variable . shape [ ii ] ) ; < / code >
 * @ param origin int array specifying the starting index . If null , assume all zeroes .
 * @ param shape int array specifying the extents in each dimension .
 * This becomes the shape of the returned Array .
 * @ return the requested data in a memory - resident Array */
public Array read ( int [ ] origin , int [ ] shape ) throws IOException , InvalidRangeException { } }

implementation: if ( ( origin == null ) && ( shape == null ) ) return read ( ) ; if ( origin == null ) return read ( new Section ( shape ) ) ; if ( shape == null ) return read ( new Section ( origin , this . shape ) ) ; return read ( new Section ( origin , shape ) ) ;


signature:
public class Variable { /** * Read a section of the data for this Variable from the netcdf file and return a memory resident Array .
 * @ param ranges list of Range specifying the section of data to read .
 * @ return the requested data in a memory - resident Array
 * @ throws IOException if error
 * @ throws InvalidRangeException if ranges is invalid
 * @ see # read ( Section ) */
public Array read ( List < Range > ranges ) throws IOException , InvalidRangeException { } }

implementation: if ( null == ranges ) return _read ( ) ; return read ( new Section ( ranges ) ) ;


signature:
public class Variable { /** * Read a section of the data for this Variable from the netcdf file and return a memory resident Array .
 * The Array has the same element type as the Variable , and the requested shape .
 * Note that this does not do rank reduction , so the returned Array has the same rank
 * as the Variable . Use Array . reduce ( ) for rank reduction .
 * If the Variable is a member of an array of Structures , this returns only the variable ' s data
 * in the first Structure , so that the Array shape is the same as the Variable .
 * To read the data in all structures , use ncfile . readSectionSpec ( ) .
 * Note this only allows you to specify a subset of this variable .
 * If the variable is nested in a array of structures and you want to subset that , use
 * NetcdfFile . read ( String sectionSpec , boolean flatten ) ;
 * @ param section list of Range specifying the section of data to read .
 * Must be null or same rank as variable .
 * If list is null , assume all data .
 * Each Range corresponds to a Dimension . If the Range object is null , it means use the entire dimension .
 * @ return the requested data in a memory - resident Array
 * @ throws IOException if error
 * @ throws InvalidRangeException if section is invalid */
public Array read ( ucar . ma2 . Section section ) throws java . io . IOException , ucar . ma2 . InvalidRangeException { } }

implementation: return ( section == null ) ? _read ( ) : _read ( Section . fill ( section , shape ) ) ;


signature:
public class Variable { /** * Get the value as a String for a scalar Variable . May also be one - dimensional of length 1.
 * May also be one - dimensional of type CHAR , which wil be turned into a scalar String .
 * @ throws IOException if theres an IO Error
 * @ throws UnsupportedOperationException if not a scalar or one - dimensional .
 * @ throws ClassCastException if data type not DataType . STRING or DataType . CHAR . */
public String readScalarString ( ) throws IOException { } }

implementation: Array data = getScalarData ( ) ; if ( dataType == DataType . STRING ) return ( String ) data . getObject ( Index . scalarIndexImmutable ) ; else if ( dataType == DataType . CHAR ) { ArrayChar dataC = ( ArrayChar ) data ; return dataC . getString ( ) ; } else throw new IllegalArgumentException ( "readScalarString not STRING or CHAR " + getFullName ( ) ) ;


signature:
public class Variable { /** * non - structure - member Variables . */
protected Array _read ( ) throws IOException { } }

implementation:
// caching overrides the proxyReader
// check if already cached
if ( cache . data != null ) { if ( debugCaching ) System . out . println ( "got data from cache " + getFullName ( ) ) ; return cache . data . copy ( ) ; } Array data = proxyReader . reallyRead ( this , null ) ; // optionally cache it
if ( isCaching ( ) ) { setCachedData ( data ) ; if ( debugCaching ) System . out . println ( "cache " + getFullName ( ) ) ; return cache . data . copy ( ) ; // dont let users get their nasty hands on cached data
} else { return data ; }


signature:
public class Variable { /** * public by accident , do not call directly .
 * @ return Array
 * @ throws IOException on error */
@ Override public Array reallyRead ( Variable client , CancelTask cancelTask ) throws IOException { } }

implementation:
if ( isMemberOfStructure ( ) ) { // LOOK should be UnsupportedOperationException ? ?
List < String > memList = new ArrayList < > ( ) ; memList . add ( this . getShortName ( ) ) ; Structure s = getParentStructure ( ) . select ( memList ) ; ArrayStructure as = ( ArrayStructure ) s . read ( ) ; return as . extractMemberArray ( as . findMember ( getShortName ( ) ) ) ; } try { return ncfile . readData ( this , getShapeAsSection ( ) ) ; } catch ( InvalidRangeException e ) { e . printStackTrace ( ) ; throw new IOException ( e . getMessage ( ) ) ; // cant happen haha
}


signature:
public class Variable { /** * assume filled , validated Section */
protected Array _read ( Section section ) throws IOException , InvalidRangeException { } }

implementation:
// check if its really a full read
if ( ( null == section ) || section . computeSize ( ) == getSize ( ) ) return _read ( ) ; // full read was cached
if ( isCaching ( ) ) { if ( cache . data == null ) { setCachedData ( _read ( ) ) ; // read and cache entire array
if ( debugCaching ) System . out . println ( "cache " + getFullName ( ) ) ; } if ( debugCaching ) System . out . println ( "got data from cache " + getFullName ( ) ) ; return cache . data . sectionNoReduce ( section . getRanges ( ) ) . copy ( ) ; // subset it , return copy
} return proxyReader . reallyRead ( this , section , null ) ;


signature:
public class Variable { /** * public by accident , do not call directly .
 * @ return Array
 * @ throws IOException on error */
@ Override public Array reallyRead ( Variable client , Section section , CancelTask cancelTask ) throws IOException , InvalidRangeException { } }

implementation:
if ( isMemberOfStructure ( ) ) { throw new UnsupportedOperationException ( "Cannot directly read section of Member Variable=" + getFullName ( ) ) ; } // read just this section
return ncfile . readData ( this , section ) ;


signature:
public class Variable { /** * / * structure - member Variable ; section has a Range for each array in the parent
 * stuctures ( s ) and for the Variable .
 * private Array _ readMemberData ( List < Range > section , boolean flatten ) throws IOException , InvalidRangeException {
 * / * Variable useVar = ( ioVar ! = null ) ? ioVar : this ;
 * NetcdfFile useFile = ( ncfileIO ! = null ) ? ncfileIO : ncfile ;
 * return useFile . readMemberData ( useVar , section , flatten ) ; */
public long readToByteChannel ( Section section , WritableByteChannel wbc ) throws IOException , InvalidRangeException { } }

implementation: if ( ( ncfile == null ) || hasCachedData ( ) ) return IospHelper . copyToByteChannel ( read ( section ) , wbc ) ; return ncfile . readToByteChannel ( this , section , wbc ) ;


signature:
public class Variable { /** * Get the display name plus the dimensions , eg ' float name ( dim1 , dim2 ) '
 * @ return display name plus the dimensions */
public String getNameAndDimensions ( ) { } }

implementation: Formatter buf = new Formatter ( ) ; getNameAndDimensions ( buf , true , false ) ; return buf . toString ( ) ;


signature:
public class Variable { /** * Get the display name plus the dimensions , eg ' float name ( dim1 , dim2 ) '
 * @ param strict strictly comply with ncgen syntax , with name escaping . otherwise , get extra info , no escaping
 * @ return display name plus the dimensions */
public String getNameAndDimensions ( boolean strict ) { } }

implementation: Formatter buf = new Formatter ( ) ; getNameAndDimensions ( buf , false , strict ) ; return buf . toString ( ) ;


signature:
public class Variable { /** * Get the display name plus the dimensions , eg ' name ( dim1 , dim2 ) '
 * @ param buf add info to this StringBuffer
 * @ deprecated use getNameAndDimensions ( StringBuilder buf ) */
public void getNameAndDimensions ( StringBuffer buf ) { } }

implementation: Formatter proxy = new Formatter ( ) ; getNameAndDimensions ( proxy , true , false ) ; buf . append ( proxy . toString ( ) ) ;


signature:
public class Variable { /** * Add display name plus the dimensions to the StringBuffer
 * @ param buf add info to this
 * @ param useFullName use full name else short name . strict = true implies short name
 * @ param strict strictly comply with ncgen syntax , with name escaping . otherwise , get extra info , no escaping */
public void getNameAndDimensions ( StringBuilder buf , boolean useFullName , boolean strict ) { } }

implementation: Formatter proxy = new Formatter ( ) ; getNameAndDimensions ( proxy , useFullName , strict ) ; buf . append ( proxy . toString ( ) ) ;


signature:
public class Variable { /** * Add display name plus the dimensions to the StringBuffer
 * @ param buf add info to this
 * @ param useFullName use full name else short name . strict = true implies short name
 * @ param strict strictly comply with ncgen syntax , with name escaping . otherwise , get extra info , no escaping */
public void getNameAndDimensions ( Formatter buf , boolean useFullName , boolean strict ) { } }

implementation: useFullName = useFullName && ! strict ; String name = useFullName ? getFullName ( ) : getShortName ( ) ; if ( strict ) name = NetcdfFile . makeValidCDLName ( getShortName ( ) ) ; buf . format ( "%s" , name ) ; if ( shape != null ) { if ( getRank ( ) > 0 ) buf . format ( "(" ) ; for ( int i = 0 ; i < dimensions . size ( ) ; i ++ ) { Dimension myd = dimensions . get ( i ) ; String dimName = myd . getShortName ( ) ; if ( ( dimName != null ) && strict ) dimName = NetcdfFile . makeValidCDLName ( dimName ) ; if ( i != 0 ) buf . format ( ", " ) ; if ( myd . isVariableLength ( ) ) { buf . format ( "*" ) ; } else if ( myd . isShared ( ) ) { if ( ! strict ) buf . format ( "%s=%d" , dimName , myd . getLength ( ) ) ; else buf . format ( "%s" , dimName ) ; } else { if ( dimName != null ) { buf . format ( "%s=" , dimName ) ; } buf . format ( "%d" , myd . getLength ( ) ) ; } } if ( getRank ( ) > 0 ) buf . format ( ")" ) ; }


signature:
public class Variable { /** * CDL representation of a Variable .
 * @ param useFullName use full name , else use short name
 * @ param strict strictly comply with ncgen syntax
 * @ return CDL representation of the Variable . */
public String writeCDL ( boolean useFullName , boolean strict ) { } }

implementation: Formatter buf = new Formatter ( ) ; writeCDL ( buf , new Indent ( 2 ) , useFullName , strict ) ; return buf . toString ( ) ;


signature:
public class Variable { /** * String representation of Variable and its attributes . */
public String toStringDebug ( ) { } }

implementation: Formatter f = new Formatter ( ) ; f . format ( "Variable %s" , getFullName ( ) ) ; if ( ncfile != null ) { f . format ( " in file %s" , getDatasetLocation ( ) ) ; String extra = ncfile . toStringDebug ( this ) ; if ( extra != null ) f . format ( " %s" , extra ) ; } return f . toString ( ) ;


signature:
public class Variable { /** * Set the data type
 * @ param dataType set to this value */
public void setDataType ( DataType dataType ) { } }

implementation:
if ( immutable ) throw new IllegalStateException ( "Cant modify" ) ; this . dataType = dataType ; this . elementSize = getDataType ( ) . getSize ( ) ; /* why is this needed ? ?
 EnumTypedef etd = getEnumTypedef ( ) ;
 if ( etd ! = null ) {
 DataType etdtype = etd . getBaseType ( ) ;
 if ( dataType ! = etdtype )
 log . error ( " Variable . setDataType : enum basetype mismatch : { } ! = { } " , etdtype , dataType ) ;
 / * DataType basetype = null ;
 if ( dataType = = DataType . ENUM1 ) basetype = DataType . BYTE ;
 else if ( dataType = = DataType . ENUM2 ) basetype = DataType . SHORT ;
 else if ( dataType = = DataType . ENUM4 ) basetype = DataType . INT ;
 else basetype = etdtype ;
 if ( etdtype ! = null & & dataType ! = etdtype )
 else
 etd . setBaseType ( basetype ) ; */


signature:
public class Variable { /** * Set the shape with a list of Dimensions . The Dimensions may be shared or not .
 * Dimensions are in order , slowest varying first . Send a null for a scalar .
 * Technically you can use Dimensions from any group ; pragmatically you should only use
 * Dimensions contained in the Variable ' s parent groups .
 * @ param dims list of type ucar . nc2 . Dimension */
public void setDimensions ( List < Dimension > dims ) { } }

implementation: if ( immutable ) throw new IllegalStateException ( "Cant modify" ) ; this . dimensions = ( dims == null ) ? new ArrayList < > ( ) : new ArrayList < > ( dims ) ; resetShape ( ) ;


signature:
public class Variable { /** * Use when dimensions have changed , to recalculate the shape . */
public void resetShape ( ) { } }

implementation:
// if ( immutable ) throw new IllegalStateException ( " Cant modify " ) ; LOOK allow this for unlimited dimension updating
this . shape = new int [ dimensions . size ( ) ] ; for ( int i = 0 ; i < dimensions . size ( ) ; i ++ ) { Dimension dim = dimensions . get ( i ) ; shape [ i ] = dim . getLength ( ) ; // shape [ i ] = Math . max ( dim . getLength ( ) , 0 ) ; / / LOOK
// if ( dim . isUnlimited ( ) & & ( i ! = 0 ) ) / / LOOK only true for Netcdf - 3
// throw new IllegalArgumentException ( " Unlimited dimension must be outermost " ) ;
if ( dim . isVariableLength ( ) ) { // if ( dimensions . size ( ) ! = 1)
// throw new IllegalArgumentException ( " Unknown dimension can only be used in 1 dim array " ) ;
// else
isVariableLength = true ; } } this . shapeAsSection = null ; // recalc next time its asked for


signature:
public class Variable { /** * Set the dimensions using the dimensions names . The dimension is searched for recursively in the parent groups .
 * @ param dimString : whitespace separated list of dimension names , or ' * ' for Dimension . UNKNOWN , or number for anon dimension . null or empty String is a scalar . */
public void setDimensions ( String dimString ) { } }

implementation:
if ( immutable ) throw new IllegalStateException ( "Cant modify" ) ; try { setDimensions ( Dimension . makeDimensionsList ( getParentGroup ( ) , dimString ) ) ; // this . dimensions = Dimension . makeDimensionsList ( getParentGroup ( ) , dimString ) ;
resetShape ( ) ; } catch ( IllegalStateException e ) { throw new IllegalArgumentException ( "Variable " + getFullName ( ) + " setDimensions = '" + dimString + "' FAILED: " + e . getMessage ( ) + " file = " + getDatasetLocation ( ) ) ; }


signature:
public class Variable { /** * Reset the dimension array . Anonymous dimensions are left alone .
 * Shared dimensions are searched for recursively in the parent groups . */
public void resetDimensions ( ) { } }

implementation: if ( immutable ) throw new IllegalStateException ( "Cant modify" ) ; ArrayList < Dimension > newDimensions = new ArrayList < > ( ) ; for ( Dimension dim : dimensions ) { if ( dim . isShared ( ) ) { Dimension newD = getParentGroup ( ) . findDimension ( dim . getShortName ( ) ) ; if ( newD == null ) throw new IllegalArgumentException ( "Variable " + getFullName ( ) + " resetDimensions  FAILED, dim doesnt exist in parent group=" + dim ) ; newDimensions . add ( newD ) ; } else { newDimensions . add ( dim ) ; } } this . dimensions = newDimensions ; resetShape ( ) ;


signature:
public class Variable { /** * Set the dimensions using all anonymous ( unshared ) dimensions
 * @ param shape defines the dimension lengths . must be > 0 , or - 1 for VLEN
 * @ throws ucar . ma2 . InvalidRangeException if any shape < 1 */
public void setDimensionsAnonymous ( int [ ] shape ) throws InvalidRangeException { } }

implementation: if ( immutable ) throw new IllegalStateException ( "Cant modify" ) ; this . dimensions = new ArrayList < > ( ) ; for ( int i = 0 ; i < shape . length ; i ++ ) { if ( ( shape [ i ] < 1 ) && ( shape [ i ] != - 1 ) ) throw new InvalidRangeException ( "shape[" + i + "]=" + shape [ i ] + " must be > 0" ) ; Dimension anon ; if ( shape [ i ] == - 1 ) { anon = Dimension . VLEN ; isVariableLength = true ; } else { anon = new Dimension ( null , shape [ i ] , false , false , false ) ; } dimensions . add ( anon ) ; } resetShape ( ) ;


signature:
public class Variable { /** * Replace a dimension with an equivalent one .
 * @ param idx index into dimension array
 * @ param dim to set */
public void setDimension ( int idx , Dimension dim ) { } }

implementation: if ( immutable ) throw new IllegalStateException ( "Cant modify" ) ; dimensions . set ( idx , dim ) ; resetShape ( ) ;


signature:
public class Variable { /** * Will this Variable be cached when read .
 * Set externally , or calculated based on total size < sizeToCache .
 * This will always return { @ code false } if { @ link # permitCaching caching isn ' t permitted } .
 * @ return true is caching */
public boolean isCaching ( ) { } }

implementation: if ( ! permitCaching ) { return false ; } if ( ! this . cache . cachingSet ) { cache . isCaching = ! isVariableLength && ( getSize ( ) * getElementSize ( ) < getSizeToCache ( ) ) ; if ( debugCaching ) System . out . printf ( "  cache %s %s %d < %d%n" , getFullName ( ) , cache . isCaching , getSize ( ) * getElementSize ( ) , getSizeToCache ( ) ) ; this . cache . cachingSet = true ; } return cache . isCaching ;


signature:
public class Variable { /** * Set the data cache
 * @ param cacheData cache this Array
 * @ param isMetadata : synthesized data , set true if must be saved in NcML output ( ie data not actually in the file ) . */
public void setCachedData ( Array cacheData , boolean isMetadata ) { } }

implementation: if ( ( cacheData != null ) && ( cacheData . getElementType ( ) != getDataType ( ) . getPrimitiveClassType ( ) ) ) throw new IllegalArgumentException ( "setCachedData type=" + cacheData . getElementType ( ) + " incompatible with variable type=" + getDataType ( ) ) ; this . cache . data = cacheData ; this . isMetadata = isMetadata ; this . cache . cachingSet = true ; this . cache . isCaching = true ;


signature:
public class Variable { /** * Get list of Dimensions , including parents if any .
 * @ return array of Dimension , rank of v plus all parents . */
public List < Dimension > getDimensionsAll ( ) { } }

implementation: List < Dimension > dimsAll = new ArrayList < > ( ) ; addDimensionsAll ( dimsAll , this ) ; return dimsAll ;


signature:
public class Variable { /** * Calculate if this is a classic coordinate variable : has same name as its first dimension .
 * If type char , must be 2D , else must be 1D .
 * @ return true if a coordinate variable . */
public boolean isCoordinateVariable ( ) { } }

implementation:
if ( ( dataType == DataType . STRUCTURE ) || isMemberOfStructure ( ) ) // Structures and StructureMembers cant be coordinate variables
return false ; int n = getRank ( ) ; if ( n == 1 && dimensions . size ( ) == 1 ) { Dimension firstd = dimensions . get ( 0 ) ; if ( getShortName ( ) . equals ( firstd . getShortName ( ) ) ) { // : short names match
return true ; } } if ( n == 2 && dimensions . size ( ) == 2 ) { // two dimensional
Dimension firstd = dimensions . get ( 0 ) ; if ( shortName . equals ( firstd . getShortName ( ) ) && // short names match
( getDataType ( ) == DataType . CHAR ) ) { // must be char valued ( really a String )
return true ; } } return false ;


signature:
public class AbstractRadialAdapter { /** * you must set EarthLocation before you call this . */
protected void setBoundingBox ( ) { } }

implementation:
LatLonRect largestBB = null ; // look through all the coord systems
for ( Object o : csHash . values ( ) ) { RadialCoordSys sys = ( RadialCoordSys ) o ; sys . setOrigin ( origin ) ; LatLonRect bb = sys . getBoundingBox ( ) ; if ( largestBB == null ) largestBB = bb ; else if ( bb != null ) largestBB . extend ( bb ) ; } boundingBox = largestBB ;


signature:
public class FmrInv { /** * call after adding all runs */
void finish ( ) { } }

implementation:
gridList = new ArrayList < > ( uvHash . values ( ) ) ; Collections . sort ( gridList ) ; // find the common coordinates
for ( GridVariable grid : gridList ) { grid . finish ( ) ; } // assign sequence number for time
int seqno = 0 ; for ( TimeCoord tc : timeCoords ) tc . setId ( seqno ++ ) ; // assign sequence number for vertical coords with same name
HashMap < String , List < VertCoord > > map = new HashMap < > ( ) ; for ( VertCoord vc : vertCoords ) { List < VertCoord > list = map . get ( vc . getName ( ) ) ; if ( list == null ) { list = new ArrayList < > ( ) ; map . put ( vc . getName ( ) , list ) ; } list . add ( vc ) ; } for ( List < VertCoord > list : map . values ( ) ) { if ( list . size ( ) > 0 ) { int count = 0 ; for ( VertCoord vc : list ) { if ( count > 0 ) vc . setName ( vc . getName ( ) + count ) ; count ++ ; } } }


signature: public class CdmrfBeanOld { private void parseTemporalExtentForm ( ) { } }

implementation:
// from the form
if ( temporal == null ) { errs . format ( "form must have temporal=(all|range|point)%n" ) ; fatal = true ; return ; } if ( temporal . equalsIgnoreCase ( "all" ) ) temporalSelection = TemporalSelection . all ; else if ( temporal . equalsIgnoreCase ( "range" ) ) temporalSelection = TemporalSelection . range ; else if ( temporal . equalsIgnoreCase ( "point" ) ) temporalSelection = TemporalSelection . point ; if ( temporal . equalsIgnoreCase ( "range" ) ) { try { parseTimeExtent ( ) ; } catch ( Throwable t ) { errs . format ( "badly specified time range" ) ; fatal = true ; } } else if ( temporal . equalsIgnoreCase ( "point" ) ) { timePoint = parseDate ( "time" , time ) ; }


signature:
public class Catalog { /** * get all datasets contained directly in this catalog */
public Iterable < Dataset > getAllDatasets ( ) { } }

implementation: List < Dataset > all = new ArrayList < > ( ) ; addAll ( this , all ) ; return all ;


signature:
public class SynDSP { /** * A path is a Synthetic path if it ends in . dmr or . syn
 * @ param path
 * @ param context Any parameters that may help to decide .
 * @ return true if this path appears to be processible by this DSP */
public boolean dspMatch ( String path , DapContext context ) { } }

implementation: for ( String ext : SYNEXTENSIONS ) { if ( path . endsWith ( ext ) ) return true ; } return false ;


signature:
public class CDMDSP { /** * Provide an extra API for use in testing
 * @ param ncd
 * @ return
 * @ throws DapException */
public CDMDSP open ( NetcdfDataset ncd ) throws DapException { } }

implementation: assert this . context != null ; this . dmrfactory = new DMRFactory ( ) ; this . ncdfile = ncd ; setLocation ( this . ncdfile . getLocation ( ) ) ; buildDMR ( ) ; return this ;


signature:
public class CDMDSP { /** * Track generic CDMNode < - > DapNode */
protected void recordNode ( CDMNode cdm , DapNode dap ) { } }

implementation: assert this . nodemap . get ( cdm ) == null && this . nodemap . get ( dap ) == null ; this . nodemap . put ( cdm , dap ) ;


signature:
public class CDMDSP { /** * Track Variable < - > DapVariable */
protected void recordVar ( Variable cdm , DapVariable dap ) { } }

implementation: cdm = CDMUtil . unwrap ( cdm ) ; assert varmap . get ( cdm ) == null && varmap . get ( dap ) == null ; varmap . put ( cdm , dap ) ;


signature:
public class CDMDSP { /** * Track Variable < - > DapStructure */
protected void recordStruct ( Variable cdm , DapStructure dap ) { } }

implementation: cdm = CDMUtil . unwrap ( cdm ) ; assert this . nodemap . get ( cdm ) == null && this . nodemap . get ( dap ) == null ; compoundmap . put ( cdm , dap ) ;


signature:
public class CDMDSP { /** * Track Variable < - > DapSequence */
protected void recordSeq ( Variable cdm , DapSequence dap ) { } }

implementation: cdm = CDMUtil . unwrap ( cdm ) ; assert this . vlenmap . get ( cdm ) == null && this . vlenmap . get ( dap ) == null ; vlenmap . put ( cdm , dap ) ;


signature:
public class CDMDSP { /** * Extract the metadata from the NetcdfDataset
 * and build the DMR . */
public void buildDMR ( ) throws DapException { } }

implementation:
if ( getDMR ( ) != null ) return ; try { if ( DUMPCDL ) { System . out . println ( "writecdl:" ) ; this . ncdfile . writeCDL ( System . out , false ) ; System . out . flush ( ) ; } // Use the file path to define the dataset name
String name = this . ncdfile . getLocation ( ) ; // Normalize the name
name = DapUtil . canonicalpath ( name ) ; // Remove any path prefix
int index = name . lastIndexOf ( '/' ) ; if ( index >= 0 ) name = name . substring ( index + 1 , name . length ( ) ) ; // Initialize the root dataset node
setDMR ( ( DapDataset ) dmrfactory . newDataset ( name ) . annotate ( NetcdfDataset . class , this . ncdfile ) ) ; // Map the CDM root group to this group
recordNode ( this . ncdfile . getRootGroup ( ) , getDMR ( ) ) ; getDMR ( ) . setBase ( DapUtil . canonicalpath ( this . ncdfile . getLocation ( ) ) ) ; // Now recursively build the tree . Start by
// Filling the dataset with the contents of the ncfile
// root group .
fillgroup ( getDMR ( ) , this . ncdfile . getRootGroup ( ) ) ; // Add an order index to the tree
getDMR ( ) . sort ( ) ; // Now locate the coordinate variables for maps
/* Walk looking for VariableDS instances */
processmappedvariables ( this . ncdfile . getRootGroup ( ) ) ; // Now set the view
getDMR ( ) . finish ( ) ; } catch ( DapException e ) { setDMR ( null ) ; throw new DapException ( e ) ; }