CollectionSpecParser.getFilter
Code IndexAdd Codota to your IDE (free)

Best Java code snippets using thredds.inventory.CollectionSpecParser.getFilter (Showing top 15 results out of 315)

  • Common ways to obtain CollectionSpecParser
private void myMethod () {
CollectionSpecParser c =
  • String collectionSpec;Formatter errlog;new CollectionSpecParser(collectionSpec, errlog)
  • Smart code suggestions by Codota
}
origin: Unidata/thredds

/**
 * Update all the gbx indices in one directory, and the ncx index for that directory
 *
 * @param config  FeatureCollectionConfig
 * @param dirPath directory path
 * @return true if collection was rewritten, exception on failure
 * @throws IOException
 */
static private boolean updateLeafCollection(boolean isGrib1, FeatureCollectionConfig config,
                      CollectionUpdateType updateType, boolean isTop,
                      Logger logger, Path dirPath) throws IOException {
 if (config.ptype == FeatureCollectionConfig.PartitionType.file) {
  return updateFilePartition(isGrib1, config, updateType, isTop, logger, dirPath);
 } else {
  Formatter errlog = new Formatter();
  CollectionSpecParser specp = config.getCollectionSpecParser(errlog);
  try (DirectoryCollection dcm = new DirectoryCollection(config.collectionName, dirPath, isTop, config.olderThan, logger)) {
   dcm.putAuxInfo(FeatureCollectionConfig.AUX_CONFIG, config);
   if (specp.getFilter() != null)
    dcm.setStreamFilter(new StreamFilter(specp.getFilter(), specp.getFilterOnName()));
   boolean changed = updateGribCollection(isGrib1, dcm, updateType, FeatureCollectionConfig.PartitionType.directory, logger, errlog);
   if (debug) System.out.printf("  GribCdmIndex.updateDirectoryPartition was updated=%s on %s%n", changed, dirPath);
   return changed;
  }
 }
}
origin: edu.ucar/cdm

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;
}
origin: edu.ucar/netcdf

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;
}
origin: Unidata/thredds

if (specp.getFilter() != null)
 partition.setStreamFilter(new StreamFilter(specp.getFilter(), specp.getFilterOnName()));
origin: edu.ucar/netcdf

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));
}
origin: Unidata/thredds

@Test
public void testStreamFilterInDirPartition() throws IOException {
 // this dataset 0-6 hour forecasts  x 124 runtimes (4x31)
 // there are  2 groups, likely miscoded, the smaller group are 0 hour,  duplicates, possibly miscoded
 FeatureCollectionConfig config = new FeatureCollectionConfig("cfrsAnalysis_46", "test/testCfrsAnalysisOnly", FeatureCollectionType.GRIB2,
     TestDir.cdmUnitTestDir + "gribCollections/cfsr/.*grb2", null, null, null, "directory", null);
 Formatter errlog = new Formatter();
 CollectionSpecParser specp = new CollectionSpecParser(config.spec, errlog);
 Path rootPath = Paths.get(specp.getRootDir());
 try (DirectoryCollection dcm = new DirectoryCollection(config.collectionName, rootPath, true, config.olderThan, logger)) {
  dcm.putAuxInfo(FeatureCollectionConfig.AUX_CONFIG, config);
  if (specp.getFilter() != null)
   dcm.setStreamFilter(new StreamFilter(specp.getFilter(), specp.getFilterOnName()));
  int count = 0;
  for (MFile mfile : dcm.getFilesSorted()) {
   System.out.printf("%s%n", mfile);
   assert mfile.getName().equals("pwat.gdas.199612.grb2");
   count++;
  }
  assert count == 1;
 }
}
origin: edu.ucar/cdm

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));
}
origin: Unidata/thredds

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;
}
origin: edu.ucar/cdm

public MFileCollectionManager(FeatureCollectionConfig config, Formatter errlog, org.slf4j.Logger logger) {
 super(config.name != null ? config.name : config.spec, logger);
 this.config = config;
 CollectionSpecParser sp = new CollectionSpecParser(config.spec, errlog);
 this.root = sp.getRootDir();
 List<MFileFilter> filters = new ArrayList<MFileFilter>(3);
 if (null != sp.getFilter())
  filters.add(new WildcardMatchOnName(sp.getFilter()));
 olderThanInMsecs = parseOlderThanFilter(config.olderThan);
 if (config.dateFormatMark != null)
  dateExtractor = new DateExtractorFromName(config.dateFormatMark, false);
 else if (sp.getDateFormatMark() != null)
  dateExtractor = new DateExtractorFromName(sp.getDateFormatMark(), true);
 else
  dateExtractor = new DateExtractorNone();
 scanList.add(new CollectionConfig(sp.getRootDir(), sp.getRootDir(), sp.wantSubdirs(), filters, null));
 if (config.protoConfig != null)
  protoChoice = config.protoConfig.choice;
 if (config.updateConfig != null) {
  this.recheck = makeRecheck(config.updateConfig.recheckAfter);
  // static means never rescan on checkState; let it be externally triggered.
  if ((config.updateConfig.recheckAfter == null) && (config.updateConfig.rescan == null) && (config.updateConfig.deleteAfter == null))
   setStatic(true);
 }
 if (this.auxInfo == null) this.auxInfo = new HashMap<>(10);
 this.auxInfo.put(FeatureCollectionConfig.AUX_CONFIG, config);
}
origin: Unidata/thredds

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));
}
origin: edu.ucar/netcdf

if (null != sp.getFilter())
 filters.add(new WildcardMatchOnName(sp.getFilter()));
origin: edu.ucar/netcdf

public MFileCollectionManager(FeatureCollectionConfig config, Formatter errlog, org.slf4j.Logger logger) {
 super(config.name != null ? config.name : config.spec, logger);
 this.config = config;
 CollectionSpecParser sp = new CollectionSpecParser(config.spec, errlog);
 this.rootDir = sp.getRootDir();
 List<MFileFilter> filters = new ArrayList<MFileFilter>(3);
 if (null != sp.getFilter())
  filters.add(new WildcardMatchOnName(sp.getFilter()));
 olderThanInMsecs = parseOlderThanFilter(config.olderThan);
 if (config.dateFormatMark != null)
  dateExtractor = new DateExtractorFromName(config.dateFormatMark, false);
 else if (sp.getDateFormatMark() != null)
  dateExtractor = new DateExtractorFromName(sp.getDateFormatMark(), true);
 else
  dateExtractor = new DateExtractorNone();
 scanList.add(new MCollection(sp.getRootDir(), sp.getRootDir(), sp.wantSubdirs(), filters, null));
 this.recheck = makeRecheck(config.updateConfig.recheckAfter);
 protoChoice = config.protoConfig.choice;
 // static means never rescan on checkState; let it be externally triggered.
 if ((config.updateConfig.recheckAfter == null) && (config.updateConfig.rescan == null) &&  (config.updateConfig.deleteAfter == null))
  setStatic(true);
}
origin: Unidata/thredds

@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"));
 }
origin: Unidata/thredds

public MFileCollectionManager(FeatureCollectionConfig config, Formatter errlog, org.slf4j.Logger logger) {
 super(config.collectionName != null ? config.collectionName : config.spec, logger);
 this.config = config;
 CollectionSpecParser sp = config.getCollectionSpecParser(errlog);
 this.root = sp.getRootDir();
 CompositeMFileFilter filters = new CompositeMFileFilter();
 if (null != sp.getFilter())
  filters.addIncludeFilter(new WildcardMatchOnName(sp.getFilter()));
 olderThanInMsecs = parseOlderThanFilter(config.olderThan);
 if (config.dateFormatMark != null)
  dateExtractor = new DateExtractorFromName(config.dateFormatMark, false);
 else if (sp.getDateFormatMark() != null)
  dateExtractor = new DateExtractorFromName(sp.getDateFormatMark(), true);
 else
  dateExtractor = new DateExtractorNone();
 scanList.add(new CollectionConfig(sp.getRootDir(), sp.getRootDir(), sp.wantSubdirs(), filters, null));
 if (config.protoConfig != null)
  protoChoice = config.protoConfig.choice;
 if (config.updateConfig != null) {
  this.recheck = makeRecheck(config.updateConfig.recheckAfter);
  // static means never rescan on checkState; let it be externally triggered.
  if ((config.updateConfig.recheckAfter == null) && (config.updateConfig.rescan == null) && (config.updateConfig.deleteAfter == null))
   setStatic(true);
 }
 if (this.auxInfo == null) this.auxInfo = new HashMap<>(10);
 this.auxInfo.put(FeatureCollectionConfig.AUX_CONFIG, config);
}
origin: Unidata/thredds

@Test
public void testParseCalendarDate() throws IOException {
 Formatter errlog = new Formatter();
 CollectionSpecParser specp = new CollectionSpecParser("/data/ldm/pub/native/grid/NCEP/GFS/CONUS_95km/GFS_CONUS_95km_#yyyyMMdd_HHmm#.grib2", errlog);
 System.out.printf("errlog=%s%n", errlog);
 System.out.printf("specp=%s%n", specp);
 // test parsing
 assert specp.getRootDir().equals("/data/ldm/pub/native/grid/NCEP/GFS/CONUS_95km");
 assert !specp.wantSubdirs();
 assert specp.getFilter().toString().equals("GFS_CONUS_95km_..............grib2");
 assert specp.getDateFormatMark().equals("GFS_CONUS_95km_#yyyyMMdd_HHmm");
 // test filter
 MFileFilter mfilter = new WildcardMatchOnName(specp.getFilter());
 String path = "/data/ldm/pub/native/grid/NCEP/GFS/CONUS_95km/GFS_CONUS_95km_20141203_0000.grib2";
 MFile mfile = new MFileOS7(Paths.get(path), null);
 assert mfilter.accept(mfile);
 // 2014-12-03T16:43:59.433 -0700 ERROR - ucar.nc2.units.DateFromString - Must delineate Date between 2 '#' chars, dateFormatString = GFS_CONUS_95km_#yyyyMMdd_HHmm
 // test date extractor
 DateExtractor extractor = new DateExtractorFromName(specp.getDateFormatMark(), true);
 CalendarDate cd =  extractor.getCalendarDate(mfile);
 assert cd != null : "date extractor failed";
 System.out.printf("%s -> %s%n", path, cd);
 assert(cd.toString().equals("2014-12-03T00:00:00Z"));
}
thredds.inventoryCollectionSpecParsergetFilter

Popular methods of CollectionSpecParser

  • getRootDir
  • <init>
    Single spec : "/topdir/** /#dateFormatMark#regExp" This only allows the dateFormatMark to be in the
  • wantSubdirs
  • getDateFormatMark
  • doit
  • getFilterOnName
  • getPathMatcher

Popular in Java

  • Reading from database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • runOnUiThread (Activity)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo

For IntelliJ IDEA,
Android Studio or Eclipse

  • Search for JavaScript code betaCodota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutBlogContact Us
  • Plugin user guideTerms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)