[gdal-dev] GRIB file error: Ran out of file reading SECT0

Even Rouault even.rouault at spatialys.com
Sat Dec 3 06:41:21 PST 2016


On samedi 3 décembre 2016 15:24:39 CET Hannah Augustin wrote:
> Hello all,
> For the first time I am working with GRIB files and have stumbled across a
> problem having GDAL open files. The data source is the Copernicus
> Atmosphere Monitoring Service (CAMS <https://atmosphere.copernicus.eu/>).
> QGIS, ArcGIS and GRIB viewers have no problem opening the file for view,

QGIS uses GDAL to read GRIB files.

> yet GDAL returns this error using multiple functions, including gdalinfo:
> 
> Warning: Inside GRIB2Inventory, Message # 26
> ERROR: Ran out of file reading SECT0
> There were 72 trailing bytes in the file.

This warning/error doesn't prevent GDAL from opening the file since gdalinfo reports a 
dataset. Does gdal_translate to a GeoTIFF work ? Presumably yes, otherwise QGIS wouldn't 
have displayed the dataset. Then just ignore the warning.

I'm not sure if it is an issue in the degrib library used by GDAL or if the datasets have some 
form of non conformance and degrib is picky about it.

> 
> Depending on the file, the reported trailing bytes varies. I should also
> mention that no spatial reference system is defined, though my assumption
> is that it is WGS 84, based on the data.

In the below report, there is a SRS reported. Geographic based on a sphere of radius = 
6367470 m. Given the rather low resolution of this dataset, considering this is WGS84 or 
any other datum based on Greenwich is OK

> If I just wanted to view the data,
> I would  use any of the aforementioned software to do so, but I would like
> to archive selected GRIB datasets in a postGIS database if possible.
> 
> Does anyone know the source of this error message? Has anyone found a work
> around? I would attach a sample GRIB file, but am not sure as to the
> protocol for attachments on this listserv.
> 
> kind regards,
> Hannah Augustin
> 
> More info about the dataset including error message and first band (out of
> 25) of GRIB file:
> PS C:\temp> gdalinfo .\z_cams_c_ecmf_20161203000000_prod_an_pl_000_ch4.grib
> Warning: Inside GRIB2Inventory, Message # 26
> ERROR: Ran out of file reading SECT0
> There were 72 trailing bytes in the file.
> Driver: GRIB/GRIdded Binary (.grb)
> Files: .\z_cams_c_ecmf_20161203000000_prod_an_pl_000_ch4.grb
> Size is 900, 451
> Coordinate System is:
> GEOGCS["Coordinate System imported from GRIB file",
>     DATUM["unknown",
>         SPHEROID["Sphere",6367470,0]],
>     PRIMEM["Greenwich",0],
>     UNIT["degree",0.0174532925199433]]
> Origin = (-0.200000000000000,90.200000000000003)
> Pixel Size = (0.400000000000000,-0.400000000000000)
> Corner Coordinates:
> Upper Left  (  -0.2000000,  90.2000000) (  0d12' 0.00"W, 90d12' 0.00"N)
> Lower Left  (  -0.2000000, -90.2000000) (  0d12' 0.00"W, 90d12' 0.00"S)
> Upper Right (     359.800,      90.200) (359d48' 0.00"E, 90d12' 0.00"N)
> Lower Right (     359.800,     -90.200) (359d48' 0.00"E, 90d12' 0.00"S)
> Center      ( 179.8000000,   0.0000000) (179d48' 0.00"E,  0d 0' 0.01"N)
> Band 1 Block=900x1 Type=Float64, ColorInterp=Undefined
>   Description = 1[hPa] ISBL (Isobaric surface)
>   Metadata:
>     GRIB_COMMENT=Potential vorticity [m^2K/kg/s]
>     GRIB_ELEMENT=PVORT
>     GRIB_FORECAST_SECONDS=0 sec
>     GRIB_REF_TIME=  1480723200 sec UTC
>     GRIB_SHORT_NAME=1-ISBL
>     GRIB_UNIT=[m^2K/kg/s]
>     GRIB_VALID_TIME=  1480723200 sec UTC


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20161203/0acaffbe/attachment.html>


More information about the gdal-dev mailing list