public static NetcdfDataset acquireFeatureCollection(String path) throws IOException { Formatter formatter = new Formatter(System.err); FeatureCollectionConfigBuilder builder = new FeatureCollectionConfigBuilder(formatter); FeatureCollectionConfig config = builder.readConfigFromFile( path.toString()); // this is the path to the feature collection XML Fmrc fmrc = Fmrc.open(config, formatter); NetcdfDataset dataset = new NetcdfDataset(); fmrc.getDataset2D(dataset); dataset.setLocation(path); return dataset; }
public static void main(String[] args) throws Exception { String progName = GribCdmIndex.class.getName(); try { CommandLine cmdLine = new CommandLine(progName, args); if (cmdLine.help) { cmdLine.printUsage(); return; } Formatter errlog = new Formatter(); try { FeatureCollectionConfigBuilder reader = new FeatureCollectionConfigBuilder(errlog); String location = cmdLine.inputFile.getAbsolutePath(); FeatureCollectionConfig config = reader.readConfigFromFile(location); boolean changed = GribCdmIndex.updateGribCollection(config, cmdLine.updateType, classLogger); System.out.printf("changed = %s%n", changed); } catch (Exception e) { System.out.printf("%s = %s %n", e.getClass().getName(), e.getMessage()); String err = errlog.toString(); if (err.length() > 0) System.out.printf(" errlog=%s%n", err); // e.printStackTrace(); } } catch (ParameterException e) { System.err.println(e.getMessage()); System.err.printf("Try \"%s --help\" for more information.%n", progName); } }
public static NetcdfDataset acquireFeatureCollection(String path) throws IOException { Formatter formatter = new Formatter(System.err); FeatureCollectionConfigBuilder builder = new FeatureCollectionConfigBuilder(formatter); FeatureCollectionConfig config = builder.readConfigFromFile( path.toString()); // this is the path to the feature collection XML Fmrc fmrc = Fmrc.open(config, formatter); NetcdfDataset dataset = new NetcdfDataset(); fmrc.getDataset2D(dataset); dataset.setLocation(path); return dataset; }