-
Notifications
You must be signed in to change notification settings - Fork 83
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
Set default of mask_and_scale
to True
in open_rasterio
#495
Comments
mask_and_scale
to True
mask_and_scale
to True
in open_rasterio
It is that way because the If the option is to change in the future, first a release of |
Thanks for the explanation! It looks like there are two contrasting needs here:
I guess the name of the function warrants priority to 1), and actually this is more of a Probably a more logical way of working for people in the 2) category (like myself) is to use |
Yes, it is. |
... not sure if this is the right place to mention this but since I just stumbled upon this issue while trying to avoid memory-overloads from unnecessary float-conversions while reading large GeoTIFFs, I thought I add a comment here. It seems that at the moment using import xarray as xar
with xar.open_dataset("path_to_GeoTIFF.tif") as raster:
print(raster.band_data.dtype)
# >>> dtype('float32')
print(raster.band_data.encoding)
# >>> {'dtype': 'int16',
# >>> 'scale_factor': 1.0,
# >>> 'add_offset': 0.0,
# >>> '_FillValue': -9999.0,
# >>> 'grid_mapping': 'spatial_ref',
# >>> 'rasterio_dtype': 'int16'} Is this intentional? If a dataset is actually not encoded, I'd prefer to avoid unnecessary float-conversion as much as possible... |
Yes, this is required. It is due to the |
In
xarray.open_dataset
, the optional argumentsmask_and_scale
defaults toTrue
(doc), which is what I expect almost any user prefers.I was surprised to find out that in
rioxarray.open_rasterio
the same argument defaults toFalse
.The text was updated successfully, but these errors were encountered: