public Array convertTopVariable ( ucar . nc2 . Variable v , List < Range > section , DodsV dataV ) throws IOException , DAP2Exception { Array data = convert ( dataV ) ; // arrays if ( ( dataV . darray != null ) && ( dataV . bt instanceof DString ) ) { if ( v . getDataType ( ) == DataType . STRING ) return convertStringArray ( data , v ) ; else if ( v . getDataType ( ) == DataType . CHAR ) return convertStringArrayToChar ( dataV . darray , v , section ) ; else { String mess = "DODSVariable convertArray String invalid dataType= " + v . getDataType ( ) ; logger . error ( mess ) ; throw new IllegalArgumentException ( mess ) ; } } if ( ( dataV . bt instanceof DString ) && ( v . getDataType ( ) == DataType . CHAR ) ) { // special case: convert String back to CHAR return convertStringToChar ( data , v ) ; } return data ; /* else { // the DGrid case comes here also // create the array, using DODS internal array so there's no copying dods.dap.PrimitiveVector pv = dataV.darray.getPrimitiveVector(); Object storage = pv.getInternalStorage(); //storage = widenArray( pv, storage); // LOOK data conversion if needed int[] shape = (section == null) ? v.getShape() : Range.getShape(section); return Array.factory( v.getDataType().getPrimitiveClassType(), shape, storage); } */ }
Convert a DataDDS into an Array for a top level variable ie not a Structure member variable .