@@ -396,6 +396,10 @@ public ucar.ma2.Array read(final long[] offset, final long[] shape, final boolea
396396
397397 final ucar .ma2 .Array outputArray = ucar .ma2 .Array .factory (metadata .dataType ().getMA2DataType (),
398398 Utils .toIntArray (shape ));
399+ final Object parsedFillValue = metadata .parsedFillValue ();
400+ if (parsedFillValue != null ) {
401+ MultiArrayUtils .fill (outputArray , parsedFillValue );
402+ }
399403 Stream <long []> chunkStream = Arrays .stream (IndexingUtils .computeChunkCoords (metadata .shape , chunkShape , offset , shape ));
400404 if (parallel ) {
401405 chunkStream = chunkStream .parallel ();
@@ -408,17 +412,13 @@ public ucar.ma2.Array read(final long[] offset, final long[] shape, final boolea
408412 shape
409413 );
410414
411- if (chunkIsInArray (chunkCoords )) {
412- MultiArrayUtils .copyRegion (metadata .allocateFillValueChunk (),
413- chunkProjection .chunkOffset , outputArray , chunkProjection .outOffset ,
414- chunkProjection .shape
415- );
416- }
417-
418415 final String [] chunkKeys = metadata .chunkKeyEncoding ().encodeChunkKey (chunkCoords );
419416 final StoreHandle chunkHandle = storeHandle .resolve (chunkKeys );
420417
421418 if (codecPipeline .supportsPartialDecode ()) {
419+ if (!chunkHandle .exists ()) {
420+ return ;
421+ }
422422 final ucar .ma2 .Array chunkArray = codecPipeline .decodePartial (chunkHandle ,
423423 Utils .toLongArray (chunkProjection .chunkOffset ), chunkProjection .shape );
424424 MultiArrayUtils .copyRegion (chunkArray , new int [metadata .ndim ()], outputArray ,
0 commit comments