-
Notifications
You must be signed in to change notification settings - Fork 303
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
question: save geotiff without modifying pixel value #640
Comments
This isn't terribly well documented, but see the docstring for the geotiff writer here. In summary: scn.save_datasets(writer=’geotiff’, dtype=np.float32, enhance=False) |
@ybcheng Did you get it to work ? |
Hi, I am piggy-backing on to this issue, because I have a similar problem. I would like to preserve the values in an image from dataset. At the moment when I use save_datasets or save_dataset, the image is changed so that the pixel values lie between 0 and 255. Running the line of code djhoese recommended above I get a message: |
@dtlloyd Usually in cases like this it is best to provide the full traceback for your error so we can see where the issue is coming from. |
@djhoese Thanks for the quick reply. The full traceback looks like:
|
This looks like it is trying to save to a PNG even though you asked it to save as a geotiff. Have you customized your environment/configs at all? What happens if you pass FYI I edited your comment to put your traceback in three backticks (`) on each end. It shows up better for code literals than quoted blocks (>). |
Thanks for amending my comment and helping me out with this problem. I don't recall customising the environment or configs at all. I am running SatPy in a Jupyter notebook. Could that be a problem? As for passing a Perhaps if I told you what I am trying to do, you may be able to suggest a work around. I have resampled the Sentinel 3 dataset to a new map projection. I now want to either save one of the Sentinel 3 bands as a geotiff and work on that, or write the same Sentinel 3 band to a numpy array and work on that. Is there a different way I can do that in SatPy? |
Oh, so you just want to work with the data? You can use the xarray my_data_arr = scn['band_name']
my_np_arr = my_data_arr.compute().data The I'd like to still investigate this issue you're having but I'm not exactly sure where to go from here. I'll try some stuff locally. |
Fantastic advice @djhoese. That's exactly what I wanted to do. I am not sure how I missed that in the documentation. If there is anything more I can do to help you debug this issue please let me know. |
@dtlloyd Do you have Edit: I'm not able to reproduce this with ABI data. |
satpy version 0.13.0 I have rasterio installed but not imported. It was imported in another notebook open at the same time as the satpy one I am working from. I am afraid that I can't replicate the bug now. I have tried restarting the kernel a couple of times and I no longer get an error when I run |
I'm calling this closed. If someone has this same issue again then please open a new issue and reference this. Thanks. |
Hi,
I'm using satpy to read, resample and save GOES-16 L1b radiance data. I've noticed the pixel values in the output geotiff file are re-mapped to the new bit-depth (e.g. 8bit or 16bit) instead of the original value. For instance, if the max pixel value is 200 in a scene, it will be scaled to 255 in a 8bit image or 65535 in a 16bit image. Is there any way to disable the auto scaling of pixel values? the values in the radiance data has physical meanings and I don't them to be changed.
Thank you,
The text was updated successfully, but these errors were encountered: