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 boolean filter(int id, int intvStart, int intvEnd, int prob) { int intvLength = intvEnd - intvStart; if (intvLength == 0 && isZeroExcluded()) return true; for (IntvFilter filter : filterList) { if (filter.filter(id, intvStart, intvEnd, prob)) return true; } return false; }
private DateExtractor getDateExtractor() { if (extractor == null) extractor = config.getDateExtractor(); return extractor; }
private Fmrc(String collectionSpec, Formatter errlog) throws IOException { this.manager = MFileCollectionManager.open(collectionSpec, collectionSpec, null, errlog); // LOOK no name this.config = new FeatureCollectionConfig(); this.config.spec = collectionSpec; }
public void setIntervalLength(int intvLength, String varId) { if (intvFilter == null) intvFilter = new GribIntvFilter(); intvFilter.addVariable(intvLength, varId, null); }
static private FeatureCollectionConfig.UpdateConfig readUpdateElement(Element updateElem) { if (updateElem == null) { return new FeatureCollectionConfig.UpdateConfig(); // default } String startup = updateElem.getAttributeValue("startup"); String rewrite = updateElem.getAttributeValue("rewrite"); String recheckAfter = updateElem.getAttributeValue("recheckAfter"); String rescan = updateElem.getAttributeValue("rescan"); String trigger = updateElem.getAttributeValue("trigger"); String deleteAfter = updateElem.getAttributeValue("deleteAfter"); return new FeatureCollectionConfig.UpdateConfig(startup, rewrite, recheckAfter, rescan, trigger, deleteAfter); }
public ProtoConfig(String choice, String change, String param, Element ncml) { if (choice != null) { try { this.choice = ProtoChoice.valueOf(choice); } catch (Exception e) { log.warn("Dont recognize ProtoChoice " + choice); } } this.change = change; this.param = param; this.outerNcml = ncml; }
public void setExcludeZero(boolean val) { if (intvFilter == null) intvFilter = new GribIntvFilter(); intvFilter.isZeroExcluded = val; }
public boolean filterOk(int id, int hasLength, int prob) { if (filter == null) return true; if (hasLength == 0 && isZeroExcluded()) return false; for (GribIntvFilterParam param : filter) { boolean needProb = (param.prob != Integer.MIN_VALUE); // filter uses prob boolean hasProb = (prob != Integer.MIN_VALUE); // record has prob boolean isMine = !needProb || hasProb && (param.prob == prob); if (param.id == id && isMine) { // first match in the filter list is used if (param.intvLength != hasLength) return false; // remove the ones whose intervals dont match } } return true; }
@Override public int convertTimeUnit(int timeUnit) { if (timeUnitConverter == null) return timeUnit; return timeUnitConverter.convertTimeUnit(timeUnit); }
public boolean setOption(String name, String value) { if (name == null || value == null) return false; if (name.equalsIgnoreCase("timeUnit")) { setUserTimeUnit(value); // eg "10 min" or "minute" return true; } if (name.equalsIgnoreCase("runtimeCoordinate") && value.equalsIgnoreCase("union")) { unionRuntimeCoord = true; return true; } return false; }
public TestFmrc(String pathname, int ngrids, int ncoordSys, int ncoordAxes, int nVertCooordAxes, String gridName, int nruns, int ntimes, int nbest, boolean regular) { this.pathname = pathname; this.ngrids = ngrids; this.ncoordSys = ncoordSys; this.ncoordAxes = ncoordAxes; this.nVertCooordAxes = nVertCooordAxes; this.gridName = gridName; this.nruns = nruns; this.ntimes = ntimes; this.nbest = nbest; FeatureCollectionConfig.setRegularizeDefault(regular); }
public CalendarPeriod getUserTimeUnit() { CalendarPeriod result = null; String timeUnitS = getParameter("timeUnit"); if (timeUnitS != null) { result = CalendarPeriod.of(timeUnitS); // eg "10 min" or "minute" } return result; }
private Fmrc(String collectionSpec, Formatter errlog) throws IOException { this.manager = MFileCollectionManager.open(collectionSpec, null, errlog); this.config = new FeatureCollectionConfig(); this.config.spec = collectionSpec; }
public void setIntervalLength(int intvLength, String varId) { if (intvFilter == null) intvFilter = new GribIntvFilter(); intvFilter.addVariable(intvLength, varId, null); }
protected FeatureCollectionConfig.UpdateConfig readUpdateElement(Element updateElem) { String startup = updateElem.getAttributeValue("startup"); String recheckAfter = updateElem.getAttributeValue("recheckAfter"); String rescan = updateElem.getAttributeValue("rescan"); String trigger = updateElem.getAttributeValue("trigger"); String deleteAfter = updateElem.getAttributeValue("deleteAfter"); return new FeatureCollectionConfig.UpdateConfig(startup, recheckAfter, rescan, trigger, deleteAfter); }
public ProtoConfig(String choice, String change, String param, Element ncml) { if (choice != null) { try { this.choice = ProtoChoice.valueOf(choice); } catch (Exception e) { log.warn("Dont recognize ProtoChoice " + choice); } } this.change = change; this.param = param; this.outerNcml = ncml; }
public void setExcludeZero(boolean val) { if (intvFilter == null) intvFilter = new GribIntvFilter(); intvFilter.isZeroExcluded = val; }
public int convertTimeUnit(int timeUnit) { if (timeUnitConverter == null) return timeUnit; return timeUnitConverter.convertTimeUnit(timeUnit); }
public ProtoConfig(String choice, String change, String param, Element ncml) { if (choice != null) { try { this.choice = ProtoChoice.valueOf(choice); } catch (Exception e) { log.warn("Dont recognize ProtoChoice " + choice); } } this.change = change; this.param = param; this.outerNcml = ncml; }