Esempio n. 1
0
    def filename_from_patterns(self, patterns, t):

        paths = [ datetime_numeric.build_from_pattern(pattern, t) for pattern in patterns ]
        
        #paths = [ datetime_numeric.build_from_pattern(pattern, t) if (t >= self.start or t <= self.end) for pattern in patterns ] # would require a list of times provided by time_at_index
        name = os.path.join(*paths)
        return name
Esempio n. 2
0
    def filename_from_patterns(self, patterns, t):

        paths = [
            datetime_numeric.build_from_pattern(pattern, t)
            for pattern in patterns
        ]
        name = os.path.join(*paths)
        return name
Esempio n. 3
0
    def filename_mobile_locations(self, observable, daynumber):
        """Generate individual filename for locations."""

        patterns = self.filename_patterns_mobile_locations(observable)
        return os.path.join(*[
            datetime_numeric.build_from_pattern(pattern,
                                                epoch_plus_days(daynumber))
            for pattern in patterns
        ])
Esempio n. 4
0
    def filename_observations(self, observable, daynumber):
        """Generate individual filename for data on specified day for the specified observable."""

        patterns = self.filename_patterns_observations(observable)
        return os.path.join(*[
            datetime_numeric.build_from_pattern(pattern,
                                                epoch_plus_days(daynumber))
            for pattern in patterns
        ])
Esempio n. 5
0
    def filename_from_patterns(self, patterns, key):

        if type(key) is int:
            t = epoch.epoch_plus_days(key)

        paths = [
            datetime_numeric.build_from_pattern(pattern, t)
            for pattern in patterns
        ]
        name = os.path.join(*paths)
        return name
Esempio n. 6
0
    def create_output_entry(self, patterns, operation_index):
        """Use the patterns to create and return an output entry for the specified operation."""

        # Compute time at this index
        t = self.time_at_index(operation_index)

        # Generate filename
        paths = [
            datetime_numeric.build_from_pattern(pattern, t)
            for pattern in patterns
        ]
        name = os.path.join(*paths)

        # Build the entry
        return CatalogueFileEntry(name, t)
Esempio n. 7
0
    def build_pathname(self, basepath, daynumber):
        """ Build whole pathname from basepath and daynumber. """

        # Get pattern
        patterns = self.build_pathname_patterns()

        # Convert daynumber to datetime object
        fieldtime = epoch_plus_days(daynumber)

        # initialise pathname to basepath
        pathname = basepath

        # Fill date fields and append
        for pattern in patterns:
            pathname = os.path.join(
                pathname,
                datetime_numeric.build_from_pattern(pattern, fieldtime))

        return pathname