Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong output raster file defined #102

Open
hessandrea opened this issue Jan 15, 2020 · 0 comments
Open

Wrong output raster file defined #102

hessandrea opened this issue Jan 15, 2020 · 0 comments

Comments

@hessandrea
Copy link

I've just followed the steps in your script to calculate top of atmosphere reflection (toar_planetscope.ipynb). It's really easy to follow. Thank you for providing this!

I think I've found a typo and figured I'd make you aware of it.
In [6] is the section where you set the characteristics of the output file to unint16. Then you rescale the reflectance bands from float so that they can be saved as unint16.
However, in the call to save the raster file, you define the reflectance file and not the rescaled file as output file.
If I understand this correctly, this would try to save the float values as unint16, resulting in an output file that has pretty much only 0 values.

I believe the section
with rasterio.open('data/reflectance.tif', 'w', **kwargs) as dst:
dst.write_band(1, band_blue_reflectance.astype(rasterio.uint16))
dst.write_band(2, band_green_reflectance.astype(rasterio.uint16))
dst.write_band(3, band_red_reflectance.astype(rasterio.uint16))
dst.write_band(4, band_nir_reflectance.astype(rasterio.uint16))

would have to be changed into:

with rasterio.open('data/reflectance.tif', 'w', **kwargs) as dst:
dst.write_band(1, blue_ref_scaled.astype(rasterio.uint16))
dst.write_band(2, green_ref_scaled .astype(rasterio.uint16))
dst.write_band(3, red_ref_scaled .astype(rasterio.uint16))
dst.write_band(4, nir_ref_scaled .astype(rasterio.uint16))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant