def parse_coverage_band_line(self, coverage_name, line):
     """
     Parses a line in the log file which already contains the coverage.
     :param <string> line: a log line in which the searched coverage is addressed.
     :return: <[HACoverageBandInfo]> list of objects describing the bands accessed in the current line.
     """
     ret = []
     if self.range_subset_key in line.lower():
         split = line.split(self.range_subset_key)
         focus = split[1]
         # check if the range subset is given in the middle of the request or at the end
         if self.and_key in focus:
             # in the middle, do further split
             focus = focus.split(self.and_key)[0]
         else:
             # otherwise focus is at the end followed by a space
             focus = focus.split(" ")[0]
         # check if there are several bands accessed
         if self.comma_key in focus:
             bands = focus.split(self.comma_key)
         elif self.column_key in focus:
             bands = focus.split(self.column_key)
         else:
             bands = [focus]
         # add all the bands to the result
         date = HAParser.parse_date(line)
         for band in bands:
             ret.append(HACoverageBandsInfo(date, coverage_name, band, 1))
     return ret
 def parse_coverage_band_line(self, coverage_name, line):
     """
     Parses a line in the log file which already contains the coverage.
     :param <string> line: a log line in which the searched coverage is addressed.
     :return: <[HACoverageBandInfo]> list of objects describing the bands accessed in the current line.
     """
     ret = []
     if self.range_subset_key in line.lower():
         split = line.split(self.range_subset_key)
         focus = split[1]
         # check if the range subset is given in the middle of the request or at the end
         if self.and_key in focus:
             # in the middle, do further split
             focus = focus.split(self.and_key)[0]
         else:
             # otherwise focus is at the end followed by a space
             focus = focus.split(" ")[0]
         # check if there are several bands accessed
         if self.comma_key in focus:
             bands = focus.split(self.comma_key)
         elif self.column_key in focus:
             bands = focus.split(self.column_key)
         else:
             bands = [focus]
         # add all the bands to the result
         date = HAParser.parse_date(line)
         for band in bands:
             ret.append(HACoverageBandsInfo(date, coverage_name, band, 1))
     return ret
Exemplo n.º 3
0
 def parse_line(self, line):
     """
     Parses the information about bounding boxes addressed in a log line.
     :param <string> line: a log line representing a wms request.
     :return: <HABox>: the bbox corresponding to the line, None if not all the coordinates are given.
     """
     if self.wcs_bbox_key in line:
         bbox = self.extract_wcs_bbox(line)
         if bbox is not None:
             return HABboxAccessInfo(HAParser.parse_date(line), bbox, 1)
     if self.wms_bbox_key in line:
         bbox = self.extract_wms_bbox(line)
         if bbox is not None:
             return HABboxAccessInfo(HAParser.parse_date(line), bbox, 1)
     # in case there is no bbox
     return None
 def parse_line(self, line, accessed_coverages):
     """
     Parses a log line, extracting information about the coverages accessed in the line.
      :param <string> line: the log line to be parsed.
      :return: <[HAUsedCoveragesInfo]> a list of objects describing the coverages accessed in this line.
     """
     ret = []
     for coverage_name in accessed_coverages:
         if coverage_name.lower() in line:
             ret.append(HAUsedCoveragesInfo(HAParser.parse_date(line), coverage_name, 1))
     return ret
Exemplo n.º 5
0
 def parse_line(self, line, accessed_coverages):
     """
     Parses a log line, extracting information about the coverages accessed in the line.
      :param <string> line: the log line to be parsed.
      :return: <[HAUsedCoveragesInfo]> a list of objects describing the coverages accessed in this line.
     """
     ret = []
     for coverage_name in accessed_coverages:
         if coverage_name.lower() in line:
             ret.append(
                 HAUsedCoveragesInfo(HAParser.parse_date(line),
                                     coverage_name, 1))
     return ret