Opened 11 years ago
Closed 11 years ago
#4603 closed defect (fixed)
Possible bug in FileDataSource::DataSourceFgetc()
Reported by: | larrybiehl | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 1.9.1 |
Component: | GDAL_Raster | Version: | unspecified |
Severity: | normal | Keywords: | grib |
Cc: |
Description (last modified by )
Not sure of the logic in the following routine in filedatasource.cpp in degrib directory. A character is read from the grib file apparently to test whether it is at the end of the file. EOF is returned if there is an error in reading a character. But if the character read in the file is equal to EOF, the reading of valid data stops. I have a NLDAP grib file with 37 data sets in it. It stop after 9 because a character read with this routine happens to be -1. I did a check of chData to see if it was equal to EOF and set chData to 0 instead. The grib file was read correctly. I was able to access all 37 data sets. Is there a reason for chData at this point to indicate a badly formed grib file if the value return here is -1?
int FileDataSource::DataSourceFgetc() { char chData; if( VSIFReadL( &chData, 1, 1, fp ) == 1 ) return chData; else return EOF; }
Hi,
I was not able to email the file to you. The message to trac@… bounced back.
I did try your suggestion and it did fix the problem. All 37 data sets were found. Thanks for getting back so quickly on this.
This work is for the MultiSpec project that I have: https://engineering.purdue.edu/~biehl/MultiSpec/
You can download the grib file from the site that I got it from:
Select NLDAS_MOS0125_H.A20070630.1700.002.grb file. It downloads with a name of Unknown for me. You can rename it to the name given above.
Let me know if there are questions.
- Larry
Change History (5)
comment:1 by , 11 years ago
Description: | modified (diff) |
---|
comment:2 by , 11 years ago
Component: | default → GDAL_Raster |
---|---|
Description: | modified (diff) |
Keywords: | grib added; grb files removed |
Status: | new → assigned |
comment:3 by , 11 years ago
Description: | modified (diff) |
---|
comment:4 by , 11 years ago
Larry writes:
Hi,
I was not able to email the file to you. The message to trac@… bounced back.
I did try your suggestion and it did fix the problem. All 37 data sets were found. Thanks for getting back so quickly on this.
This work is for the MultiSpec project that I have: https://engineering.purdue.edu/~biehl/MultiSpec/
You can download the grib file from the site that I got it from:
http://mirador.gsfc.nasa.gov/cgi- bin/mirador/granlist.pl?page=1&location=(-90,-180),(90,180)&dataSet=NLDAS_MOS0125_H&version=002&allversion=002&startTime=2007-06-30T00:00:01Z&endTime=2007-06-30T23:59:59Z&keyword=NLDAS_MOS0125_H&longname=NLDAS%20Mosaic%20Land%20Surface%20Model%20L4%20Hourly%200.125%20x%200.125%20degree%20&CGISESSID=4d4f18008ca17bbabc634c2fe9914553&prodpg=http://mirador.gsfc.nasa.gov/collections/NLDAS_MOS0125_H__002.shtml
Select NLDAS_MOS0125_H.A20070630.1700.002.grb file. It downloads with a name of Unknown for me. You can rename it to the name given above.
Let me know if there are questions.
- Larry
comment:5 by , 11 years ago
Milestone: | → 1.9.1 |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Hi, can you provide the file in question?
I suspect the fix is to declare "chData" as "unsigned char" but it would be easier to confirm with a file demonstrating the issue.