示例#1
0
    def exportRaster():
        try:
            os.chdir(r"C:/xxx")
            print("loading object from disk")
            c = fileIO.load_object("NDVI2014-09-17")
            dataset = indexed_numpy_to_raster_dataset(c, "NDVI2014-09-17COPY.tif", outfolder=os.getcwd(), datatype=gdct.GDT_Float32, nodata=-10, returnlist=True, frmt="GTiff")
            return dataset

        except Exception as e:
            print(e)
示例#2
0
    def exportRaster():
        try:
            os.chdir(r"C:/xxx")
            print("loading object from disk")
            c = fileIO.load_object("NDVI2014-09-17")
            dataset = indexed_numpy_to_raster_dataset(c, "NDVI2014-09-17COPY.tif", outfolder=os.getcwd(), datatype=gdct.GDT_Float32, nodata=-10, returnlist=True, frmt="GTiff")
            return dataset

        except Exception as e:
            print(e)
示例#3
0
    def importSingleBandRaster():
        d = None
        try:
            os.chdir(r"C:/xxx")
            rasterpath = r"NDVI2014-09-17.tif"
            d = gdal.Open(rasterpath)
            b = raster_dataset_to_indexed_numpy(d, os.path.basename(rasterpath), maxbands=1, bandLocation="bycolumn", nodata=-10)
            print("saving object to disk")
            fileIO.save_object("C:/xxx/NDVI2014-09-17", b)
            print("loading object from disk")
            c = fileIO.load_object("C:/xxx/NDVI2014-09-17")
            return b, c

        except Exception as e:
            print(e)
        finally:
            if d is not None:
                d = None
示例#4
0
    def importRaster():
        d = None
        try:
            os.chdir(r"C:\xxx")
            rasterpath = r"new\EV_2003_al_warp.bsq"
            d = gdal.Open(rasterpath)
            b = raster_dataset_to_indexed_numpy(d, os.path.basename(rasterpath), maxbands = 10, bandLocation="bycolumn", nodata= -3.40282e+038)
            print("saving object to disk")
            fileIO.save_object("C:/xxx/EV_2003_al_warp", b)
            print("loading object from disk")
            c = fileIO.load_object("C:/xxx/EV_2003_al_warp")
            return b, c

        except Exception as e:
            print(e)
        finally:
            if d is not None:
                d = None
示例#5
0
    def importSingleBandRaster():
        d = None
        try:
            os.chdir(r"C:/xxx")
            rasterpath = r"NDVI2014-09-17.tif"
            d = gdal.Open(rasterpath)
            b = raster_dataset_to_indexed_numpy(d, os.path.basename(rasterpath), maxbands=1, bandLocation="bycolumn", nodata=-10)
            print("saving object to disk")
            fileIO.save_object("C:/xxx/NDVI2014-09-17", b)
            print("loading object from disk")
            c = fileIO.load_object("C:/xxx/NDVI2014-09-17")
            return b, c

        except Exception as e:
            print(e)
        finally:
            if d is not None:
                d = None
示例#6
0
    def importRaster():
        d = None
        try:
            os.chdir(r"C:\xxx")
            rasterpath = r"new\EV_2003_al_warp.bsq"
            d = gdal.Open(rasterpath)
            b = raster_dataset_to_indexed_numpy(d, os.path.basename(rasterpath), maxbands = 10, bandLocation="bycolumn", nodata= -3.40282e+038)
            print("saving object to disk")
            fileIO.save_object("C:/xxx/EV_2003_al_warp", b)
            print("loading object from disk")
            c = fileIO.load_object("C:/xxx/EV_2003_al_warp")
            return b, c

        except Exception as e:
            print(e)
        finally:
            if d is not None:
                d = None
示例#7
0
    def importSingleBand():
        d = None
        band = None
        try:
            os.chdir(r"C:\xxx")
            rasterpath = r"new\EV_2003_al_warp.bsq"

            d = gdal.Open(rasterpath)
            band = d.GetRasterBand(1)
            print ("exporting to indexed numpy array")
            a = single_band_to_indexed_numpy(band)
            print ("saving object to disk")
            fileIO.save_object("C:/xxx/EV_2003_single", a)
            print ("loading object from disk")
            c=fileIO.load_object("C:/xxx/EV_2003_single")
            return a,c

        except Exception as e:
            print (e)
        finally:
            if d is not None:
                d = None
            if band is not None:
                band = None
示例#8
0
    def importSingleBand():
        d = None
        band = None
        try:
            os.chdir(r"C:\xxx")
            rasterpath = r"new\EV_2003_al_warp.bsq"

            d = gdal.Open(rasterpath)
            band = d.GetRasterBand(1)
            print ("exporting to indexed numpy array")
            a = single_band_to_indexed_numpy(band)
            print ("saving object to disk")
            fileIO.save_object("C:/xxx/EV_2003_single", a)
            print ("loading object from disk")
            c=fileIO.load_object("C:/xxx/EV_2003_single")
            return a,c

        except Exception as e:
            print (e)
        finally:
            if d is not None:
                d = None
            if band is not None:
                band = None