| 12 | self.read() |
| 13 | |
| 14 | def read(self): |
| 15 | if self.exists(): |
| 16 | with open(self.gcp_path, 'r') as f: |
| 17 | contents = f.read().strip() |
| 18 | |
| 19 | lines = list(map(str.strip, contents.split('\n'))) |
| 20 | if lines: |
| 21 | self.raw_srs = lines[0] # SRS |
| 22 | |
| 23 | for line in lines[1:]: |
| 24 | if line != "" and line[0] != "#": |
| 25 | parts = line.split() |
| 26 | if len(parts) >= 6: |
| 27 | self.entries.append(line) |
| 28 | else: |
| 29 | logger.warning("Malformed GCP line: %s" % line) |
| 30 | else: |
| 31 | logger.warning("GCP file %s does not exist" % self.gcp_path) |
| 32 | |
| 33 | def iter_entries(self): |
| 34 | for entry in self.entries: |