<jupyter_start><jupyter_text>Rasterize Bounding Boxes<jupyter_code>def rasterize(raster_layer, raster_path, vector_layer):
    
    raster = gdal.Open(raster_layer, gdal.GA_ReadOnly)
    raster_params = raster.GetGeoTransform()
    projection = raster.GetProjection()
    rasterDriver = gdal.GetDriverByName('VRT')

    vector = ogr.Open(vector_layer)
    vector = vector.GetLayer()

    temporary_source = rasterDriver.Create(raster_path  + "boundingbox_rasterization.tif", 
                                 raster.RasterXSize, 
                                 raster.RasterYSize,
                                 1, #missed parameter (band)
                                 gdal.GDT_Float32)

    temporary_source.SetGeoTransform(raster_params)
    temporary_source.SetProjection(projection)
    temporary_tile = temporary_source.GetRasterBand(1)
    temporary_tile.Fill(1)
    temporary_tile.SetNoDataValue(0)

    rasterization = gdal.RasterizeLayer(temporary_tile, [1], vector, options=["ATTRIBUTE=value"])

    temporary_source = None
    
    return rasterization
raster_path = os.getcwd()

raster_layer = "/media/seanandrewchen/seanchen_ssd/raster-data/noaa-images/noaa_images.vrt"
vector_layer = "bounding_boxes.shp"

# open the raster layer and get its relevant properties
raster = gdal.Open(raster_layer, gdal.GA_ReadOnly)
raster_params = raster.GetGeoTransform()
projection = raster.GetProjection()
rasterDriver = gdal.GetDriverByName('VRT')

rasterization = ogr.Open(vector_layer)
rasterization = rasterization.GetLayer()

# Create the destination data source
temporary_source = rasterDriver.Create(raster_path  + "boundingbox_rasterization.tif", 
                                 raster.RasterXSize, 
                                 raster.RasterYSize,
                                 1, #missed parameter (band)
                                 gdal.GDT_Float32)

temporary_source.SetGeoTransform(raster_params)
temporary_source.SetProjection(projection)
temporary_tile = temporary_source.GetRasterBand(1)
temporary_tile.Fill(1)
temporary_tile.SetNoDataValue(0)
gdal.RasterizeLayer(temporary_tile, [1], rasterization, options=["ATTRIBUTE=value"])
temporary_source = None
rasterio.mask.mask(dataset, shapes, all_touched=False, invert=False, nodata=None, filled=True, crop=False, pad=False, indexes=None)<jupyter_output><empty_output><jupyter_text>Lay BB Raster on NOAA Image VRT Mosaic  Tile NOAA Images  Revectorize BB Band into GeoJSON including Image Filename and Pixel Coordinates<jupyter_code>#
#<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08673469387755102, 'fraction_numerical': 0.005494505494505495, 'mean_word_length': 3.576301615798923, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '86661', 'license': 'MIT', 'n_tokens_mistral': 831, 'n_tokens_neox': 820, 'n_words': 130, 'path': 'notebooks/training-data-processing/clip_rasters.ipynb', 'repo_name': 'DDS-Lab/disaster-image-processing', 'size': '2548'}