Examples used in this tutorialΒΆ
We use precipitation rasters from January to September 2016 obtained from CHIRPS to demonstrate the package. They are clipped to a shapefile with four subbasins in order to reduce their sizes.
You will see more below, but for now this is how the 274 clips were done:
from girs.rast.raster import RasterReader
from girs.feat.layers import LayersReader
lrs = LayersReader('D:/tmp/girs/riverbasins.shp')
env = lrs.get_extent()
d_in, d_out = 'D:/tmp/girs/chirps_original', 'D:/tmp/girs/chirps'
for f in os.listdir(d_in):
r = RasterReader(os.path.join(d_in, f))
r.clip_by_extent(extent=env, scale=1.2, output_raster=os.path.join(d_out, f))