@Override public IOServiceProvider getIosp() { return (orgFile == null) ? null : orgFile.getIosp(); }
@Override public IOServiceProvider getIosp() { return (orgFile == null) ? null : orgFile.getIosp(); }
@Override public IOServiceProvider getIosp() { return (orgFile == null) ? null : orgFile.getIosp(); }
public static void doon(String filename) throws IOException, InvalidRangeException { System.out.printf("BufrIosp compare = %s%n", filename); NetcdfFile ncfile = NetcdfFile.open(filename); BufrIosp iosp = (BufrIosp) ncfile.getIosp(); iosp.readAll(false); // iosp.compare(iosp.construct.recordStructure); }
private void getIosp() { NetcdfDataset ncd = (NetcdfDataset) gds.getNetcdfFile(); NetcdfFile ncfile = ncd.getReferencedFile(); while (ncfile instanceof NetcdfDataset) { ncd = (NetcdfDataset) ncfile; ncfile = ncd.getReferencedFile(); } if (ncfile == null) return; IOServiceProvider iosp = ncfile.getIosp(); if (iosp == null) return; if (!(iosp instanceof GridServiceProvider)) return; gribIosp = (GridServiceProvider) iosp; }
void doAll(String dirName) throws IOException { File dir = new File(dirName); System.out.printf("%nIn directory %s%n", dir.getPath()); for (File child : dir.listFiles()) { if (child.isDirectory()) continue; System.out.printf(" Open File %s ", child.getPath()); long start = System.currentTimeMillis(); try ( NetcdfFile ncfile = NetcdfDataset.openFile(child.getPath(), null)) { String ft = ncfile.findAttValueIgnoreCase(null, "featureType", "none"); String iosp = ncfile.getIosp().getFileTypeId(); System.out.printf(" iosp=%s ft=%s took =%d ms%n", iosp, ft, (System.currentTimeMillis() - start)); } catch (Throwable t) { System.out.printf(" FAILED =%s%n", t.getMessage()); t.printStackTrace(); } } for (File child : dir.listFiles()) { if (child.isDirectory()) doAll(child.getPath()); } }
public void run() { try { DatasetUrl durl = new DatasetUrl(null, location); FileCacheable fc = cache.acquire(factory, durl); NetcdfFile ncfile = (NetcdfFile) fc; //assert ncfile.isLocked(); assert (null != ncfile.getIosp()); Thread.sleep(wait); ncfile.close(); int d = done.incrementAndGet(); if (d % PRINT_EVERY == 0) System.out.printf(" done %d%n", d); } catch (InterruptedException e) { System.out.println(" InterruptedException="+e.getMessage()); } catch (Throwable e) { System.out.println(" fail="+e.getMessage()); e.printStackTrace(); assert false; } } }
@Override public int doAct(String filename) throws IOException { try (NetcdfFile ncfile = NetcdfDataset.openFile(filename, null)) { System.out.printf(" Open McIdas File %s ", filename); String ft = ncfile.findAttValueIgnoreCase(null, "featureType", "none"); String iosp = ncfile.getIosp().getFileTypeId(); System.out.printf(" iosp=%s ft=%s%n", iosp, ft); assert iosp.equals("McIDASArea") || iosp.equals("McIDASGrid") : iosp; assert ft.equals(FeatureType.GRID.toString()) : ft; return 1; } catch (Throwable t) { System.out.printf(" FAILED =%s%n", t.getMessage()); t.printStackTrace(); countFail++; return 0; } } }
public int readGridDataset() throws IOException { kind = KIND_GRID; int countFailures = 0; try (GridDataset gds = GridDataset.open(filename)) { NetcdfFile ncfile = gds.getNetcdfFile(); IOServiceProvider iosp = ncfile.getIosp(); isGrib1 = iosp instanceof Grib1Iosp; for (GridDatatype gdt : gds.getGrids()) { if (read(gdt)) counters.count(kind, "success"); else { counters.count(kind, "fail"); countFailures++; } } } return countFailures; }