[Geoserver-users] Grib files with more than 32 bands?

I am having trouble displaying Grib files with more than 32 bands. I can
configure a coverage store, however configuring layers afterwards fails.

The stacktrace finishes with this:

...
Caused by: ucar.ma2.InvalidRangeException: Illegal Range for dimension 1:
last requested 32 > max 0
  at ucar.ma2.Section.fill(Section.java:179)
  at ucar.nc2.Variable.read(Variable.java:709)
  at
org.geotools.imageio.netcdf.NetCDFImageReader.readSection(NetCDFImageReader.java:919)
  ... 137 more

If I subset the same file with 32 bands (using cdo), my Grib file works as
expected.
./cdo -seltimestep,1/32 ~/ds.rhm.bin ~/ds.rhm.bin.grb

This is a link to the original file in question.
https://tgftp.nws.noaa.gov/SL.us008001/ST.opnl/DF.gr2/DC.ndfd/AR.conus/VP.001-003/ds.rhm.bin

Thank you for any thoughts on this, I was hoping to keep the data original.

Alex

--
Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html

If a multidimensional file has more than 32 bands, the index in getImageIndex
in GeoSpatialImageReader.java is returned like this:
[32 33 34 ... n 0 1 2 3 ... 31]

Sorting the index prior to returning it fixes the InvalidRangeException
error:

  public List<Integer> getImageIndex(Query filterQuery) throws IOException {
        List<CoverageSlice> descs = slicesCatalog.getGranules(filterQuery);
        List<Integer> indexes = new ArrayList<Integer>();
        for (CoverageSlice desc : descs) {
            Integer index =
                    (Integer)
desc.getOriginator().getAttribute(CoverageSlice.Attributes.INDEX);
            indexes.add(index);
        }
        *Collections.sort(indexes);*
        return indexes;
    }

--
Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html

Hi Alexander,
thanks for reporting that.
Do you have any chance to open a JIRA and contribute your patch as a PR with a test?

Regards,
Daniele

On Tue, Jul 9, 2019 at 3:46 PM alexander-petkov <greenkov@anonymised.com> wrote:

If a multidimensional file has more than 32 bands, the index in getImageIndex
in GeoSpatialImageReader.java is returned like this:
[32 33 34 … n 0 1 2 3 … 31]

Sorting the index prior to returning it fixes the InvalidRangeException
error:

public List getImageIndex(Query filterQuery) throws IOException {
List descs = slicesCatalog.getGranules(filterQuery);
List indexes = new ArrayList();
for (CoverageSlice desc : descs) {
Integer index =
(Integer)
desc.getOriginator().getAttribute(CoverageSlice.Attributes.INDEX);
indexes.add(index);
}
Collections.sort(indexes);
return indexes;
}


Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html


Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Regards,
Daniele Romagnoli

GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information.

Ing. Daniele Romagnoli
Senior Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.

Ciao Daniele:

Thanks for replying, I will do that today.

Kind regards,
Alex

--
Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html