public static String getSubsetString ( Variable var , int beginInd , int endInd , int id ) { if ( var == null ) return null ; String subStr = "" ; List < Dimension > dimList = var . getDimensions ( ) ; // Enforce two dimension arrays if ( dimList . size ( ) > 2 || dimList . size ( ) < 1 ) { return null ; } for ( int i = 0 ; i < dimList . size ( ) ; i ++ ) { Dimension dim = dimList . get ( i ) ; if ( dim == null ) continue ; // If not CF Time then select only that ID if ( ! CF . TIME . equalsIgnoreCase ( dim . getShortName ( ) ) && ! CF . TIME . equalsIgnoreCase ( dim . getFullNameEscaped ( ) ) ) { subStr += id ; } // Otherwise subset based on time else { if ( beginInd < 0 || endInd < 0 ) subStr += ":" ; else subStr += ( beginInd + ":" + endInd ) ; } if ( i < dimList . size ( ) - 1 ) { subStr += "," ; } } return subStr ; }
Gets the subset string to be used in NetCDFFile . read given a variable and some indicies . useful for subsetting timeseries