def __init__(self,input_raster,data_type=np.uint16,band_selection=0,projection=None): self.input_raster = input_raster self.band_list = read_image(input_raster, data_type, band_selection) self.rows, self.cols, self.nbands, self.geo_transform, self.projection = read_image_parameters(input_raster) if projection and self._parser_projection != projection: self.__change_projection(projection) self.resolution = abs(self.geo_transform[1])
def __band_list(self,std_fix=True): raster_arrays_str = " ".join([raster.input_raster for raster in self.__rasters]) self.tmpfile = tempfile.NamedTemporaryFile().name cmd = RasterGdalExtent.GDAL_MERGE_CMD+str(" -init \"0 0 255\" -n 0 -o {} ".format(self.tmpfile))+raster_arrays_str executeGdal(cmd) output_band = read_image(self.tmpfile,0,0) return output_band