@Override public void dispose() { synchronized (coverageSourceDescriptorsCache) { coverageSourceDescriptorsCache.clear(); } super.dispose(); checkType = CheckType.UNSET; georeferencing.dispose(); numImages = -1; try { if (dataset != null) { dataset.close(); } if (ancillaryFileManager != null) { ancillaryFileManager.dispose(); } if (imageInputStream != null) { IOUtils.closeQuietly(imageInputStream); } } catch (IOException e) { if (LOGGER.isLoggable(Level.WARNING)) LOGGER.warning("Errors closing NetCDF dataset." + e.getLocalizedMessage()); } finally { dataset = null; ancillaryFileManager = null; imageInputStream = null; } }
public synchronized void close() throws java.io.IOException { try { if (ncd != null) ncd.close(); } finally { ncd = null; } } }
private void closeAll(Map<String, NetcdfDataset> openFiles) throws IOException { for (NetcdfDataset ncfile : openFiles.values()) ncfile.close(); openFiles.clear(); }
private void closeAll(HashMap<String, NetcdfDataset> openFiles) throws IOException { for (NetcdfDataset ncfile : openFiles.values()) { ncfile.close(); } openFiles.clear(); }
private void closeAll(Map<String, NetcdfDataset> openFiles) throws IOException { for (NetcdfDataset ncfile : openFiles.values()) ncfile.close(); openFiles.clear(); }
@Override public synchronized void close() throws java.io.IOException { if (fileCache != null) { fileCache.release(this); } else { try { if (ds != null) ds.close(); } finally { ds = null; } } }
@Override public synchronized void close() throws java.io.IOException { if (fileCache != null) { fileCache.release(this); } else { try { if (ncfile != null) ncfile.close(); } finally { ncfile = null; } } }
@Override public synchronized void close() throws java.io.IOException { if (fileCache != null) { if (fileCache.release(this)) return; } try { if (netcdfDataset != null) netcdfDataset.close(); } finally { netcdfDataset = null; } }
@Override public synchronized void close() throws java.io.IOException { if (fileCache != null) { fileCache.release(this); } else { try { if (ncfile != null) ncfile.close(); } finally { ncfile = null; } } }
@Override public synchronized void close() throws java.io.IOException { if (fileCache != null) { if (fileCache.release(this)) return; } try { if (ncd != null) ncd.close(); } finally { ncd = null; } }
@Override public synchronized void close() throws java.io.IOException { if (fileCache != null) { fileCache.release(this); } else { try { if (ncfile != null) ncfile.close(); } finally { ncfile = null; } } }
@Override public synchronized void close() throws java.io.IOException { if (fileCache != null) { if (fileCache.release(this)) return; } try { if (netcdfDataset != null) netcdfDataset.close(); } finally { netcdfDataset = null; } }
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 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(); } }
public void testScan() throws IOException { String filename = "file:./" + TestNcML.topDir + "aggUnionScan.xml"; NetcdfDataset scanFile = NetcdfDataset.openDataset(filename, false, null); ucar.unidata.util.test.CompareNetcdf.compareFiles(ncfile, scanFile, true, false, false); scanFile.close(); }
private void testEquals(String ncmlLocation) throws IOException { System.out.println("testEquals"); NetcdfDataset ncd = NcMLReader.readNcML(ncmlLocation, null); String locref = ncd.getReferencedFile().getLocation(); NetcdfDataset ncdref = NetcdfDataset.openDataset(locref, false, null); ucar.unidata.util.test.CompareNetcdf.compareFiles(ncd, ncdref, false, false, false); ncd.close(); ncdref.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(); }
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(); }
private void doOne(String filename) throws Exception { try (NetcdfFile ncfile = NetcdfDataset.acquireFile(new DatasetUrl(null, filename), null); NetcdfDataset ncWrap = new NetcdfDataset(ncfile, true)) { NetcdfDataset ncd = NetcdfDataset.acquireDataset(new DatasetUrl(null, filename), true , null); System.out.println(" dataset wraps= " + filename); ucar.unidata.util.test.CompareNetcdf.compareFiles(ncd, ncWrap); ncd.close(); ncWrap.close(); } }
@Category(NeedsCdmUnitTest.class) public void testAlias() throws IOException { String filename = TestDir.cdmUnitTestDir + "ft/grid/ensemble/demeter/MM_cnrm_129_red.ncml"; NetcdfDataset ncd = ucar.nc2.dataset.NetcdfDataset.openDataset(filename); Variable v = ncd.findCoordinateAxis("number"); assert v != null; //assert v.isCoordinateVariable(); assert v instanceof CoordinateAxis1D; assert null != ncd.findDimension("ensemble"); assert v.getDimension(0) == ncd.findDimension("ensemble"); ncd.close(); }