Updated recently

NPE with multidimensional GRIB2 file with time and custom dimension

Description

When loading GRIB2 files downloaded from the National Hurricane Center forecast data ( https://ftp.nhc.ncep.noaa.gov/wsp/ ), I get a NPE from within the NetCDF parser:

1 2 3 4 5 6 7 8 9 10 11 12 13 Caused by: java.lang.NullPointerException at org.geotools.coverage.io.netcdf.NetCDFResponse.loadRaster(NetCDFResponse.java:772) at org.geotools.coverage.io.netcdf.NetCDFResponse.processRequest(NetCDFResponse.java:299) at org.geotools.coverage.io.netcdf.NetCDFResponse.createResponse(NetCDFResponse.java:145) at org.geotools.coverage.io.netcdf.NetCDFSource.read(NetCDFSource.java:65) at org.geotools.coverage.io.netcdf.NetCDFReader.read(NetCDFReader.java:506) at org.geoserver.catalog.SingleGridCoverage2DReader.read(SingleGridCoverage2DReader.java:146) at org.geoserver.catalog.CatalogBuilder.getCoverageSampleDimensions(CatalogBuilder.java:1154) at org.geoserver.catalog.CatalogBuilder.buildCoverageInternal(CatalogBuilder.java:1030) at org.geoserver.catalog.CatalogBuilder.buildCoverage(CatalogBuilder.java:951) at org.geoserver.catalog.CatalogBuilder.buildCoverage(CatalogBuilder.java:900) at org.geoserver.web.data.layer.NewLayerPage.buildLayerInfo(NewLayerPage.java:410) ... 122 more

This most often happens when loading the layer in GeoServer, but I've also encountered it when trying to view any time dimension other than the first, in which case I see a similar error:

 

javax.imageio.IIOException: Can't read file file:/Users/tbarsballe/repos/GeoTools/geotools/modules/plugin/coverage-multidim/grib/target/test-classes/org/geotools/coverage/io/grib/test-data/tpcprblty.2019100912.incremental.grib2
at org.geotools.imageio.netcdf.NetCDFImageReader.netcdfFailure(NetCDFImageReader.java:568)
at org.geotools.imageio.netcdf.NetCDFImageReader.readSection(NetCDFImageReader.java:920)
at org.geotools.imageio.netcdf.NetCDFImageReader.read(NetCDFImageReader.java:798)
at org.geotools.coverage.io.ReadType$1.read(ReadType.java:83)
at org.geotools.coverage.io.netcdf.NetCDFResponse.loadRaster(NetCDFResponse.java:723)
at org.geotools.coverage.io.netcdf.NetCDFResponse.processRequest(NetCDFResponse.java:291)
at org.geotools.coverage.io.netcdf.NetCDFResponse.createResponse(NetCDFResponse.java:142)
at org.geotools.coverage.io.netcdf.NetCDFSource.read(NetCDFSource.java:65)
at org.geotools.coverage.io.netcdf.NetCDFReader.read(NetCDFReader.java:507)
at org.geotools.coverage.io.grib.GribTest.testGribImageWithTimeDimension(GribTest.java:387)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: ucar.ma2.InvalidRangeException: Illegal Range for dimension 1: last requested 12 > 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:918)
... 31 more

 

Environment

None

Status

Assignee

Unassigned

Reporter

Torben Barsballe

Triage

None

Components

Priority

Medium
Configure