[gdal-dev] Working with gdal mdim

Scott public at postholer.com
Fri Nov 14 15:35:08 PST 2025


Thanks for the quick fix, Even!

Yeah, I tried everything, quotes, no quotes, colon, commas, but it would 
only accept 1 slice.

In the end, I came up with a real hack-ish work around; reading all the 
GRIB_VALID_TIME's from gdal raster info | jq and building a csv band 
list and passing it to --bands in gdal raster select.

Ironically, this worked so well you can build a band list from any meta 
data key=values, just changing jq params. Selecting bands by meta data 
would make a pretty cool feature. ;)

  bands=$( \
       gdal raster info $rast -json \
       | sed 's/"":/"item":/g' \
       | jq ".bands[] \
          | select((.metadata.item.GRIB_VALID_TIME \
          | tonumber >= ${starttime}) and 
(.metadata.item.GRIB_VALID_TIME | tonumber <= ${endtime})).band" \
       | tr "\n" "," |sed 's/,$//' \
    )

Thanks again,
Scott

On 11/14/25 15:13, Even Rouault wrote:
> Ah this is a bit tricky. You shouldn't put double quotes around the 
> range as this is numeric values.



More information about the gdal-dev mailing list