Project

General

Profile

Revision 841:49ca3a4a5dbe

ID49ca3a4a5dbe
Parent 839:8f07baeb93fe
Child 842:dc2e941442e0

Added by Maarten Sneep about 2 years ago

Improve logging when files do not pass senting time filter

View differences:

src/pycama/File.py
106 106
        self.mode = mode
107 107
        ## Has this file been opened before? Needed for progress messages.
108 108
        self.been_opened = False
109
        self.time_warning_given = False
109 110
        ## The name of the product as requested. Needed for product mapping (offline use).
110 111
        self.request_product = product
111 112
        ## the file reference.
......
182 183
            try:
183 184
                self._ref = h5py.File(self.path, self.mode)
184 185
            except (RuntimeError, OSError) as err:
185
                raise CAMAException("Error on {0}: '{1}'".format(self.name, str(err)))
186
                raise CAMAException("Error on {0}: '{1}'".format(self.path, str(err)))
186 187
        return self._ref
187 188

  
188 189
    ## Find a reference to a variable in a given file (recursively in groups)
......
439 440
                self.logger.debug("Use file, no time limits were given")
440 441
        elif start is None and stop is not None:
441 442
            r = t < stop
442
            if not self.been_opened:
443
                if r:
444
                    self.logger.debug("Use file, '%s' is before '%s'", t, stop)
445
                else:
446
                    self.logger.debug("Skip file, '%s' is after '%s'", t, stop)
443
            if not self.been_opened and r:
444
                self.logger.debug("Use file, '%s' is before '%s'", t, stop)
445
            elif not self.time_warning_given and not r:
446
                self.logger.info("Skip file, '%s' is after '%s'", t, stop)
447 447
        elif start is not None and stop is None:
448 448
            r = start <= t
449
            if not self.been_opened:
450
                if r:
451
                    self.logger.debug("Use file, '%s' is after '%s'", t, start)
452
                else:
453
                    self.logger.debug("Skip file, '%s' is before '%s'", t, start)
449
            if not self.been_opened and r:
450
                self.logger.debug("Use file, '%s' is after '%s'", t, start)
451
            elif not self.time_warning_given and not r:
452
                self.logger.info("Skip file, '%s' is before '%s'", t, start)
454 453
        else:
455 454
            r = start <= t < stop
456
            if not self.been_opened:
457
                if r:
458
                    self.logger.debug("Use file, '%s' is between '%s' and '%s'", t, start, stop)
459
                else:
460
                    self.logger.debug("Skip file, '%s' is not between '%s' and '%s'", t, start, stop)
455
            if not self.been_opened and r:
456
                self.logger.debug("Use file, '%s' is between '%s' and '%s'", t, start, stop)
457
            elif not self.time_warning_given and not r:
458
                self.logger.info("Skip file, '%s' is not between '%s' and '%s'", t, start, stop)
459
        if not r:
460
            self.time_warning_given = True
461
            
461 462
        return r
462 463

  
463 464
    ## Is this an actual file?

Also available in: Unified diff