Open-Source-Spatial-Clean-Cooking-Tool / OnStove

This repository contain the general code for the Open Source Spatial Clean Cooking Tool OnStove
MIT License
7 stars 9 forks source link

Rasterize wealth index #134

Closed camiloramirezgo closed 2 years ago

camiloramirezgo commented 2 years ago

Create a function to rasterize the relative wealth index inside OnSSTOVE.

babakkhavari commented 2 years ago

Code works. But we need to get the resolution to be around 0.022 degrees as discussed in our Slack on the 30th of August. What is the easiest way to do this? Basically we need:

  1. ensure the extent is the countries and
  2. the resolution is correct

Maybe for this specific case we can modify this part of the code to not read res and extent from the raster but rather the extent from the csv and the resolution hardcoded?:

with rasterio.open(raster_base_layer) as src:
        image = features.rasterize(
                    shapes,
                    out_shape=src.shape,
                    transform=src.transform,
                    all_touched=all_touched,
                    fill=nodata)

        out_meta = src.meta

        out_meta.update({"driver": "GTiff",
                         "height": src.height,
                         "width": src.width,
                         "transform": src.transform,
                         'compress': compression,
                         'dtype': dtype,
                         "crs": src.crs,
                         'nodata': nodata})
camiloramirezgo commented 2 years ago

Another option is to sample the data taking the nearest point.