Copy¶
Copy parameters¶
Parameters used to create or copy rasters:
from girs.rast.raster import RasterReader
r = RasterReader('D:/tmp/chirps/chirps-v2.0.2016.01.10.tif')
rp = r.get_parameters()
print rp.RasterXSize, rp.RasterYSize
print rp.number_of_bands
print rp.data_types
print rp.geo_trans
print rp.nodata
print rp.srs
Copy¶
from girs.rast.raster import RasterReader, copy
# 1) Using the function from file to file
copy('D:/tmp/chirps/chirps-v2.0.2016.01.10.tif', 'D:/tmp/chirps-v2.0.2016.01.10.tif')
r = RasterReader('D:/tmp/chirps/chirps-v2.0.2016.01.10.tif')
# 2) Using the function from object to file
copy(r, 'D:/tmp/chirps-v2.0.2016.01.10.tif')
# 3) Using the method
r.copy('D:/tmp/chirps-v2.0.2016.01.10.tif')
# 4) Get a RAM copy
r_mem = copy(r, 'mem')
print r_mem.get_parameters()
# DIM[17, 13] NB[1] ND[-9999.0] DT[6] DRV[GTiff] SRS[WGS 84] TRANS(-47.25, 0.25, 0.0, -18.0,... 0.0, -0.25)