Skip to content

Commit

Permalink
Write missing OSCAR values as null rather than "NaN", because it is m…
Browse files Browse the repository at this point in the history
…ore compact.
  • Loading branch information
cambecc committed Jan 23, 2014
1 parent f02729e commit 7b53726
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import ucar.ma2.*;
import ucar.nc2.Variable;

import javax.json.JsonValue;
import javax.json.stream.JsonGenerator;
import java.io.IOException;

Expand Down Expand Up @@ -139,7 +140,7 @@ private void writeData() throws IOException {
IndexIterator ii = data.getIndexIterator();
while (ii.hasNext()) {
float value = ii.getFloatNext();
jg.write(new FloatValue(Float.isNaN(value) ? value : round(value, 50)));
jg.write(Float.isNaN(value) ? JsonValue.NULL : new FloatValue(round(value, 50)));
}
jg.writeEnd();
}
Expand Down

0 comments on commit 7b53726

Please sign in to comment.