/** * Factory method for opening a dataset through the netCDF API, and identifying its coordinate variables. * * @param location location of file * @param enhance if true, use defaultEnhanceMode, else no enhancements * @param cancelTask allow task to be cancelled; may be null. * @return NetcdfDataset object * @throws java.io.IOException on read error */ static public NetcdfDataset openDataset(String location, boolean enhance, ucar.nc2.util.CancelTask cancelTask) throws IOException { return openDataset(location, enhance, -1, cancelTask, null); }
/** * Factory method for opening a dataset through the netCDF API, and identifying its coordinate variables. * * @param location location of file * @param enhance if true, process scale/offset/missing and add Coordinate Systems * @param cancelTask allow task to be cancelled; may be null. * @return NetcdfDataset object * @throws java.io.IOException on read error */ static public NetcdfDataset openDataset(String location, boolean enhance, ucar.nc2.util.CancelTask cancelTask) throws IOException { return openDataset(location, enhance, -1, cancelTask, null); }
/** * Factory method for opening a dataset through the netCDF API, and identifying its coordinate variables. * * @param location location of file * @return NetcdfDataset object * @throws java.io.IOException on read error */ static public NetcdfDataset openDataset(String location) throws IOException { return openDataset(location, true, null); }
/** * Factory method for opening a dataset through the netCDF API, and identifying its coordinate variables. * * @param location location of file * @return NetcdfDataset object * @throws java.io.IOException on read error */ static public NetcdfDataset openDataset(String location) throws IOException { return openDataset(location, true, null); }
/** * Factory method for opening a dataset through the netCDF API, and identifying its coordinate variables. * * @param location location of file * @param enhance if true, process scale/offset/missing and add Coordinate Systems * @param cancelTask allow task to be cancelled; may be null. * @return NetcdfDataset object * @throws java.io.IOException on read error */ static public NetcdfDataset openDataset(String location, boolean enhance, ucar.nc2.util.CancelTask cancelTask) throws IOException { return openDataset(location, enhance, -1, cancelTask, null); }
/** * Factory method for opening a dataset through the netCDF API, and identifying its coordinate variables. * * @param location location of file * @return NetcdfDataset object * @throws java.io.IOException on read error */ static public NetcdfDataset openDataset(String location) throws IOException { return openDataset(location, true, null); }
public void setUp() throws IOException { if (ncfile != null) return; String filename = "file:./" + TestNcML.topDir + "aggUnionSimple.xml"; ncfile = NetcdfDataset.openDataset(filename, false, null); }
public static void main(String args[]) throws IOException { //String url = "http://dapper.pmel.noaa.gov/dapper/epic/puget_prof_ctd.cdp"; String url = "http://dapper.pmel.noaa.gov/dapper/epic/woce_sl_time_monthly.cdp"; NetcdfDataset ncd = NetcdfDataset.openDataset( url); DapperDataset.factory(ncd); }
public static void main(String args[]) throws IOException { //String filename = "C:/data/199707010200.CHRTOUT_DOMAIN2"; String filename = "C:/data/199707010000.LAKEOUT_DOMAIN2"; UnidataStationObsDataset ods = new UnidataStationObsDataset( NetcdfDataset.openDataset(filename)); StringBuffer sbuff = new StringBuffer(50 * 1000); ods.checkLinks(sbuff); System.out.println("\n\n"+sbuff.toString()); }
static void doit(String filename) throws IOException { System.out.println(filename); NetcdfDataset ncd = ucar.nc2.dataset.NetcdfDataset.openDataset(filename); TableAnalyzer csa = TableAnalyzer.factory(null, null, ncd); csa.getDetailInfo(new Formatter(System.out)); System.out.println("%n-----------------"); }
static void doit(String filename) throws IOException { System.out.println(filename); NetcdfDataset ncd = ucar.nc2.dataset.NetcdfDataset.openDataset(filename); TableAnalyzer csa = TableAnalyzer.factory(null, null, ncd); csa.getDetailInfo(new Formatter(System.out)); System.out.println("\n-----------------"); }
static void doit(PointDatasetStandardFactory fac, String filename) throws IOException { System.out.println(filename); Formatter errlog = new Formatter(System.out); NetcdfDataset ncd = ucar.nc2.dataset.NetcdfDataset.openDataset(filename); TableAnalyzer analysis = (TableAnalyzer) fac.isMine(FeatureType.ANY_POINT, ncd, errlog); fac.open(FeatureType.ANY_POINT, ncd, analysis, null, errlog); analysis.getDetailInfo(errlog); System.out.printf("\n-----------------"); ncd.close(); }
public static void main(String args[]) throws IOException { //String filename = "C:/data/199707010200.CHRTOUT_DOMAIN2"; String filename = "C:/data/199707010000.LAKEOUT_DOMAIN2"; NetcdfDataset ncds = new NetcdfDataset(); UnidataStationObsDataset ods = new UnidataStationObsDataset(ncds.openDataset(filename)); StringBuffer sbuff = new StringBuffer(50 * 1000); ods.checkLinks(sbuff); System.out.println("\n\n" + sbuff.toString()); ncds.shutdown(); }
@Test public void testOpenNetcdfDataset() throws IOException { try (NetcdfFile ncfile = NetcdfDataset.openDataset(url)) { test(ncfile); logger.debug("***************** Test testOpenNetcdfDataset over HTTP done"); } }
public void testRename() throws IOException { String filename = "file:./" + TestNcML.topDir + "aggUnionRename.xml"; NetcdfDataset scanFile = NetcdfDataset.openDataset(filename, false, null); Variable v = scanFile.findVariable("LavaFlow"); assert v != null; scanFile.close(); } }
@Test public void testTryWithWrap() throws IOException { String location = TestDir.cdmLocalTestDataDir + "testWrite.nc"; NetcdfDataset ncd = NetcdfDataset.openDataset(location); Formatter errlog = new Formatter(); try (FeatureDataset fdataset = FeatureDatasetFactoryManager.wrap(null, ncd, null, errlog)) { assert (fdataset == null); } ncd.close(); }
@Ignore("cant deal with BUFR at the moment") @Test public void testTds355() throws IOException { File example = new File(tds355Dir, "iasi_20110513_045057_metopa_23676_eps_o.l1_bufr"); try (NetcdfDataset dataset = NetcdfDataset.openDataset(example.getAbsolutePath())) { Variable obs = dataset.findVariable("obs"); obs.read(); // Throws an NPE after about 50 seconds on my machine. } } }
@Test public void openWithEnhance() throws Exception { try (NetcdfDataset ncDataset = NetcdfDataset.openDataset(filename, true, null)) { if (show) ncDataset.writeNcML(System.out, null); Assert.assertEquals(NetcdfDataset.getDefaultEnhanceMode(), ncDataset.getEnhanceMode()); Assert.assertTrue("size="+ncDataset.getCoordinateSystems().size(), ncDataset.getCoordinateSystems().size() > 0); } } }
@Test public void testNcmlDatasetNoProtocolInNcmlRelPath() throws IOException, InvalidRangeException { String filename = "file:./"+TestNcML.topDir + "aggExisting7.xml"; NetcdfFile ncfile = NetcdfDataset.openDataset( filename, true, null); logger.debug(" TestNcmlAggExisting.open {}", filename); testDimensions(ncfile); testCoordVar(ncfile); testAggCoordVar(ncfile); testReadData(ncfile); testReadSlice(ncfile); ncfile.close(); }
private void testEnhanceEquals(String ncmlLocation) throws IOException { System.out.println("testEnhanceEquals"); NetcdfDataset ncml = NcMLReader.readNcML(ncmlLocation, null); NetcdfDataset ncmlEnhanced = new NetcdfDataset(ncml, true); String locref = ncml.getReferencedFile().getLocation(); NetcdfDataset ncdrefEnhanced = NetcdfDataset.openDataset(locref, true, null); ucar.unidata.util.test.CompareNetcdf.compareFiles(ncmlEnhanced, ncdrefEnhanced, false, false, false); ncml.close(); ncdrefEnhanced.close(); }