@Test void TiffDataWriterWritesDssFile(){ String inFile = new File(getClass().getResource( "/normalizer/qpe.dss").getFile()).toString(); String variableName = " DataReader reader = DataReader.builder() .path(inFile) .variable(variableName) .build(); List<VortexData> dtos = new ArrayList<>(reader.getDtos()); Path destination = Paths.get("C:/Temp/.tiff"); DataWriter writer = DataWriter.builder() .destination(destination) .data(dtos) .build(); writer.write(); }
@Override public void write() { List<VortexGrid> grids = data.stream() .filter(vortexData -> vortexData instanceof VortexGrid) .map(vortexData -> (VortexGrid) vortexData) .collect(Collectors.toList()); grids.forEach(grid -> { Dataset dataset = RasterUtils.getDatasetFromVortexGrid(grid); ArrayList<String> gdalOptions = new ArrayList<>(); gdalOptions.add("-of"); gdalOptions.add("Gtiff"); gdalOptions.add("-ot"); gdalOptions.add("Float32"); gdalOptions.add("-co"); gdalOptions.add("TILED=YES"); gdalOptions.add("-co"); gdalOptions.add("COMPRESS=DEFLATE"); gdalOptions.add("-co"); gdalOptions.add("ZLEVEL=1"); gdalOptions.add("-co"); gdalOptions.add("BIGTIFF=YES"); TranslateOptions translateOptions = new TranslateOptions(new Vector<>(gdalOptions)); Dataset out = gdal.Translate(destination.toString(), dataset, translateOptions); out.FlushCache(); out.delete(); }); }
TiffDataWriter extends DataWriter { @Override public void write() { List<VortexGrid> grids = data.stream() .filter(vortexData -> vortexData instanceof VortexGrid) .map(vortexData -> (VortexGrid) vortexData) .collect(Collectors.toList()); grids.forEach(grid -> { Dataset dataset = RasterUtils.getDatasetFromVortexGrid(grid); ArrayList<String> gdalOptions = new ArrayList<>(); gdalOptions.add("-of"); gdalOptions.add("Gtiff"); gdalOptions.add("-ot"); gdalOptions.add("Float32"); gdalOptions.add("-co"); gdalOptions.add("TILED=YES"); gdalOptions.add("-co"); gdalOptions.add("COMPRESS=DEFLATE"); gdalOptions.add("-co"); gdalOptions.add("ZLEVEL=1"); gdalOptions.add("-co"); gdalOptions.add("BIGTIFF=YES"); TranslateOptions translateOptions = new TranslateOptions(new Vector<>(gdalOptions)); Dataset out = gdal.Translate(destination.toString(), dataset, translateOptions); out.FlushCache(); out.delete(); }); } }
TiffDataWriter extends DataWriter { @Override public void write() { List<VortexGrid> grids = data.stream() .filter(vortexData -> vortexData instanceof VortexGrid) .map(vortexData -> (VortexGrid) vortexData) .collect(Collectors.toList()); grids.forEach(grid -> { Dataset dataset = RasterUtils.getDatasetFromVortexGrid(grid); ArrayList<String> gdalOptions = new ArrayList<>(); gdalOptions.add("-of"); gdalOptions.add("Gtiff"); gdalOptions.add("-ot"); gdalOptions.add("Float32"); gdalOptions.add("-co"); gdalOptions.add("TILED=YES"); gdalOptions.add("-co"); gdalOptions.add("COMPRESS=DEFLATE"); gdalOptions.add("-co"); gdalOptions.add("ZLEVEL=1"); gdalOptions.add("-co"); gdalOptions.add("BIGTIFF=YES"); TranslateOptions translateOptions = new TranslateOptions(new Vector<>(gdalOptions)); Dataset out = gdal.Translate(destination.toString(), dataset, translateOptions); out.FlushCache(); out.delete(); }); } TiffDataWriter(DataWriterBuilder builder); }
TiffDataWriter extends DataWriter { @Override public void write() { List<VortexGrid> grids = data.stream() .filter(vortexData -> vortexData instanceof VortexGrid) .map(vortexData -> (VortexGrid) vortexData) .collect(Collectors.toList()); grids.forEach(grid -> { Dataset dataset = RasterUtils.getDatasetFromVortexGrid(grid); ArrayList<String> gdalOptions = new ArrayList<>(); gdalOptions.add("-of"); gdalOptions.add("Gtiff"); gdalOptions.add("-ot"); gdalOptions.add("Float32"); gdalOptions.add("-co"); gdalOptions.add("TILED=YES"); gdalOptions.add("-co"); gdalOptions.add("COMPRESS=DEFLATE"); gdalOptions.add("-co"); gdalOptions.add("ZLEVEL=1"); gdalOptions.add("-co"); gdalOptions.add("BIGTIFF=YES"); TranslateOptions translateOptions = new TranslateOptions(new Vector<>(gdalOptions)); Dataset out = gdal.Translate(destination.toString(), dataset, translateOptions); out.FlushCache(); out.delete(); }); } TiffDataWriter(DataWriterBuilder builder); @Override void write(); }
TiffDataWriter extends DataWriter { @Override public void write() { List<VortexGrid> grids = data.stream() .filter(vortexData -> vortexData instanceof VortexGrid) .map(vortexData -> (VortexGrid) vortexData) .collect(Collectors.toList()); grids.forEach(grid -> { Dataset dataset = RasterUtils.getDatasetFromVortexGrid(grid); ArrayList<String> gdalOptions = new ArrayList<>(); gdalOptions.add("-of"); gdalOptions.add("Gtiff"); gdalOptions.add("-ot"); gdalOptions.add("Float32"); gdalOptions.add("-co"); gdalOptions.add("TILED=YES"); gdalOptions.add("-co"); gdalOptions.add("COMPRESS=DEFLATE"); gdalOptions.add("-co"); gdalOptions.add("ZLEVEL=1"); gdalOptions.add("-co"); gdalOptions.add("BIGTIFF=YES"); TranslateOptions translateOptions = new TranslateOptions(new Vector<>(gdalOptions)); Dataset out = gdal.Translate(destination.toString(), dataset, translateOptions); out.FlushCache(); out.delete(); }); } TiffDataWriter(DataWriterBuilder builder); @Override void write();  }