[GRASS-dev] [GRASS GIS] #3173: slow raster processing on r.external connected jpeg2000 layers

#3173: slow raster processing on r.external connected jpeg2000 layers
-------------------------+---------------------------------
Reporter: dnewcomb | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.2.0
Component: Imagery | Version: svn-releasebranch72
Keywords: | CPU: x86-64
Platform: MSWindows 7 |
-------------------------+---------------------------------
Just did a quick NVDI with Sentienl-2 bands downloaded from the Amazon
cloud. If I link to the B04.jp2 and B08.jp2 images via r.external it
takes i.vi about 60 minutes to create an ndvi layer.

If I import the layers ( 13 seconds each) and then run i.vi to create an
ndvi layer, it takes 1 minute 24 sec.

This is with Wingrass 64 bit r69539

Images used were downloaded from http://sentinel-s2-l1c.s3-website.eu-
central-1.amazonaws.com/#tiles/18/S/UE/2015/7/26/0/

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3173&gt;
GRASS GIS <https://grass.osgeo.org>

#3173: slow raster processing on r.external connected jpeg2000 layers
-----------------------+---------------------------------
  Reporter: dnewcomb | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.0
Component: Raster | Version: svn-releasebranch72
Resolution: | Keywords: r.external, GDAL
       CPU: x86-64 | Platform: MSWindows 7
-----------------------+---------------------------------
Changes (by neteler):

* keywords: => r.external, GDAL
* component: Imagery => Raster

Comment:

Please also post the GDAL version and the JPEG2000 being used. The
performance can quite differ and is rather unrelated to GRASS since
r.external relies on GDAL.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3173#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#3173: slow raster processing on r.external connected jpeg2000 layers
-----------------------+---------------------------------
  Reporter: dnewcomb | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.0
Component: Raster | Version: svn-releasebranch72
Resolution: | Keywords: r.external, GDAL
       CPU: x86-64 | Platform: MSWindows 7
-----------------------+---------------------------------

Comment (by dnewcomb):

gdalinfo --version gives:
GDAL 2.1.1, released 2016/07/07

gdalinfo --formats gives:

JP2OpenJPEG for JP2 driver

Not sure which version of the JP2OpenJPEG driver was used.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3173#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#3173: slow raster processing on r.external connected jpeg2000 layers
-----------------------+---------------------------------
  Reporter: dnewcomb | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.0
Component: Raster | Version: svn-releasebranch72
Resolution: | Keywords: r.external, GDAL
       CPU: x86-64 | Platform: MSWindows 7
-----------------------+---------------------------------

Comment (by neteler):

There is some dicussion on the right JPEG2000 driver to choose:
  * http://gis.stackexchange.com/questions/169395/converting-large-jp2
-files-using-gdal
  * http://gis.stackexchange.com/questions/176717/gdal-sentinel-2-driver

IMHO it is a GDAL related issue, not GRASS GIS related.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3173#comment:3&gt;
GRASS GIS <https://grass.osgeo.org>

#3173: slow raster processing on r.external connected jpeg2000 layers
-----------------------+---------------------------------
  Reporter: dnewcomb | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.0
Component: Raster | Version: svn-releasebranch72
Resolution: | Keywords: r.external, GDAL
       CPU: x86-64 | Platform: MSWindows 7
-----------------------+---------------------------------

Comment (by dnewcomb):

Looks like the best option for an open source stack is the JP2OpenJPEG
driver, which is what is installed with the gdal version that in the
Wingrass standalone binary.

What confuses me is that a straight r.in.gdal to read , uncompress, and
import the data takes seconds, while read, uncompress, and analyze takes
substantially longer.

Will try to confirm that it happens on Linux as well before digging
deeper.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3173#comment:4&gt;
GRASS GIS <https://grass.osgeo.org>

#3173: slow raster processing on r.external connected jpeg2000 layers
-----------------------+---------------------------------
  Reporter: dnewcomb | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.0
Component: Raster | Version: svn-releasebranch72
Resolution: | Keywords: r.external, GDAL
       CPU: x86-64 | Platform: MSWindows 7
-----------------------+---------------------------------

Comment (by dnewcomb):

Ok, had a few moment minutes to test on 10/20/16 with a fresh nightly
build for 64 bit windows and a fresh SVN pull for GRASS 7.2.

The Linux version of GRASS did a simple NDVI in 3 minutes 5 seconds on a 4
year old i5 laptop with spinning drive. Gdal version is 2.1.0 Libopenjpeg
version is 2.1.0-2

The Windows nightly build took 60 minutes on a 1 year old i7 running on an
SSD drive.
Will try again next week.

Current version of Gdal in OSGeo4W is gdal, 2.1.2-1. Current version of
openjpeg, openjpeg is 2.0.0-2.

https://github.com/uclouvain/openjpeg/blob/version.2.1/CHANGES does not
list any changes related to speed.

QGIS windows version for windows has closer to GRASS Linux speeds when
manually calculating NDVI using the raster calculator and appears to be
using the 2.0.0-2 version of openjpeg ( as well as I can tell at this time
of the night).

Not sure if it is strictly a Linux vs Windows issue or library version
issue, or something else.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3173#comment:5&gt;
GRASS GIS <https://grass.osgeo.org>