Re: Rasterio result different than gdal_calc
Can you also include the expressions that you're using with gdal_calc? Without them we can only guess at the cause of the difference in the results. I don't see any big problems with the way you're using Rasterio. I have a couple comments below:
On Wed, Nov 21, 2018 at 3:35 PM anand via Groups.Io <email@example.com> wrote:
I am trying to recreate gdal_calc for simple calculation using below code.
You could convert this to a float32 now instead of doing it twice in a statement below.
Unless you're doing this in gdal_calc too, this could be a cause of differences. I think it would be better to add keyword argument `masked=True` when you read the source bands. This will give you masked arrays that are safer to work when calculating the NDVI.
If you didn't specify `astype(float)` here, Numpy would convert to float64 as soon as it performed the division operation, and would return a float64 ndarray.
Like I said, we need to see the gdal_calc expression. I suspect nodata pixels are involved.