class Writer(IoHandler): data = attr.ib() io_options = attr.ib(type=Options()) def save(self, path: str): raise NotImplemented() def options(self, **kwargs): current_options = super().options(**kwargs) return self.__class__(data=self.data, io_options=current_options) def format(self, format: str): try: default_options = getattr(DefaultOptionWrite, format)() except AttributeError: raise FormatNotAvailable("Can not found requested format") return self.__class__(data=self.data, io_options=default_options) @property def format_name(self): raise NotImplementedError() @format_name.setter def format_name(self, value: str): raise NotImplementedError
def geotiff(cls): return Options( { "format": "geotiff", "dtype": gdal.GDT_Byte, "crs": None } )
def wkt(cls): return Options({ "format": "wkt", "crs": None, "pixel": None, "value": 1, "extent": None })
def csv(cls): return Options( { "format": "csv", "delimiter": ",", "header": "," } )
def sentinel(cls): return Options({ "format": "sentinel", "extent": None, "user": None, "password": None, "pixel": None })
def geojson(cls): return Options({ "format": "shp", "driver": "GeoJSON", "type": None, "crs": None, "extent": None, "pixel": None, "value": 1, "all_unique": "False", "color_column": None })
def shp(cls): return Options({ "format": "shp", "type": None, "driver": "ESRI Shapefile", "crs": None, "extent": None, "pixel": None, "value": 1, "all_unique": "False", "color_column": None })
def postgis_geom(cls): return Options({ "format": "postgis_geom", "type": None, "crs": None, "extent": None, "pixel": None, "value": 1, "all_unique": "False", "color_column": None, "schema": "public", "host": "localhost", "user": "******", "password": "******" })
''' MODEL :: Pytorch Computer Vision Platform DATE :: 2021-01-26 FILE :: main.py ''' from __future__ import absolute_import, division, print_function from config.options import Options from engine.train import Train opt = Options().parse() if __name__ == "__main__": if opt.isTrain: trainer = Train(opt).train() else: print("--- Wrong Mode ---")
def png(cls): return Options( { "format": "png" } )
def geotiff(cls): return Options({"format": "geotiff", "crs": None})