Skip to content

Commit 664ebeb

Browse files
author
haileyajohnson
committed
finish tests; fix f order; implement nested store
1 parent a53f436 commit 664ebeb

392 files changed

Lines changed: 656 additions & 329 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cdm/core/src/main/java/ucar/nc2/iosp/IospHelper.java

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,9 @@ public static Object readData(LayoutBB layout, DataType dataType, Object arr) {
306306
while (layout.hasNext()) {
307307
LayoutBB.Chunk chunk = layout.next();
308308
ByteBuffer bb = chunk.getByteBuffer();
309+
if (!bb.hasRemaining()) {
310+
continue;
311+
}
309312
bb.position(chunk.getSrcElem());
310313
int pos = (int) chunk.getDestElem();
311314
for (int i = 0; i < chunk.getNelems(); i++)
@@ -314,18 +317,19 @@ public static Object readData(LayoutBB layout, DataType dataType, Object arr) {
314317
// return (dataType == DataType.CHAR) ? convertByteToChar(pa) : pa;
315318
if (dataType == DataType.CHAR) {
316319
return convertByteToChar(pa);
317-
}
318-
else if (dataType == DataType.BOOLEAN) {
320+
} else if (dataType == DataType.BOOLEAN) {
319321
return convertByteToBoolean(pa);
320-
}
321-
else
322+
} else
322323
return pa;
323324

324325
} else if (dataType.getPrimitiveClassType() == short.class) {
325326
short[] pa = (short[]) arr;
326327
while (layout.hasNext()) {
327328
LayoutBB.Chunk chunk = layout.next();
328329
ShortBuffer buff = chunk.getShortBuffer();
330+
if (!buff.hasRemaining()) {
331+
continue;
332+
}
329333
buff.position(chunk.getSrcElem());
330334
int pos = (int) chunk.getDestElem();
331335
for (int i = 0; i < chunk.getNelems(); i++)
@@ -338,6 +342,9 @@ else if (dataType == DataType.BOOLEAN) {
338342
while (layout.hasNext()) {
339343
LayoutBB.Chunk chunk = layout.next();
340344
IntBuffer buff = chunk.getIntBuffer();
345+
if (!buff.hasRemaining()) {
346+
continue;
347+
}
341348
buff.position(chunk.getSrcElem());
342349
int pos = (int) chunk.getDestElem();
343350
for (int i = 0; i < chunk.getNelems(); i++)
@@ -350,6 +357,9 @@ else if (dataType == DataType.BOOLEAN) {
350357
while (layout.hasNext()) {
351358
LayoutBB.Chunk chunk = layout.next();
352359
FloatBuffer buff = chunk.getFloatBuffer();
360+
if (!buff.hasRemaining()) {
361+
continue;
362+
}
353363
buff.position(chunk.getSrcElem());
354364
int pos = (int) chunk.getDestElem();
355365
for (int i = 0; i < chunk.getNelems(); i++)
@@ -362,6 +372,9 @@ else if (dataType == DataType.BOOLEAN) {
362372
while (layout.hasNext()) {
363373
LayoutBB.Chunk chunk = layout.next();
364374
DoubleBuffer buff = chunk.getDoubleBuffer();
375+
if (!buff.hasRemaining()) {
376+
continue;
377+
}
365378
buff.position(chunk.getSrcElem());
366379
int pos = (int) chunk.getDestElem();
367380
for (int i = 0; i < chunk.getNelems(); i++)
@@ -374,6 +387,9 @@ else if (dataType == DataType.BOOLEAN) {
374387
while (layout.hasNext()) {
375388
LayoutBB.Chunk chunk = layout.next();
376389
LongBuffer buff = chunk.getLongBuffer();
390+
if (!buff.hasRemaining()) {
391+
continue;
392+
}
377393
buff.position(chunk.getSrcElem());
378394
int pos = (int) chunk.getDestElem();
379395
for (int i = 0; i < chunk.getNelems(); i++)
@@ -387,6 +403,9 @@ else if (dataType == DataType.BOOLEAN) {
387403
while (layout.hasNext()) {
388404
LayoutBB.Chunk chunk = layout.next();
389405
ByteBuffer bb = chunk.getByteBuffer();
406+
if (!bb.hasRemaining()) {
407+
continue;
408+
}
390409
bb.position(chunk.getSrcElem() * recsize);
391410
int pos = (int) chunk.getDestElem() * recsize;
392411
for (int i = 0; i < chunk.getNelems() * recsize; i++)
@@ -399,12 +418,15 @@ else if (dataType == DataType.BOOLEAN) {
399418
while (layout.hasNext()) {
400419
LayoutBB.Chunk chunk = layout.next();
401420
ByteBuffer bb = chunk.getByteBuffer();
421+
if (!bb.hasRemaining()) {
422+
continue;
423+
}
402424
bb.position(chunk.getSrcElem() * recsize);
403425
int pos = (int) chunk.getDestElem();
404426
for (int i = 0; i < chunk.getNelems(); i++) {
405427
char[] ch = new char[dataType.getSize()];
406-
for ( int j = 0; j < ch.length; j++) {
407-
ch[j] = (char)bb.get();
428+
for (int j = 0; j < ch.length; j++) {
429+
ch[j] = (char) bb.get();
408430
}
409431
pa[pos++] = new String(ch);
410432
}

cdm/zarr/src/main/java/ucar/nc2/iosp/zarr/ZArray.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public ZArray deserialize(JsonParser p, DeserializationContext ctxt) throws IOEx
181181
fill = fillValueNode.longValue();
182182
} else if (fillValueNode.isFloat()) {
183183
fill = fillValueNode.floatValue();
184-
} else if (fillValueNode.isNumber()){
184+
} else if (fillValueNode.isNumber()) {
185185
fill = fillValueNode.asDouble();
186186
} else {
187187
fill = fillValueNode.asText("");

cdm/zarr/src/main/java/ucar/nc2/iosp/zarr/ZarrFormatException.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ public ZarrFormatException(String invalidField, String value) {
1919
super(String.format(customExceptionMessageFormat, invalidField, value));
2020
}
2121

22+
public ZarrFormatException(String msg) {
23+
super(msg);
24+
}
2225
}

0 commit comments

Comments
 (0)