rio-cogeo: rio cogeo create fails when converting sentinel-2 preview files

In all sentinel-2 directories, there is a PVI (preview) file in jp2 format that throws a blocksize exceeds raster width error when you try to convert using rio cogeo create [file].

gdalinfo confirms that the blocksize is 192x192 while the band dimension is just 171x171. So the issue seems to be more of a corner case of really small (tiled) jp2s rather than a bug with rio cogeo.

If in SAFE format, the approximate location of this file is: $(PRODUCT_NAME).SAFE/GRANULE/$(IMAGE_GRANULE)/QI_DATA/TILE_ID..._PVI.jp2

Here’s a command to pull a random preview file out of the sentinel s3: aws s3 cp s3://sentinel-s2-l1c/tiles/7/J/FL/2019/2/12/0/preview.jp2 . --request-payer requester

As you can see, rio cogeo create preview.jp2 preview.tif fails.

It looks like this generic error comes when instantiating the DatasetWriterBase class. Is there a way to keep current protections but allow for cog creation on even really small preview files?

Thanks in advance for any suggestions or advice 😃

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

@alando46 sure thing

I’ll try to fix this, this week

@DanSchoppe @alando46 @mojodna could you please review the changes in #82 please