@@ -206,6 +206,7 @@ void compute(Configuration config, NetcdfFile reader, NetcdfFileWriter writer) t
206206 final int numMatches = NetCDFUtils .getDimensionLength (FiduceoConstants .MATCHUP_COUNT , reader );
207207 final int [] nwpShape = getNwpShape (geoDimension , lonArray .getShape ());
208208 final int [] nwpOffset = getNwpOffset (lonArray .getShape (), nwpShape );
209+ final int [] nwpStride = {1 , 1 , 1 };
209210 final HashMap <String , Array > targetArrays = allocateTargetData (writer , variables );
210211
211212 // iterate over matchups
@@ -214,10 +215,11 @@ void compute(Configuration config, NetcdfFile reader, NetcdfFileWriter writer) t
214215 final Index timeIndex = era5TimeArray .getIndex ();
215216 for (int m = 0 ; m < numMatches ; m ++) {
216217 nwpOffset [0 ] = m ;
217- nwpShape [0 ] = 1 ; // we read matchups layer by layer
218+ nwpShape [0 ] = 1 ;
218219
219- final Array lonLayer = lonArray .section (nwpOffset , nwpShape ).reduce ();
220- final Array latLayer = latArray .section (nwpOffset , nwpShape ).reduce ();
220+ // get a subset of one matchup layer and convert to 2D dataset
221+ final Array lonLayer = lonArray .sectionNoReduce (nwpOffset , nwpShape , nwpStride ).reduce (0 );
222+ final Array latLayer = latArray .sectionNoReduce (nwpOffset , nwpShape , nwpStride ).reduce (0 );
221223
222224 final int [] shape = lonLayer .getShape ();
223225 final int width = shape [1 ];
0 commit comments