/** * @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 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(); }
@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); }
/** * @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); }
chunking = new Nc4ChunkingStrategyGrib(5, true);
chunking = new Nc4ChunkingStrategyGrib(5, true);
chunking = new Nc4ChunkingStrategyGrib(5, true);
chunking = new Nc4ChunkingStrategyGrib(5, true);