/** * Register an IOServiceProvider. A new instance will be created when one of its files is opened. * * @param iospClass Class that implements IOServiceProvider. * @throws IllegalAccessException if class is not accessible. * @throws InstantiationException if class doesnt have a no-arg constructor. * @throws ClassCastException if class doesnt implement IOServiceProvider interface. */ static public void registerIOProvider(Class iospClass) throws IllegalAccessException, InstantiationException { registerIOProvider(iospClass,false); }
/** * Register an IOServiceProvider. A new instance will be created when one of its files is opened. * * @param iospClass Class that implements IOServiceProvider. * @throws IllegalAccessException if class is not accessible. * @throws InstantiationException if class doesnt have a no-arg constructor. * @throws ClassCastException if class doesnt implement IOServiceProvider interface. */ static public void registerIOProvider(Class iospClass) throws IllegalAccessException, InstantiationException { registerIOProvider(iospClass, false); }
/** * Register an IOServiceProvider. A new instance will be created when one of its files is opened. * * @param iospClass Class that implements IOServiceProvider. * @throws IllegalAccessException if class is not accessible. * @throws InstantiationException if class doesnt have a no-arg constructor. * @throws ClassCastException if class doesnt implement IOServiceProvider interface. */ static public void registerIOProvider(Class iospClass) throws IllegalAccessException, InstantiationException { registerIOProvider(iospClass, false); }
/** * Register an IOServiceProvider, using its class string name. * * @param className Class that implements IOServiceProvider. * @throws IllegalAccessException if class is not accessible. * @throws InstantiationException if class doesnt have a no-arg constructor. * @throws ClassNotFoundException if class not found. */ static public void registerIOProvider(String className) throws IllegalAccessException, InstantiationException, ClassNotFoundException { Class ioClass = NetcdfFile.class.getClassLoader().loadClass(className); registerIOProvider(ioClass); }
/** * Register an IOServiceProvider, using its class string name. * * @param className Class that implements IOServiceProvider. * @throws IllegalAccessException if class is not accessible. * @throws InstantiationException if class doesnt have a no-arg constructor. * @throws ClassNotFoundException if class not found. */ static public void registerIOProvider(String className) throws IllegalAccessException, InstantiationException, ClassNotFoundException { Class ioClass = NetcdfFile.class.getClassLoader().loadClass(className); registerIOProvider(ioClass); }
/** * Register an IOServiceProvider, using its class string name. * * @param className Class that implements IOServiceProvider. * @throws IllegalAccessException if class is not accessible. * @throws InstantiationException if class doesnt have a no-arg constructor. * @throws ClassNotFoundException if class not found. */ static public void registerIOProvider(String className) throws IllegalAccessException, InstantiationException, ClassNotFoundException { Class ioClass = NetcdfFile.class.getClassLoader().loadClass(className); registerIOProvider(ioClass); }
public static void main(String[] args) { String infile = " "; if (args.length == 1) { infile = args[0]; } else { System.out.println("Usage: java SigmetIOServiceProvider inputFile"); System.exit(0); } try { NetcdfFile.registerIOProvider(SigmetIOServiceProvider.class); NetcdfFile ncfile = NetcdfFile.open(infile); System.out.println("ncfile = \n" + ncfile); } catch (Exception e) { System.out.println("MAIN!!! " + e.toString()); e.printStackTrace(); } }
public static void main(String[] args) { String infile = " "; if (args.length == 1) { infile = args[0]; } else { System.out.println("Usage: java SigmetIOServiceProvider inputFile"); System.exit(0); } try { NetcdfFile.registerIOProvider(SigmetIOServiceProvider.class); NetcdfFile ncfile = NetcdfFile.open(infile); System.out.println("ncfile = \n" + ncfile); } catch (Exception e) { System.out.println("MAIN!!! " + e.toString()); e.printStackTrace(); } }
public static void main(String[] args) { String infile = " "; if (args.length == 1) { infile = args[0]; } else { System.out.println("Usage: java SigmetIOServiceProvider inputFile"); System.exit(0); } try { NetcdfFile.registerIOProvider(SigmetIOServiceProvider.class); NetcdfFile ncfile = NetcdfFile.open(infile); System.out.println("ncfile = \n" + ncfile); } catch (Exception e) { System.out.println("MAIN!!! " + e.toString()); e.printStackTrace(); } }
public static void main(String args[]) throws IOException, InstantiationException, IllegalAccessException { String fileIn = "/home/yuanho/dorade/swp.1020511015815.SP0L.573.1.2_SUR_v1"; //String fileIn = "c:/data/image/Dorade/n0r_20041013_1852"; ucar.nc2.NetcdfFile.registerIOProvider(ucar.nc2.iosp.dorade.Doradeiosp.class); ucar.nc2.NetcdfFile ncf = ucar.nc2.NetcdfFile.open(fileIn); //List alist = ncf.getGlobalAttributes(); ucar.unidata.io.RandomAccessFile file = new ucar.unidata.io.RandomAccessFile(fileIn, "r"); //open1(file, null, null); //ucar.nc2.Variable v = ncf.findVariable("BaseReflectivity"); //ncf.close(); }
public static void main(String args[]) throws Exception, IOException, InstantiationException, IllegalAccessException { String fileIn = "/home/yuanho/NIDS/N0R_20041102_2111"; //String fileIn = "c:/data/image/Nids/n0r_20041013_1852"; ucar.nc2.NetcdfFile.registerIOProvider(ucar.nc2.iosp.nids.Nidsiosp.class); ucar.nc2.NetcdfFile ncf = ucar.nc2.NetcdfFile.open(fileIn); //List alist = ncf.getGlobalAttributes(); ucar.nc2.Variable v = ncf.findVariable("BaseReflectivity"); int[] origin = {0, 0}; int[] shape = {300, 36}; ArrayByte data = (ArrayByte) v.read(origin, shape); ncf.close(); }
public static void main(String args[]) throws Exception, IOException, InstantiationException, IllegalAccessException { String fileIn = "/home/yuanho/NIDS/N0R_20041102_2111"; //String fileIn = "c:/data/image/Nids/n0r_20041013_1852"; ucar.nc2.NetcdfFile.registerIOProvider(ucar.nc2.iosp.nids.Nidsiosp.class); ucar.nc2.NetcdfFile ncf = ucar.nc2.NetcdfFile.open(fileIn); //List alist = ncf.getGlobalAttributes(); ucar.nc2.Variable v = ncf.findVariable("BaseReflectivity"); int[] origin = {0, 0}; int[] shape = {300, 36}; v.read(origin, shape); ncf.close(); }
public static void main(String args[]) throws Exception, IOException, InstantiationException, IllegalAccessException { String fileIn = "z:/nowrad/BREF_951207_2230"; // String fileIn = "c:/data/image/Nids/n0r_20041013_1852"; ucar.nc2.NetcdfFile.registerIOProvider(ucar.nc2.iosp.nowrad.NOWRadiosp.class); ucar.nc2.NetcdfFile ncf = ucar.nc2.NetcdfFile.open(fileIn); // List alist = ncf.getGlobalAttributes(); ucar.nc2.Variable v = ncf.findVariable("BaseReflectivity"); int[] origin = {0, 0}; int[] shape = {300, 36}; v.read(origin, shape); ncf.close(); } }
public static void main(String args[]) throws Exception, IOException, InstantiationException, IllegalAccessException { String fileIn = "z:/nowrad/BREF_951207_2230"; // String fileIn = "c:/data/image/Nids/n0r_20041013_1852"; ucar.nc2.NetcdfFile.registerIOProvider(ucar.nc2.iosp.nowrad.NOWRadiosp.class); ucar.nc2.NetcdfFile ncf = ucar.nc2.NetcdfFile.open(fileIn); // List alist = ncf.getGlobalAttributes(); ucar.nc2.Variable v = ncf.findVariable("BaseReflectivity"); int[] origin = {0, 0}; int[] shape = {300, 36}; ArrayByte data = (ArrayByte) v.read(origin, shape); ncf.close(); } }
public static void main(String args[]) throws Exception, IOException, InstantiationException, IllegalAccessException { //String fileIn = "/home/yuanho/dev/netcdf-java-2.2/src/ucar/nc2/n0r_20040823_2215"; // uncompressed String fileIn = "c:/data/image/gini/n0r_20041013_1852"; ucar.nc2.NetcdfFile.registerIOProvider(ucar.nc2.iosp.gini.Giniiosp.class); ucar.nc2.NetcdfFile ncf = ucar.nc2.NetcdfFile.open(fileIn); List alist = ncf.getGlobalAttributes(); ucar.nc2.Variable v = ncf.findVariable("BaseReflectivity"); int[] origin = {0, 0}; int[] shape = {3000, 4736}; ArrayByte data = (ArrayByte) v.read(origin, shape); ncf.close(); }
ucar.nc2.NetcdfFile.registerIOProvider(className); } catch (ClassNotFoundException e) { errlog.append("CoordSysBuilder class not found= " + className + "; check your classpath\n");
ucar.nc2.NetcdfFile.registerIOProvider(className); } catch (ClassNotFoundException e) { errlog.append("CoordSysBuilder class not found= " + className + "; check your classpath\n"); NetcdfFile.registerIOProvider(nc4IospClassName); } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) { errlog.append(String.format("Could not register IOSP '%s': %s%n", nc4IospClassName, e.getMessage()));
ucar.nc2.NetcdfFile.registerIOProvider(className); } catch (ClassNotFoundException e) { errlog.append("CoordSysBuilder class not found= " + className + "; check your classpath\n");
private void setupReadDmspAsNetcdf(String testFilePath, String testDataFileName) { // Register the DMSP IOServiceProvider. try { NetcdfFile.registerIOProvider(DMSPiosp.class); } catch (IllegalAccessException e) { assertTrue("Unexpected IllegalAccessException registering DMSPiosp: " + e.getMessage(), false); } catch (InstantiationException e) { assertTrue("Unexpected InstantiationException registering DMSPiosp: " + e.getMessage(), false); } // Make sure test DMSP file exists and such. File testFile = new File(testFilePath, testDataFileName); assertTrue("Test file <" + testFile.getAbsolutePath() + "> does not exist.", testFile.exists()); assertTrue("Test file <" + testFile.getAbsolutePath() + "> cannot be read.", testFile.canRead()); assertTrue("Test file <" + testFile.getAbsolutePath() + "> is a directory.", !testFile.isDirectory()); // Open test DMSP file as NetCDF file. try { meNcf = NetcdfFile.open(testFilePath + "/" + testDataFileName); } catch (IOException e) { assertTrue("Unexpected IOException opening DMSP file <" + testFile.getAbsolutePath() + ">: " + e.getMessage(), false); } }