/** * Read an NcML file from a URL location, and construct a NetcdfDataset. * * @param ncmlLocation the URL location string of the NcML document * @param cancelTask allow user to cancel the task; may be null * @return the resulting NetcdfDataset * @throws IOException on read error, or bad referencedDatasetUri URI */ static public NetcdfDataset readNcML(String ncmlLocation, CancelTask cancelTask) throws IOException { return readNcML(ncmlLocation, (String) null, cancelTask); }
/** * Read NcML doc from a Reader, and construct a NetcdfDataset. * * @param r the Reader containing the NcML document * @param cancelTask allow user to cancel the task; may be null * @return the resulting NetcdfDataset * @throws IOException on read error, or bad referencedDatasetUri URI */ static public NetcdfDataset readNcML(Reader r, CancelTask cancelTask) throws IOException { return readNcML(r, "NcMLReader", cancelTask); }
/** * Read an NcML file from a URL location, and construct a NetcdfDataset. * * @param ncmlLocation the URL location string of the NcML document * @param cancelTask allow user to cancel the task; may be null * @return the resulting NetcdfDataset * @throws IOException on read error, or bad referencedDatasetUri URI */ static public NetcdfDataset readNcML(String ncmlLocation, CancelTask cancelTask) throws IOException { return readNcML(ncmlLocation, (String) null, cancelTask); }
/** * Read NcML doc from a Reader, and construct a NetcdfDataset. * * @param r the Reader containing the NcML document * @param cancelTask allow user to cancel the task; may be null * @return the resulting NetcdfDataset * @throws IOException on read error, or bad referencedDatasetUri URI */ static public NetcdfDataset readNcML(Reader r, CancelTask cancelTask) throws IOException { return readNcML(r, "NcMLReader", cancelTask); }
public void setUp() throws IOException { if (ncfile != null) return; String filename = "file:./" + TestNcML.topDir + "aggUnion.xml"; ncfile = NcMLReader.readNcML(filename, null); }
@Override public FileCacheable open(DatasetUrl durl, int buffer_size, CancelTask cancelTask, Object iospMessage) throws IOException { return NcMLReader.readNcML(new StringReader(ncml), durl.trueurl, null); } }
static private NetcdfFile acquireNcml(FileCache cache, FileFactory factory, Object hashKey, String location, int buffer_size, ucar.nc2.util.CancelTask cancelTask, Object spiObject) throws IOException { if (cache == null) return NcMLReader.readNcML(location, cancelTask); if (factory == null) factory = new NcMLFactory(); return (NetcdfFile) cache.acquire(factory, hashKey, location, buffer_size, cancelTask, spiObject); }
static private NetcdfFile acquireNcml(FileCache cache, FileFactory factory, Object hashKey, String location, int buffer_size, ucar.nc2.util.CancelTask cancelTask, Object spiObject) throws IOException { if (cache == null) return NcMLReader.readNcML(location, cancelTask); if (factory == null) factory = new NcMLFactory(); return (NetcdfFile) cache.acquire(factory, hashKey, location, buffer_size, cancelTask, spiObject); }
public void setUp() { try { ncfile = NcMLReader.readNcML(location, null); //System.out.println("ncfile opened = "+location); } catch (java.net.MalformedURLException e) { System.out.println("bad URL error = "+e); } catch (IOException e) { System.out.println("IO error = "+e); e.printStackTrace(); } }
public void setUp() { try { ncfile = NcMLReader.readNcML(location, null); //System.out.println("ncfile opened = "+location); } catch (java.net.MalformedURLException e) { System.out.println("bad URL error = "+e); } catch (IOException e) { System.out.println("IO error = "+e); e.printStackTrace(); } }
public void setUp() { String filename = "file:"+TestNcML.topDir + "modifyVars.xml"; try { ncfile = NcMLReader.readNcML(filename, null); } catch (java.net.MalformedURLException e) { System.out.println("bad URL error = "+e); } catch (IOException e) { System.out.println("IO error = "+e); e.printStackTrace(); } }
static private NetcdfFile acquireNcml(FileCache cache, FileFactory factory, Object hashKey, String location, int buffer_size, ucar.nc2.util.CancelTask cancelTask, Object spiObject) throws IOException { if (cache == null) return NcMLReader.readNcML(location, cancelTask); if (factory == null) factory = new NcMLFactory(); // LOOK maybe always should use NcMLFactory ? return (NetcdfFile) cache.acquire(factory, hashKey, DatasetUrl.findDatasetUrl(location), buffer_size, cancelTask, spiObject); }
private synchronized void makeFmrc() throws IOException { if (madeFmrc) { checkIfChanged(); return; } Element ncml = getNcmlElement(); NetcdfDataset ncd = NcMLReader.readNcML(path, ncml, null); ncd.setFileCache( fileCache); // LOOK: this dataset never gets closed fmrc = new FmrcImpl( ncd); madeFmrc = true; }
public void testWithDateFormatMark() throws Exception { System.out.printf("ncml=%s%n", ncml); String filename = "file:" + TestNcML.topDir + "testAggModify.ncml"; NetcdfFile ncfile = NcMLReader.readNcML(new StringReader(ncml), filename, null); System.out.println(" TestNcmlAggExisting.open " + filename + "\n" + ncfile); Variable v = ncfile.findVariable("T"); assert null != v; v = ncfile.findVariable("P"); assert null == v; ncfile.close(); }
public void testStride() throws IOException, InvalidRangeException { String filename = "file:./" + TestNcML.topDir + "tiled/testAggTiled.ncml"; NetcdfFile ncfile = NcMLReader.readNcML(filename, null); logger.debug(" TestNcmlAggExisting.open {}", ncfile); Variable v = ncfile.findVariable("temperature"); v.setCaching(false); testReadDataSection(v, new Section("1:9:4,3:19:3")); ncfile.close(); }
@Test public void testForecastModel() throws IOException, InvalidRangeException { String filename = "file:./"+TestDir.cdmUnitTestDir + "ncml/offsite/aggForecastModel.xml"; logger.debug(" TestOffAggForecastModel.testForecastModel=\n{}", ncml); NetcdfFile ncfile = NcMLReader.readNcML(new StringReader(ncml), filename, null); testDimensions(ncfile, nruns); testCoordVar(ncfile); testAggCoordVar(ncfile, nruns); testReadData(ncfile, nruns, nfore); testReadSlice(ncfile); ncfile.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 testNcmlDirect() throws IOException, InvalidRangeException { String filename = "file:./"+TestNcML.topDir + "aggExisting.xml"; NetcdfFile ncfile = NcMLReader.readNcML(filename, null); logger.debug(" TestNcmlAggExisting.open {}", filename); testDimensions(ncfile); testCoordVar(ncfile); testAggCoordVar(ncfile); testReadData(ncfile); testReadSlice(ncfile); ncfile.close(); }
public void test3() throws IOException, InvalidRangeException { String filename = "file:./" + TestNcML.topDir + "aggSynthetic3.xml"; NetcdfFile ncfile = NcMLReader.readNcML(filename, null); testDimensions(ncfile); testCoordVar(ncfile); testAggCoordVar3(ncfile); testReadData(ncfile, "T"); testReadSlice(ncfile, "T"); ncfile.close(); }
public void testNoCoordDir() throws IOException, InvalidRangeException { String filename = "file:./" + TestNcML.topDir + "aggSynNoCoordsDir.xml"; NetcdfFile ncfile = NcMLReader.readNcML(filename, null); testDimensions(ncfile); testCoordVar(ncfile); testAggCoordVarNoCoordsDir(ncfile); testReadData(ncfile, "T"); testReadSlice(ncfile, "T"); ncfile.close(); }