Managed to figure out the what was causing the issue after some troubleshooting. I'm using the gdal package from SNAP (Sentinel Application Platform) to run this code. There was a problem with the images i was saving through SNAP's graph processing tool. There was no error message generated but rasterio had trouble opening it. I'd missed the warning messages on the image.
Note the warning message through gdalinfo
Warning 1: TIFFReadDirectory:Bogus "StripByteCounts" field, ignoring and calculating from imagelength
Driver: GTiff/GeoTIFF
Files: vv-gamma0.tif
Size is 4284, 4077
Coordinate System is:
GEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
CS[ellipsoidal,2],
AXIS["geodetic latitude (Lat)",north,
ORDER[1],
ANGLEUNIT["degree",0.0174532925199433]],
AXIS["geodetic longitude (Lon)",east,
ORDER[2],
ANGLEUNIT["degree",0.0174532925199433]],
USAGE[
SCOPE["unknown"],
AREA["World"],
BBOX[-90,-180,90,180]],
ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
Origin = (47.326717760975129,-18.718723510025118)
Pixel Size = (0.000089859555849,-0.000089859555849)
Metadata:
AREA_OR_POINT=Area
TIFFTAG_IMAGEDESCRIPTION=vv-gamma0
TIFFTAG_RESOLUTIONUNIT=1 (unitless)
TIFFTAG_XRESOLUTION=1
TIFFTAG_YRESOLUTION=1
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 47.3267178, -18.7187235) ( 47d19'36.18"E, 18d43' 7.40"S)
Lower Left ( 47.3267178, -19.0850809) ( 47d19'36.18"E, 19d 5' 6.29"S)
Upper Right ( 47.7116761, -18.7187235) ( 47d42'42.03"E, 18d43' 7.40"S)
Lower Right ( 47.7116761, -19.0850809) ( 47d42'42.03"E, 19d 5' 6.29"S)
Center ( 47.5191969, -18.9019022) ( 47d31' 9.11"E, 18d54' 6.85"S)
Band 1 Block=4284x4077 Type=Float32, ColorInterp=Gray
I had missed setting the Linux shared environment variable after restarting the system. This resolved the error on my part.
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/admin/snap/bin
Best Answer
I managed to get this to work on Windows with Anaconda following these steps:
I first downloaded whl files for Gdal and Rasterio as suggested on the rasterio page (e.g. from here for rasterio). I chose files for python 3.7 as I already had this combination working for big tiffs on a Linux platform.
Then in Anaconda: