[GRASS-dev] [GRASS GIS] #798: r.in.gdal : subdataset handling

GRASS GIS trac at osgeo.org
Fri Apr 26 09:34:01 PDT 2019


#798: r.in.gdal : subdataset handling
--------------------------+-------------------------
  Reporter:  rouault      |      Owner:  grass-dev@…
      Type:  enhancement  |     Status:  new
  Priority:  normal       |  Milestone:  7.8.0
 Component:  Raster       |    Version:  unspecified
Resolution:               |   Keywords:  r.in.gdal
       CPU:  All          |   Platform:  All
--------------------------+-------------------------

Comment (by marisn):

 Replying to [comment:7 mmetz]:
 > Subdatasets are now (trunk r74373) printed if present, no flag needed.
 Thanks. Still I am not certain if printing anything more than a warning
 should not be done only on a request. Let it stay like this unless someone
 can show an use case where it would be a bad thing.

 > Related but independent of that, import fails early if no raster bands
 are found.
 This is a good question. If no bands are specified, all bands are
 imported. Following this logic, all subdatasets should be imported. Still
 I do understand why it could be a bad idea ;-)

 > What exactly is the advantage of another new option "subdataset" instead
 of providing the name of the subdataset to be imported? In any case, you
 need to read the names and descriptions of the available subdatasets
 first.
 The names of subdatasets can be really verbose and thus hard to handle.
 Besides, subdatasets are not supported in r.import. Such option would make
 it a bit easier to implement it.

 Here's an example of how import of subdataset looks like now (yes, thats
 208 symbols for a subdataset name and 251 symbol for whole import command
 and that's without any extras!):
 {{{
 r.in.gdal
 input=/home/marisn/data/S2_2018/S2A_MSIL2A_20180413T095031_N0207_R079_T34VFH_20180413T102702.zip
 output=S2A_MSIL2A_20180413
 WARNING: Input contains subdatasets which may need to be imported
          separately by name:
 Subdataset 1:
   Name:
 SENTINEL2_L2A:/vsizip//home/marisn/data/S2_2018/S2A_MSIL2A_20180413T095031_N0207_R079_T34VFH_20180413T102702.zip/S2A_MSIL2A_20180413T095031_N0207_R079_T34VFH_20180413T102702.SAFE/MTD_MSIL2A.xml:10m:EPSG_32634
 Subdataset 3:
   Name:
 SENTINEL2_L2A:/vsizip//home/marisn/data/S2_2018/S2A_MSIL2A_20180413T095031_N0207_R079_T34VFH_20180413T102702.zip/S2A_MSIL2A_20180413T095031_N0207_R079_T34VFH_20180413T102702.SAFE/MTD_MSIL2A.xml:20m:EPSG_32634
 Subdataset 5:
   Name:
 SENTINEL2_L2A:/vsizip//home/marisn/data/S2_2018/S2A_MSIL2A_20180413T095031_N0207_R079_T34VFH_20180413T102702.zip/S2A_MSIL2A_20180413T095031_N0207_R079_T34VFH_20180413T102702.SAFE/MTD_MSIL2A.xml:60m:EPSG_32634
 Subdataset 7:
   Name:
 SENTINEL2_L2A:/vsizip//home/marisn/data/S2_2018/S2A_MSIL2A_20180413T095031_N0207_R079_T34VFH_20180413T102702.zip/S2A_MSIL2A_20180413T095031_N0207_R079_T34VFH_20180413T102702.SAFE/MTD_MSIL2A.xml:TCI:EPSG_32634
 ERROR: No raster bands found in
 </home/marisn/data/S2_2018/S2A_MSIL2A_20180413T095031_N0207_R079_T34VFH_20180413T102702.zip>

 r.in.gdal
 input=SENTINEL2_L2A:/vsizip//home/marisn/data/S2_2018/S2A_MSIL2A_20180413T095031_N0207_R079_T34VFH_20180413T102702.zip/S2A_MSIL2A_20180413T095031_N0207_R079_T34VFH_20180413T102702.SAFE/MTD_MSIL2A.xml:10m:EPSG_32634
 output=S2A_MSIL2A_20180413
 }}}
 Besides the import works easy only form CLI, as in GUI simple copy/paste
 contains line wrapping symbols that need to be removed first. Thus being
 able to provide an option subdataset=1,3 would make it short and easy (1st
 run – get a list of subdatasets; add subdataset number(s); 2nd run to
 finish import). Subdataset option, of course, would not conflict with
 specifying subdataset name directly as input parameter thus keeping
 current functionality unchanged.

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/798#comment:8>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list