totalBytes = CFGridWriter2.writeFile(gds, null, null, null, 1, null, null, 1, true, writer); } catch (Throwable e) { e.printStackTrace();
totalBytes = CFGridWriter2.writeFile(gds, null, null, null, 1, null, null, 1, true, writer); } catch (Throwable e) { e.printStackTrace();
@Test public void testNullLatLonRect() throws IOException { String location = tempFolder.newFile().getAbsolutePath(); List<String> gridList = new ArrayList<>(); gridList.add("Temperature_surface"); int stride_time = 1; int horizStride = 1; try { NetcdfFileWriter ncwriter = NetcdfFileWriter.createNew(NetcdfFileWriter.Version.netcdf3, location); CFGridWriter2.writeFile(gds, gridList, null, null, horizStride, null, null, stride_time, false, ncwriter); assert true; } catch (Exception exc) { exc.printStackTrace(); assert false; } }
totalBytes = CFGridWriter2.writeFile(gds, null, null, null, 1, null, null, 1, false, writer); totalBytes /= 1000 * 1000; } catch (Throwable e) {
@Test public void testNullHorizSubset2() throws IOException, InvalidRangeException { boolean addLatLon = false; LatLonRect llbb = null; Range zRange = null; CalendarDateRange dateRange = null; List<String> gridList = new ArrayList<>(); gridList.add("Temperature_surface"); int stride_time = 1; int horizStride = 1; File outFile = tempFolder.newFile(); NetcdfFileWriter writer = NetcdfFileWriter.createNew(NetcdfFileWriter.Version.netcdf3, outFile.getAbsolutePath()); CFGridWriter2.writeFile(gds, gridList, null, null, horizStride, zRange, dateRange, stride_time, addLatLon, writer); assert outFile.exists(); try ( GridDataset result = ucar.nc2.dt.grid.GridDataset.open(outFile.getAbsolutePath())) { System.out.printf("result = %s%n", result.getLocation()); } }
@Test public void testSubset() throws Exception { String fileIn = TestDir.cdmUnitTestDir + "ft/grid/testCFwriter.nc"; String fileOut = tempFolder.newFile().getAbsolutePath(); String varName = "Temperature"; try (ucar.nc2.dt.grid.GridDataset gds = GridDataset.open(fileIn)) { List<String> gridList = new ArrayList<>(); gridList.add(varName); NetcdfFileWriter writer = NetcdfFileWriter.createNew(NetcdfFileWriter.Version.netcdf3, fileOut); CFGridWriter2.writeFile(gds, gridList, new LatLonRect(new LatLonPointImpl(30, -109), 10, 50), null, 1, null, null, 1, true, writer); } try (ucar.nc2.dt.grid.GridDataset result = GridDataset.open(fileOut)) { GeoGrid grid = result.findGridByName(varName); assertTrue(grid != null); } }
subsetSize = CFGridWriter2.writeFile(dataset, gridList, null, rect, 1, null, dateRange, 1, false, writer); System.out.printf(" subset size %s only = %d%n", gridNames, subsetSize);