code: def split_raster(rs, split_shp, field_name, temp_dir):
          
          UtilClass.rmmkdir(temp_dir)
          ds = ogr_Open(split_shp)
          lyr = ds.GetLayer(0)
          lyr.ResetReading()
          ft = lyr.GetNextFeature()
          while ft:
              cur_field_name = ft.GetFieldAsString(field_name)
              for r in rs:
                  cur_file_name = r.split(os.sep)[-1]
                  outraster = temp_dir + os.sep + \
                              cur_file_name.replace('.tif', '_%s.tif' %
                                                    cur_field_name.replace(' ', '_'))
                  subprocess.call(['gdalwarp', r, outraster, '-cutline', split_shp,
                                   '-crop_to_cutline', '-cwhere',
                                   "'%s'='%s'" % (field_name, cur_field_name), '-dstnodata',
                                   '-9999'])
              ft = lyr.GetNextFeature()
          ds = None
docs: Split raster by given shapefile and field name.
  
          Args:
              rs: origin raster file.
              split_shp: boundary (ESRI Shapefile) used to spilt raster.
              field_name: field name identify the spilt value.
              temp_dir: directory to store the spilt rasters.