public CFPointWriterConfig(NetcdfFileWriter.Version version) { this(version, new Nc4ChunkingDefault()); // The default chunker used in Nc4Iosp. }
public Nc4Chunking getNc4Chunking() { return Nc4ChunkingStrategy.factory(strategy, deflateLevel, shuffle); }
/** * @param type Strategy type * @param deflateLevel 0 corresponds to no compression and 9 to maximum compression, * @param shuffle true to turn shuffling on which may improve compression. This option is ignored unless a non-zero deflation level is specified. * @return Nc4Chunking implementation */ public static Nc4Chunking factory(Strategy type, int deflateLevel, boolean shuffle) { switch (type) { case standard: return new Nc4ChunkingDefault(deflateLevel, shuffle); case grib: return new Nc4ChunkingStrategyGrib(deflateLevel, shuffle); case none: return new Nc4ChunkingStrategyNone(); } throw new IllegalArgumentException("Illegal Nc4Chunking.Standard " + type); }
@Override public long[] computeChunking(Variable v) { // check attribute int[] resultFromAtt = computeChunkingFromAttribute(v); if (resultFromAtt != null) return convertToLong(resultFromAtt); // no unlimited dimensions if (!v.isUnlimited()) { int[] result = computeChunkingGrib(v); return convertToLong(result); } // unlimited case if (v.getRank() >= 2) { long varSize = v.getSize() * v.getElementSize(); if (varSize > getMinVariableSize()) // getMinVariableSize or getMinChunksize ?? return convertToLong(computeChunkingGrib(v)); } // small unlimited variable int[] result = computeUnlimitedChunking(v.getDimensions(), v.getElementSize()); return convertToLong(result); }
@Override public long[] computeChunking(Variable v) { // check attribute int[] resultFromAtt = computeChunkingFromAttribute(v); if (resultFromAtt != null) return convertToLong(resultFromAtt); int maxElements = defaultChunkSize / v.getElementSize(); // no unlimited dimensions if (!v.isUnlimited()) { int[] result = fillRightmost(v.getShape(), maxElements); return convertToLong(result); } // unlimited case int[] result = computeUnlimitedChunking(v.getDimensions(), v.getElementSize()); return convertToLong(result); }
@Override public long[] computeChunking(Variable v) { /* check attribute int[] resultFromAtt = computeChunkingFromAttribute(v); if (resultFromAtt != null) return convertToLong(resultFromAtt); */ int maxElements = defaultChunkSize / v.getElementSize(); // no unlimited dimensions if (!v.isUnlimited()) { int[] result = fillRightmost(v.getShape(), maxElements); return convertToLong(result); } // unlimited case int[] result = computeUnlimitedChunking(v.getDimensions(), v.getElementSize()); return convertToLong(result); }
public int[] computeUnlimitedChunking(List<Dimension> dims, int elemSize) { int maxElements = defaultChunkSize / elemSize; int[] result = fillRightmost(convertUnlimitedShape(dims), maxElements); long resultSize = new Section(result).computeSize(); if (resultSize < minChunksize) { maxElements = minChunksize / elemSize; result = incrUnlimitedShape(dims, result, maxElements); } return result; }
@Override public boolean isChunked(Variable v) { if (v.isUnlimited()) return true; if (getChunkAttribute(v) != null) return true; int n = v.getRank(); return n >= 2 && v.getSize() * v.getElementSize() > getMinVariableSize(); }
@Override public boolean isChunked(Variable v) { if (v.isUnlimited()) return true; // if (getChunkAttribute(v) != null) return true; int n = v.getRank(); return n >= 2 && v.getSize() * v.getElementSize() > getMinVariableSize(); }
public CommandLine(String progName, String[] args) throws ParameterException { this.jc = new JCommander(this, args); // Parses args and uses them to initialize *this*. jc.setProgramName(progName); // Displayed in the usage information. // Set the ordering of of parameters in the usage information. jc.setParameterDescriptionComparator(new ParameterDescriptionComparator()); }
@Override public boolean isChunked(Variable v) { if (v.isUnlimited()) return true; if (getChunkAttribute(v) != null) return true; long size = v.getSize() * v.getElementSize(); return (size > minVariableSize); }
@Test public void testCloseNc4inDefineMode() throws IOException { String location = "/some/non/existent/file.nc4"; // We won't actually be creating this, so path doesn't matter. Nc4Chunking chunking = Nc4ChunkingDefault.factory(Nc4Chunking.Strategy.standard, 5, true); // Should be able to open and close file without an exception. Would fail before the bug fix in this commit. try (NetcdfFileWriter writer = NetcdfFileWriter.createNew(NetcdfFileWriter.Version.netcdf4, location, chunking)) {} } }
public Nc4Chunking getNc4Chunking() { return Nc4ChunkingStrategy.factory(strategy, deflateLevel, shuffle); }
/** * @param type Strategy type * @param deflateLevel 0 corresponds to no compression and 9 to maximum compression, * @param shuffle true to turn shuffling on which may improve compression. This option is ignored unless a non-zero deflation level is specified. * @return Nc4Chunking implementation */ public static Nc4Chunking factory(Strategy type, int deflateLevel, boolean shuffle) { switch (type) { case standard: return new Nc4ChunkingDefault(deflateLevel, shuffle); case grib: return new Nc4ChunkingStrategyGrib(deflateLevel, shuffle); case none: return new Nc4ChunkingStrategyNone(); } throw new IllegalArgumentException("Illegal Nc4Chunking.Standard " + type); }
@Override public long[] computeChunking(Variable v) { /* check attribute int[] resultFromAtt = computeChunkingFromAttribute(v); if (resultFromAtt != null) return convertToLong(resultFromAtt); */ // no unlimited dimensions if (!v.isUnlimited()) { int[] result = computeChunkingGrib(v); return convertToLong(result); } // unlimited case if (v.getRank() >= 2) { long varSize = v.getSize() * v.getElementSize(); if (varSize > getMinVariableSize()) // getMinVariableSize or getMinChunksize ?? return convertToLong(computeChunkingGrib(v)); } // small unlimited variable int[] result = computeUnlimitedChunking(v.getDimensions(), v.getElementSize()); return convertToLong(result); }
public int[] computeUnlimitedChunking(List<Dimension> dims, int elemSize) { int maxElements = defaultChunkSize / elemSize; int[] result = fillRightmost(convertUnlimitedShape(dims), maxElements); long resultSize = new Section(result).computeSize(); if (resultSize < minChunksize) { maxElements = minChunksize / elemSize; result = incrUnlimitedShape(dims, result, maxElements); } return result; }
public CFPointWriterConfig(NetcdfFileWriter.Version version) { this(version, new Nc4ChunkingDefault()); // The default chunker used in Nc4Iosp. }
public Nc4Chunking getNc4Chunking() { return Nc4ChunkingStrategy.factory(strategy, deflateLevel, shuffle); }
public Grib2NetcdfWriter(String fileIn, String fileOut) throws IOException { this.fileIn = fileIn; Nc4Chunking chunker = Nc4ChunkingStrategy.factory(Nc4ChunkingStrategy.Strategy.grib, 9, true); writer = NetcdfFileWriter.createNew(NetcdfFileWriter.Version.netcdf4, fileOut, chunker); }
public void testDean() throws IOException { Nc4Chunking chunkingStrategy = Nc4ChunkingStrategy.factory(Nc4Chunking.Strategy.standard, 6, false); NetcdfFileWriter ncSubsetFile = NetcdfFileWriter.createNew(NetcdfFileWriter.Version.netcdf4, "C:/tmp/test.nc4", chunkingStrategy); }