def read_aoi(self, aoi): """Read AOI from GeoJSON file or directly from WKT. :param aoi: area of interest (WKT) :return str: WKT string """ if re.search('Polygon\s*(.*)', aoi, re.IGNORECASE): # Fedeo is very pendatic, polygon must be uppercase return aoi.upper().replace('POLYGON ', 'POLYGON') try: # could be replaced by geojson + shapely from sentinelsat.sentinel import geojson_to_wkt, read_geojson except ImportError as e: Logger.critical("{} processor: {}".format(self.identifier, e)) return None # GeoJSON return geojson_to_wkt(read_geojson(aoi))
def load(self, response_file): """Load QI metadata content from file. :param str response_file: input filename (JSON file) :return dict: file content or None on error """ try: with open(response_file) as fd: response_content = fd.read() except FileNotFoundError: Logger.critical("No response file found") return None try: return json.loads(response_content) except json.decoder.JSONDecodeError as e: Logger.error("File {} is not valid JSON file: {}".format( response_file, e)) return response_content
def __init__(self, processor, msg): Logger.critical("{} processor dependency error: {}".format( processor.__class__.__name__, msg))
def __init__(self, msg): Logger.critical("{}".format(msg))
def __init__(self, processor): Logger.critical("{} processor: results not defined".format( processor.__class__.__name__))