I have the NumPy array and its bounding box coordinates. I have tried to convert it into raster using rasterio, based on this answer, and it did save it as raster, but when I use rasterio.show the coordinates are very wrong.
This is the script I have used:
bbox_coords_wgs84=[-101.7359960059834, 20.21904081937658, -100.5717967351885, 20.8312118894487] #variables for the projection: minx=bbox_coords_wgs84 maxy=bbox_coords_wgs84 pixel_size= 10 #according to the post on GIS SO: import rasterio from rasterio.transform import from_origin transform=from_origin(minx,maxy,pixel_size,pixel_size) crs_img='EPSG:4326' with rasterio.open('test1.tif', 'w', driver='GTiff', height=ndvi.shape, width=ndvi.shape, count=1, dtype=ndvi.dtype, crs=crs_img, nodata=None, # change if data has nodata value transform=transform) as dst: dst.write(ndvi, 1) #display the results: from matplotlib import pyplot from rasterio.plot import show src = rasterio.open('test1.tif') show(src)
As you can see, the numbers are absolutely not the correct coordinates.
My end goal: to be able to reproject the NumPy array into WGS84 correctly.
*This post relates also to this post