Exemplo n.º 1
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
Exemplo n.º 2
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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 5
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
Exemplo n.º 6
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