/** * Get the file type id for the underlying data source. * * @return registered id of the file type * @see "http://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html" */ public String getFileTypeId() { if (spi != null) return spi.getFileTypeId(); return "N/A"; }
/** * Get the file type id for the underlying data source. * * @return registered id of the file type * @see "http://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html" */ public String getFileTypeId() { if (spi != null) return spi.getFileTypeId(); return "N/A"; }
/** * Get the file type id for the underlying data source. * * @return registered id of the file type * @see "http://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html" */ @Nonnull public String getFileTypeId() { if (spi != null) return spi.getFileTypeId(); return "N/A"; }
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()); } }
@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; } } }