public CatalogCollectionManager(String collection) { super(collection, null); if (collection.startsWith(MFileCollectionManager.CATALOG)) collection = collection.substring(MFileCollectionManager.CATALOG.length()); int pos = collection.indexOf('?'); if (pos > 0) { this.dateExtractor = new DateExtractorFromName(collection.substring(pos+1), true); collection = collection.substring(0,pos); } this.catalogUrl = collection; }
public CollectionManagerCatalog(String collectionName, String collectionSpec, String olderThan, Formatter errlog) { super(collectionName, null); if (collectionSpec.startsWith(MFileCollectionManager.CATALOG)) collectionSpec = collectionSpec.substring(MFileCollectionManager.CATALOG.length()); int pos = collectionSpec.indexOf('?'); if (pos > 0) { this.dateExtractor = new DateExtractorFromName(collectionSpec.substring(pos + 1), true); // WTF ? collectionSpec = collectionSpec.substring(0, pos); } this.catalogUrl = collectionSpec; this.root = System.getProperty("user.dir"); }
public CollectionManagerCatalog(String collectionName, String collectionSpec, String olderThan, Formatter errlog) { super(collectionName, null); if (collectionSpec.startsWith(MFileCollectionManager.CATALOG)) collectionSpec = collectionSpec.substring(MFileCollectionManager.CATALOG.length()); int pos = collectionSpec.indexOf('?'); if (pos > 0) { this.dateExtractor = new DateExtractorFromName(collectionSpec.substring(pos+1), true); // WTF ? collectionSpec = collectionSpec.substring(0,pos); } this.catalogUrl = collectionSpec; this.root = System.getProperty("user.dir"); }
static public void doit(String name, String dateFormatMark, boolean useName) { DateExtractorFromName de = new DateExtractorFromName(dateFormatMark, useName); CalendarDate d = de.getDate(name); System.out.printf("%s == %s%n", name , d); }
static public void doit(String name, String dateFormatMark, boolean useName) { DateExtractorFromName de = new DateExtractorFromName(dateFormatMark, useName); CalendarDate d = de.getDate(name); System.out.printf("%s == %s%n", name , d); }
@Override protected void buildNetcdfDataset(CancelTask cancelTask) throws IOException { DateExtractor dateExtractor = null; if (runMatcher != null) dateExtractor = new DateExtractorFromName(runMatcher, false); // uses path if (dateExtractor == null && dateFormatMark != null) dateExtractor = new DateExtractorFromName(dateFormatMark, true); fmrc = new Fmrc(datasetManager, new FeatureCollectionConfig()); // fill in the ncDataset fmrc.getDataset2D( ncDataset); }
public DateExtractor getDateExtractor() { if (dateFormatMark != null) return new DateExtractorFromName(dateFormatMark, false); else { CollectionSpecParser sp = getCollectionSpecParser(null); if (sp.getDateFormatMark() != null) return new DateExtractorFromName(sp.getDateFormatMark(), true); } return new DateExtractorNone(); }
@Override protected void buildNetcdfDataset(CancelTask cancelTask) throws IOException { DateExtractor dateExtractor = null; if (runMatcher != null) dateExtractor = new DateExtractorFromName(runMatcher, false); // uses path if (dateExtractor == null && dateFormatMark != null) dateExtractor = new DateExtractorFromName(dateFormatMark, true); fmrc = new Fmrc(datasetManager, new FeatureCollectionConfig()); // fill in the ncDataset fmrc.getDataset2D( ncDataset); }
public void addDirectoryScanFmrc(String dirName, String suffix, String regexpPatternString, String subdirs, String olderThan, String runMatcher, String forecastMatcher, String offsetMatcher) throws IOException { // only one this.runMatcher = runMatcher; //this.forecastMatcher = forecastMatcher; //this.offsetMatcher = offsetMatcher; // this.enhance = NetcdfDataset.getDefaultEnhanceMode(); isDate = true; //DatasetScanner d = new DatasetScanner(null, dirName, suffix, regexpPatternString, subdirs, olderThan); //datasetManager.addDirectoryScan(d); datasetManager.addDirectoryScan(dirName, suffix, regexpPatternString, subdirs, olderThan, null); if (runMatcher != null) { DateExtractor dateExtractor = new DateExtractorFromName(runMatcher, false); datasetManager.setDateExtractor(dateExtractor); } }
public void addDirectoryScanFmrc(String dirName, String suffix, String regexpPatternString, String subdirs, String olderThan, String runMatcher, String forecastMatcher, String offsetMatcher) throws IOException { // only one this.runMatcher = runMatcher; //this.forecastMatcher = forecastMatcher; //this.offsetMatcher = offsetMatcher; // this.enhance = NetcdfDataset.getDefaultEnhanceMode(); isDate = true; //DatasetScanner d = new DatasetScanner(null, dirName, suffix, regexpPatternString, subdirs, olderThan); //datasetManager.addDirectoryScan(d); datasetManager.addDirectoryScan(dirName, suffix, regexpPatternString, subdirs, olderThan, null); if (runMatcher != null) { DateExtractor dateExtractor = new DateExtractorFromName(runMatcher, false); datasetManager.setDateExtractor(dateExtractor); } }
public void addDirectoryScanFmrc(String dirName, String suffix, String regexpPatternString, String subdirs, String olderThan, String runMatcher, String forecastMatcher, String offsetMatcher) throws IOException { // only one this.runMatcher = runMatcher; //this.forecastMatcher = forecastMatcher; //this.offsetMatcher = offsetMatcher; // this.enhance = NetcdfDataset.getDefaultEnhanceMode(); isDate = true; //DatasetScanner d = new DatasetScanner(null, dirName, suffix, regexpPatternString, subdirs, olderThan); //datasetManager.addDirectoryScan(d); datasetManager.addDirectoryScan(dirName, suffix, regexpPatternString, subdirs, olderThan, null); if (runMatcher != null) { DateExtractor dateExtractor = new DateExtractorFromName(runMatcher, false); datasetManager.setDateExtractor(dateExtractor); } }
@Override protected void buildNetcdfDataset(CancelTask cancelTask) throws IOException { DateExtractor dateExtractor = null; if (runMatcher != null) dateExtractor = new DateExtractorFromName(runMatcher, false); // uses path if (dateExtractor == null && dateFormatMark != null) dateExtractor = new DateExtractorFromName(dateFormatMark, true); fmrc = new Fmrc(datasetManager, new FeatureCollectionConfig()); // fill in the ncDataset fmrc.getDataset2D( ncDataset); ncDataset.finish(); }
@Test public void doit() { DateExtractorFromName de = new DateExtractorFromName(dateFormatMark, useName); CalendarDate d = de.getCalendarDateFromPath(name); logger.debug("{} == {}", name, d); assert d.toString().equals(result); } }
public MFileCollectionManager(String name, String spec, Formatter errlog, org.slf4j.Logger logger) { super(name, logger); CollectionSpecParser sp = new CollectionSpecParser(spec, errlog); this.rootDir = sp.getRootDir(); List<MFileFilter> filters = new ArrayList<MFileFilter>(3); if (null != sp.getFilter()) filters.add(new WildcardMatchOnName(sp.getFilter())); dateExtractor = (sp.getDateFormatMark() == null) ? new DateExtractorNone() : new DateExtractorFromName(sp.getDateFormatMark(), true); scanList.add(new MCollection(sp.getRootDir(), sp.getRootDir(), sp.wantSubdirs(), filters, null)); this.recheck = null; this.protoChoice = FeatureCollectionConfig.ProtoChoice.Penultimate; // default this.olderThanInMsecs = -1; }
public MFileCollectionManager(String name, String spec, Formatter errlog, org.slf4j.Logger logger) { super(name, logger); CollectionSpecParser sp = new CollectionSpecParser(spec, errlog); this.root = sp.getRootDir(); List<MFileFilter> filters = new ArrayList<MFileFilter>(3); if (null != sp.getFilter()) filters.add(new WildcardMatchOnName(sp.getFilter())); dateExtractor = (sp.getDateFormatMark() == null) ? new DateExtractorNone() : new DateExtractorFromName(sp.getDateFormatMark(), true); scanList.add(new CollectionConfig(sp.getRootDir(), sp.getRootDir(), sp.wantSubdirs(), filters, null)); this.recheck = null; this.protoChoice = FeatureCollectionConfig.ProtoChoice.Penultimate; // default this.olderThanInMsecs = -1; }
private MFileCollectionManager(String collectionName, String collectionSpec, String olderThan, Formatter errlog) { super(collectionName, null); CollectionSpecParser sp = new CollectionSpecParser(collectionSpec, errlog); this.recheck = null; this.protoChoice = FeatureCollectionConfig.ProtoChoice.Penultimate; // default this.root = sp.getRootDir(); List<MFileFilter> filters = new ArrayList<MFileFilter>(2); if (null != sp.getFilter()) filters.add(new WildcardMatchOnName(sp.getFilter())); olderThanInMsecs = parseOlderThanFilter(olderThan); dateExtractor = (sp.getDateFormatMark() == null) ? new DateExtractorNone() : new DateExtractorFromName(sp.getDateFormatMark(), true); scanList.add(new CollectionConfig(sp.getRootDir(), sp.getRootDir(), sp.wantSubdirs(), filters, null)); }
private MFileCollectionManager(String collectionSpec, String olderThan, Formatter errlog) { super(collectionSpec, null); CollectionSpecParser sp = new CollectionSpecParser(collectionSpec, errlog); this.recheck = null; this.protoChoice = FeatureCollectionConfig.ProtoChoice.Penultimate; // default this.rootDir = sp.getRootDir(); List<MFileFilter> filters = new ArrayList<MFileFilter>(2); if (null != sp.getFilter()) filters.add(new WildcardMatchOnName(sp.getFilter())); olderThanInMsecs = parseOlderThanFilter(olderThan); dateExtractor = (sp.getDateFormatMark() == null) ? new DateExtractorNone() : new DateExtractorFromName(sp.getDateFormatMark(), true); scanList.add(new MCollection(sp.getRootDir(), sp.getRootDir(), sp.wantSubdirs(), filters, null)); }
@Test public void testCalendarDateFromPath() throws IOException { Formatter errlog = new Formatter(); CollectionSpecParser specp = new CollectionSpecParser("[DATA_DIR]/native/grid/FNMOC/COAMPS/Equatorial_America/FNMOC_COAMPS_Equatorial_America_#yyyyMMdd_HHmm#.grib1", errlog); System.out.printf("errlog=%s%n", errlog); System.out.printf("specp=%s%n", specp); // test parsing assert specp.getRootDir().equals("[DATA_DIR]/native/grid/FNMOC/COAMPS/Equatorial_America"); assert !specp.wantSubdirs(); assert specp.getFilter().toString().equals("FNMOC_COAMPS_Equatorial_America_..............grib1"); assert specp.getDateFormatMark().equals("FNMOC_COAMPS_Equatorial_America_#yyyyMMdd_HHmm"); // test filter String path = "[DATA_DIR]/native/grid/FNMOC/COAMPS/FNMOC_COAMPS_Equatorial_America_20141207_1200.grib1.ncx3"; MFile mfile = new MFileOS7(Paths.get(path), null); // test date extractor DateExtractor extractor = new DateExtractorFromName(specp.getDateFormatMark(), true); CalendarDate cd = extractor.getCalendarDateFromPath(mfile.toString()); assert cd != null : "date extractor failed"; System.out.printf("%s -> %s%n", path, cd); assert(cd.toString().equals("2014-12-07T12:00:00Z")); }
public MFileCollectionManager(String name, String spec, Formatter errlog, org.slf4j.Logger logger) { super(name, logger); CollectionSpecParser sp = new CollectionSpecParser(spec, errlog); this.root = sp.getRootDir(); CompositeMFileFilter filters = new CompositeMFileFilter(); if (null != sp.getFilter()) filters.addIncludeFilter(new WildcardMatchOnName(sp.getFilter())); dateExtractor = (sp.getDateFormatMark() == null) ? new DateExtractorNone() : new DateExtractorFromName(sp.getDateFormatMark(), true); scanList.add(new CollectionConfig(sp.getRootDir(), sp.getRootDir(), sp.wantSubdirs(), filters, null)); this.recheck = null; this.protoChoice = FeatureCollectionConfig.ProtoChoice.Penultimate; // default this.olderThanInMsecs = -1; }
private MFileCollectionManager(String collectionName, String collectionSpec, String olderThan, Formatter errlog) { super(collectionName, null); CollectionSpecParser sp = new CollectionSpecParser(collectionSpec, errlog); this.recheck = null; this.protoChoice = FeatureCollectionConfig.ProtoChoice.Penultimate; // default this.root = sp.getRootDir(); CompositeMFileFilter filters = new CompositeMFileFilter(); if (null != sp.getFilter()) filters.addIncludeFilter(new WildcardMatchOnName(sp.getFilter())); olderThanInMsecs = parseOlderThanFilter(olderThan); dateExtractor = (sp.getDateFormatMark() == null) ? new DateExtractorNone() : new DateExtractorFromName(sp.getDateFormatMark(), true); scanList.add(new CollectionConfig(sp.getRootDir(), sp.getRootDir(), sp.wantSubdirs(), filters, null)); }