private void readXY ( Variable v2 , int ensIdx , int timeIdx , int levIdx , Range yRange , Range xRange , IndexIterator ii ) throws IOException , InvalidRangeException { GridVariable pv = ( GridVariable ) v2 . getSPobject ( ) ; GridHorizCoordSys hsys = pv . getHorizCoordSys ( ) ; int nx = hsys . getNx ( ) ; GridRecord record = pv . findRecord ( ensIdx , timeIdx , levIdx ) ; if ( record == null ) { Attribute att = v2 . findAttribute ( "missing_value" ) ; float missing_value = ( att == null ) ? - 9999.0f : att . getNumericValue ( ) . floatValue ( ) ; int xyCount = yRange . length ( ) * xRange . length ( ) ; for ( int j = 0 ; j < xyCount ; j ++ ) { ii . setFloatNext ( missing_value ) ; } return ; } // otherwise read it float [ ] data = _readData ( record ) ; if ( data == null ) { _readData ( record ) ; // debug return ; } // LOOK can improve with System.copy ?? for ( int y : yRange ) { for ( int x : xRange ) { int index = y * nx + x ; ii . setFloatNext ( data [ index ] ) ; } } }
read one YX array