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

Support for LERC & LERC_DEFLATE compression #2270

Closed
maawoo opened this issue Aug 25, 2021 · 4 comments
Closed

Support for LERC & LERC_DEFLATE compression #2270

maawoo opened this issue Aug 25, 2021 · 4 comments

Comments

@maawoo
Copy link

maawoo commented Aug 25, 2021

Expected behavior and actual behavior.

Expected: LERC and LERC_DEFLATE compression options are available with GDAL >= 3.3.0 and libtiff >= 4.3.0 (as described here)

Actual: I guess they're not available?

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/tmp/ipykernel_17587/957075258.py in <module>
      1 with rasterio.open(test_file) as raster:
----> 2     raster.profile

rasterio/_base.pyx in rasterio._base.DatasetBase.profile.__get__()

rasterio/_base.pyx in rasterio._base.DatasetBase.compression.__get__()

~/.conda/envs/COPA_cube/lib/python3.9/enum.py in __call__(cls, value, names, module, qualname, type, start)
    382         """
    383         if names is None:  # simple value lookup
--> 384             return cls.__new__(cls, value)
    385         # otherwise, functional API: we're creating a new Enum type
    386         return cls._create_(

~/.conda/envs/COPA_cube/lib/python3.9/enum.py in __new__(cls, value)
    700                 ve_exc = ValueError("%r is not a valid %s" % (value, cls.__qualname__))
    701                 if result is None and exc is None:
--> 702                     raise ve_exc
    703                 elif exc is None:
    704                     exc = TypeError(

ValueError: 'LERC_DEFLATE' is not a valid Compression

Steps to reproduce the problem.

with rasterio.open(my_raster) as raster:
    raster.profile

Relevant information from gdalinfo about the raster file:

Image Structure Metadata:
  COMPRESSION=LERC_DEFLATE
  INTERLEAVE=BAND
  LERC_VERSION=2.4

Operating system

CentOS 7.9.2009

Rasterio version and provenance

libgdal                   3.3.1                h8f005ca_1    conda-forge
rasterio                  1.2.6            py39hbc4e497_2    conda-forge
libtiff                   4.3.0                hf544144_1    conda-forge

I also double-checked by creating a new conda environment locally on my Windows machine, only installing rasterio (same version as above) and try with the same raster file. Results in the same error.

@vincentsarago
Copy link
Member

@maawoo LERC is an optional driver in GDAL and thus is not included in rasterio wheels. If you install rasterio from source (pip install rasterio --no-binary rasterio) in an environment where GDAL has been compiled with LERC option ON it should work.

ps: The mapbox/rasterio repo and its maintainers are not responsible for the conda packages

@maawoo
Copy link
Author

maawoo commented Aug 25, 2021

@vincentsarago thanks for your insight!
Are there any plans to include LERC in the rasterio wheels in the near future?

There's currently work being done on a new Sentinel-1 NRB product, which will likely use LERC_DEFLATE for compression.
Would be great if users can use Python tools such as rasterio with this data product without running into any additional hassles.

ping @johntruckenbrodt, as this will probably interest you as well.

@vincentsarago
Copy link
Member

you can open an issue in https://github.com/rasterio/rasterio-wheels

@sgillies
Copy link
Member

It's a challenge to keep up with all the new GDAL features. There has been an explosion in the number of compression options 😆

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

3 participants