public static void main(String[] args) throws Exception { DiskCache.setCachePolicy(true); File f = new File(args[0]); Pair<String, String> nameParts = FileNames.splitExtension(f); String ext = nameParts.b; if (ext.equals("grb") || ext.equals("bz2") || ext.equals("gz")) { Map<String, Metadata> metaMap = ConvertNetCDF.readFile(f.getAbsolutePath()); /* Don't cache more than 1 GB: */ DiskCache.cleanCache(1073741824, null); /*String[] attribs = { "temperature_surface", "total_cloud_cover_entire_atmosphere", "visibility_surface", "pressure_surface", "categorical_snow_yes1_no0_surface", "categorical_rain_yes1_no0_surface", "relative_humidity_zerodegc_isotherm" };*/ String[] attribs = {"U-component_of_wind"}; Metadata m = metaMap.get("9x"); System.out.print("9x@" + m.getTemporalProperties().getStart() + "\t"); for (String attrib : attribs) { System.out.print(m.getAttribute(attrib).getString() + "\t"); } System.out.println(); } }
/** * Takes a Metadata instance being used as Block content, and extracts the given Feature for * indexing purposes. */ private static void addIndexField(String featureName, Metadata baseMeta, Metadata indexMeta) { Feature f = baseMeta.getAttribute(featureName); if (f != null) { indexMeta.putAttribute(f); } }