static public VarAtt findVariableWithAttribute ( NetcdfDataset ds , String attName ) { for ( Variable v : ds . getVariables ( ) ) { Attribute att = v . findAttributeIgnoreCase ( attName ) ; if ( att != null ) return new VarAtt ( v , att ) ; } // descend into structures for ( Variable v : ds . getVariables ( ) ) { if ( v instanceof Structure ) { Structure s = ( Structure ) v ; for ( Variable vs : s . getVariables ( ) ) { Attribute att = vs . findAttributeIgnoreCase ( attName ) ; if ( att != null ) return new VarAtt ( vs , att ) ; } } } return null ; }
Find first variable with given attribute name