LERC compression unknown with 3.4.2
aalcott opened this issue · 3 comments
Under version 3.2 of gdal, we were running a program to build mrf files using the following commands
self.outRaster = self.mrfDriver.Create( mrfFileName, self.config["numCols"], self.config["numRows"], 1, # number of bands, R G B self.config["dataType"], options=[ "Zsize={:d}".format(zSize), "UNIFORM_SCALE=2", # space for overviews self.config["MRF-OPTIONS"], "COMPRESS=LERC", "BlockSize={}".format(self.config["TILESIZE"]),
*the MRF-OPTIONS from our config file are "OPTIONS=V2=ON LERC_PREC=0.0001"
We recently updated to gdal 3.4.2 and have consistently received the error:
`Traceback (most recent call last):
File "/opt/anaconda3/envs/gdalenv/lib/python3.9/multiprocessing/pool.py", lin
e 125, in worker
result = (True, func(*args, **kwds))
File "/opt/anaconda3/envs/gdalenv/lib/python3.9/multiprocessing/pool.py", lin
e 51, in starmapstar
return list(itertools.starmap(args[0], args[1]))
File "/home/arcgis/gis-project/src/master.py", line 65, in execute_task
gdalMrf.driver(dtg, doy)
File "/home/arcgis/gis-project/src/mrf.py", line 468, in driver
self.run_day(mrfDataPath, year, doy)
File "/home/arcgis/gis-project/src/mrf.py", line 347, in run_day
self.mrf_3d_files(mrfDataPath, sliceNumber, year, doy)
File "/home/arcgis/gis-project/src/mrf.py", line 253, in mrf_3d_files
self.create_mrf(
File "/home/arcgis/gis-project/src/mrf.py", line 128, in create_mrf
self.outRaster = self.mrfDriver.Create(
File "/opt/anaconda3/envs/gdalenv/lib/python3.9/site-packages/osgeo/gdal.py",
line 2001, in Create
return _gdal.Driver_Create(self, *args, **kwargs)
RuntimeError: GDAL MRF: Error setting compression
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/arcgis/gis-project/src/master.py", line 150, in
main(params)
File "/home/arcgis/gis-project/src/master.py", line 95, in main
res = pool.starmap(execute_task, inputData)
File "/opt/anaconda3/envs/gdalenv/lib/python3.9/multiprocessing/pool.py", lin
e 372, in starmap
return self._map_async(func, iterable, starmapstar, chunksize).get()
File "/opt/anaconda3/envs/gdalenv/lib/python3.9/multiprocessing/pool.py", lin
e 771, in get
raise self._value
RuntimeError: GDAL MRF: Error setting compression`
Any assistance in enabling LERC compression under the new version would be appreciated. Let me know if more information or explanation is required.
Sounds like gdal was built without LERC.
Run "gdalinfo --format MRF" and check the output. If LERC is not listed as a compression, that is the problem, you will have to rebuild gdal and make sure LERC is enabled.
Hello @lucianpls, we are using a pre-packaged version of gdal found on https://anaconda.org/conda-forge/libgdal. As shown below, it appears that the package is not built with the LERC functionality. We are going to cross post this issue on https://github.com/conda-forge/gdal-feedstock/issues as it may be more applicable.
gdalinfo --format MRF
Format Details:
Short Name: MRF
Long Name: Meta Raster Format
Supports: Raster
Extension: mrf
Help Topic: drivers/raster/marfa.html
Supports: Open() - Open existing dataset.
Supports: Create() - Create writable dataset.
Supports: CreateCopy() - Create dataset by copying another.
Supports: Virtual IO - eg. /vsimem/
Creation Datatypes: Byte UInt16 Int16 Int32 UInt32 Float32 Float64
CreationOptionList
Option name="COMPRESS" type="string-select" default="PNG" description="PPNG = Palette PNG; DEFLATE = zlib "
ValueJPEG/Value
ValuePNG/Value
ValuePPNG/Value
ValueJPNG/Value
ValueTIF/Value
ValueDEFLATE/Value
ValueNONE/Value
ValueZSTD/Value
/Option
Option name="INTERLEAVE" type="string-select" default="PIXEL"
ValuePIXEL/Value
ValueBAND/Value
/Option
Option name="ZSIZE" type="int" description="Third dimension size" default="1" /
Option name="QUALITY" type="int" description="Compression dependent control value, for JPEG best=99, bad=0, default=85" /
Option name="BLOCKSIZE" type="int" description="Block size, both x and y, default 512" /
Option name="BLOCKXSIZE" type="int" description="Block x size, default=512" /
Option name="BLOCKYSIZE" type="int" description="Block y size, default=512" /
Option name="NETBYTEORDER" type="boolean" description="Force endian for certain compress options, default is host order" /
Option name="CACHEDSOURCE" type="string" description="The source raster, if this is a cache" /
Option name="UNIFORM_SCALE" type="int" description="Scale of overlays in MRF, usually 2" /
Option name="NOCOPY" type="boolean" description="Leave created MRF empty, default=no" /
Option name="DATANAME" type="string" description="Data file name" /
Option name="INDEXNAME" type="string" description="Index file name" /
Option name="SPACING" type="int" description="Leave this many unused bytes before each tile, default=0" /
Option name="PHOTOMETRIC" type="string-select" default="DEFAULT" description="Band interpretation, may affect block encoding"
ValueMULTISPECTRAL/Value
ValueRGB/Value
ValueYCC/Value
/Option
Option name="OPTIONS" type="string" description="
Compression dependent parameters, space separated:
ZSTD - boolean, enable libzstd as final stage, preferred over DEFLATE
DEFLATE - boolean, enable zlib as final stage
GZ - boolean, for DEFLATE enable gzip headers instead of zlib ones when using zlib
RAWZ - boolean, for DEFLATE disable all zlib headers
Z_STRATEGY - Z_HUFFMAN_ONLY | Z_FILTERED | Z_RLE | Z_FIXED: restricts DEFLATE and PNG strategy
OPTIMIZE - boolean, for JPEG, enables Huffman table optimization
" /
/CreationOptionList
OpenOptionList
Option name="NOERRORS" type="boolean" description="Ignore decompression errors" default="FALSE" /
Option name="ZSLICE" type="int" description="For a third dimension MRF, pick a slice" default="0" /
/OpenOptionList
Upgrading to gdal 3.5 solved the issue. Thank you for the help.