public NetcdfFile open(DatasetUrl location, int buffer_size, CancelTask cancelTask, Object iospMessage) throws IOException { return openFile(location, buffer_size, cancelTask, iospMessage); } }
public NetcdfFile open(String location, int buffer_size, CancelTask cancelTask, Object iospMessage) throws IOException { return openFile(location, buffer_size, cancelTask, iospMessage); } }
public NetcdfFile open(String location, int buffer_size, CancelTask cancelTask, Object iospMessage) throws IOException { return openFile(location, buffer_size, cancelTask, iospMessage); } }
NetcdfFile ncFile = NetcdfDataset.openFile(gribFile.getAbsolutePath(), null);
public FileCacheable open(DatasetUrl location, int buffer_size, CancelTask cancelTask, Object iospMessage) throws IOException { return NetcdfDataset.openFile(location, buffer_size, cancelTask, iospMessage); } }
@Override public int doAct(String filename) throws IOException { System.out.println("read file= "+filename); try (NetcdfFile ncfile = NetcdfDataset.openFile( filename, null)) { return 1; } } }
public static void main(String args[]) throws Exception { //String fileIn = "C:/data/bufr/edition3/newIdd/IcingTropopause/IcingTropopause_20080529_0000.bufr"; String fileIn = "C:\\data\\bufr\\edition3\\meteosat\\METEOSAT7-MVIRI-MTPHRWW-NA-1-20080405123005.000000000Z-909326.bfr "; NetcdfFile ncf = NetcdfDataset.openFile(fileIn, null); System.out.println(ncf.toString()); new Write2ncRect(ncf, "C:/data/bufr2nc.meteosat.nc", true); }
public static void main(String args[]) throws Exception { //String fileIn = "C:/data/bufr/edition3/newIdd/IcingTropopause/IcingTropopause_20080529_0000.bufr"; String fileIn = "C:\\data\\bufr\\edition3\\meteosat\\METEOSAT7-MVIRI-MTPHRWW-NA-1-20080405123005.000000000Z-909326.bfr "; try (NetcdfFile ncf = NetcdfDataset.openFile(fileIn, null)) { System.out.println(ncf.toString()); new Write2ncRect(ncf, "C:/data/bufr2nc.meteosat.nc", true); } }
@Override public int doAct(String filename) throws IOException { if (deleteUncompress && filename.endsWith(".uncompress")) { File uf = new File(filename); if (!uf.delete()) System.out.printf("Failed to delete %s%n", filename); return 0; } try (NetcdfFile ncfile = NetcdfDataset.openFile(filename, null)) { return testRead(ncfile); } } }
private void doOne(String name) throws IOException { NetcdfFile ncfile = null; try { ncfile = NetcdfDataset.openFile(name, null); if (verbose) System.out.printf(" GOOD on %s == %s%n", name, ncfile.getFileTypeId()); countGood++; } catch (Throwable t) { System.out.printf(" FAIL on %s == %s%n", name, t.getMessage()); t.printStackTrace(); } finally { if (ncfile != null) ncfile.close(); } }
@Test public void testProblem() throws IOException { String filename = TestDir.cdmUnitTestDir + "formats/grib1/testproj2.grb"; System.out.println("read file= "+filename); NetcdfFile ncfile = NetcdfDataset.openFile( filename, null); ncfile.close(); }
@Test public void doOne() throws IOException { File fin = new File(TestDir.cdmUnitTestDir+filename); File fout = tempFolder.newFile(); System.out.printf("Write %s %n to %s (%s %s)%n", fin.getAbsolutePath(), fout.getAbsolutePath(), fout.exists(), fout.getParentFile().exists()); try (NetcdfFile ncfileIn = ucar.nc2.dataset.NetcdfDataset.openFile(fin.getPath(), null)) { FileWriter2 fileWriter = new FileWriter2(ncfileIn, fout.getPath(), NetcdfFileWriter.Version.netcdf3, null); try (NetcdfFile ncfileOut = fileWriter.write()) { assert ucar.unidata.util.test.CompareNetcdf.compareFiles(ncfileIn, ncfileOut) == same; } } System.out.printf("%n"); }
@Test public void testCoordSys() throws IOException { //NetcdfDataset ncd = NetcdfDataset.openDataset( // "dods://localhost:8080/thredds/dodsC/testAll/Level2_KSOX_20051010_2322.ar2v", false, null); String filename = TestDir.cdmUnitTestDir + "formats/nexrad/level2/Level2_KYUX_20060527_2335.ar2v"; try (NetcdfFile ncfile = NetcdfDataset.openFile( filename, null)) { testCoordSystem(ncfile); } }
private void writeStructure(String datasetIn, String datasetOut) throws IOException { CancelTaskImpl cancel = new CancelTaskImpl(); NetcdfFile ncfileIn = ucar.nc2.dataset.NetcdfDataset.openFile(datasetIn, cancel); System.out.printf("NetcdfDatataset read from %s write to %s %n", datasetIn, datasetOut); FileWriter2 writer = new ucar.nc2.FileWriter2(ncfileIn, datasetOut, NetcdfFileWriter.Version.netcdf4, null); NetcdfFile ncfileOut = writer.write(cancel); if (ncfileOut != null) ncfileOut.close(); ncfileIn.close(); cancel.setDone(true); System.out.printf("%s%n", cancel); }
@Test public void testNestedAgg() throws IOException, InvalidRangeException, InterruptedException { String filename = "file:./" + TestDir.cdmLocalTestDataDir + "testNested.ncml"; try (NetcdfFile ncfile = NetcdfDataset.openFile(filename, null)) { TestDir.readAllData(ncfile); Variable v = ncfile.findVariable("time"); Array data = v.read(); assert data.getSize() == 59; logger.debug(NCdumpW.toString(data)); } }
@Test public void testNestedScan() throws IOException, InvalidRangeException, InterruptedException { String filename = "file:./" + TestNcML.topDir + "nested/TestNestedDirs.ncml"; try (NetcdfFile ncfile = NetcdfDataset.openFile(filename, null)) { TestDir.readAllData(ncfile); Variable v = ncfile.findVariable("time"); Array data = v.read(); assert data.getSize() == 3; logger.debug(NCdumpW.toString(data)); } } }
@Test public void testAddMetadataToScan() throws IOException, InvalidRangeException { String endpoint = TestOnLocalServer.withHttpPath("cdmremote/testGridScan/GFS_CONUS_80km_20120229_1200.grib1"); logger.debug("{}", endpoint); try (NetcdfFile ncd = NetcdfDataset.openFile(endpoint, null)) { Assert.assertNotNull(ncd); Attribute att = ncd.findGlobalAttribute("ncmlAdded"); Assert.assertNotNull(att); Assert.assertEquals("stuff", att.getStringValue()); } } }
@Test public void testCachedData() throws IOException { NetcdfFile ncd = null; try { ncd = NetcdfDataset.openFile(TestDir.cdmLocalTestDataDir + "point/profileMultidim.ncml", null); Variable v = ncd.findVariable("data"); assert v != null; Array data = v.read(); assert data.getSize() == 50 : data.getSize(); } finally { if (ncd != null) ncd.close(); } }
public void testW(String url, String sname, boolean isScalar) throws IOException, InvalidRangeException { NetcdfFile ncfile = NetcdfDataset.openFile(url, null); Structure v = (Structure) ncfile.findVariable(sname); assert v != null; assert( v.getDataType() == DataType.STRUCTURE); Array data = v.read(); assert( data instanceof ArrayStructure); assert(data.getElementType() == StructureData.class); new UtilsTestStructureArray().testArrayStructure( (ArrayStructure) data); ncfile.close(); }
public void utestEnum2() throws InvalidRangeException, IOException { NetcdfFile ncfile = NetcdfDataset.openFile("D:/netcdf4/tst_enum_data.nc", null); Variable v2 = ncfile.findVariable("primary_cloud"); assert v2 != null; Array data = v2.read(); assert data.getElementType() == byte.class; NetcdfDataset ncd = NetcdfDataset.openDataset("D:/netcdf4/tst_enum_data.nc"); v2 = ncd.findVariable("primary_cloud"); assert v2 != null; data = v2.read(); assert data.getElementType() == String.class; ncfile.close(); }