def exportRaster(): try: #ilw.Engine.setWorkingCatalog("file:///C:/xxx/new") ilw.Engine.setWorkingCatalog("file:///D:/xxx/new") print ('loading object from disk') c=fileIO.loadObject('D:/xxx/new/T_2010_all_warp') #c=fileIO.loadObject('C:/xxx/randomforest') bands=indexedNumpyToRasterDataset(c,nodata=-10, returnlist=True) bands[1].store('newraster', 'GTiff', 'gdal') return bands except Exception as e: print (e)
def importSingleBandRaster(): try: ilw.Engine.setWorkingCatalog("file:///D:/xxx/new") raster = ilw.RasterCoverage("T_2010_all_warp.bsq") b=rasterCoverageToIndexedNumpy(raster,28992,1,'bycolumn') print ('saving object to disk') fileIO.saveObject('D:/xxx/T_2010_all_warp_1',b) print ('loading object from disk') c=fileIO.loadObject('D:/xxx/T_2010_all_warp_1') return b,c except Exception as e: print (e)
def importRaster(): try: ilw.Engine.setWorkingCatalog("file:///C:/xxx") raster = ilw.RasterCoverage("EV_2003_al_warp.bsq") b=rasterCoverageToIndexedNumpy(raster,28992,366,'bycolumn') print ('saving object to disk') fileIO.saveObject('C:/xxx/new/EV_2003_al_warp',b) print ('loading object from disk') c=fileIO.loadObject('C:/xxx/new/EV_2003_al_warp') return b,c except Exception as e: print (e)
def importRaster(): try: ilw.Engine.setWorkingCatalog("file:///C:/xxx") raster = ilw.RasterCoverage("EV_2003_al_warp.bsq") b = rasterCoverageToIndexedNumpy(raster, 28992, 366, 'bycolumn') print('saving object to disk') fileIO.saveObject('C:/xxx/new/EV_2003_al_warp', b) print('loading object from disk') c = fileIO.loadObject('C:/xxx/new/EV_2003_al_warp') return b, c except Exception as e: print(e)
def importSingleBand(): try: ilw.Engine.setWorkingCatalog("file:///D:/xxx/new") raster = ilw.RasterCoverage("T_2010_all_warp.bsq") print ('creating pixel iterator') it = iter(raster) print ('exporting to indexed numpy array') a=singleBandToIndexedNumpy(it) print ('saving object to disk') fileIO.saveObject('D:/xxx/new/T_2010_single',a) print ('loading object from disk') c=fileIO.loadObject('D:/xxx/new/T_2010_single') return a,c except Exception as e: print (e)