Page 1 of 1

ZyGrib does not like Norwegian grib files

Posted: 24 Aug 2017 23:57
by ZFDennis
Hi,

Until recently, I used grib files from the Norwegian weather office in ZyGrib. Something has changed somewhere (probably in Norway) and ZyGrib does not understand the files any more! They are, as far as I can see, valid Grib files as OpenCPN and WinGPS will consume them without any problem.

Link to the files:http://api.met.no/weatherapi/gribfiles/ ... nt=weather or generally, any grib file from this page:http://om.yr.no/verdata/grib/
ZyGrib says: not a GRIB file, unreadable or... (the message box is in Dutch, not very useful to post a screenshot here)

Can anyone tell me why the files won't work? They did work a year ago.

Re: ZyGrib does not like Norwegian grib files

Posted: 14 Sep 2017 23:08
by DomH
ZFDennis wrote:Hi,

Until recently, I used grib files from the Norwegian weather office in ZyGrib. Something has changed somewhere (probably in Norway) and ZyGrib does not understand the files any more! They are, as far as I can see, valid Grib files as OpenCPN and WinGPS will consume them without any problem.

Link to the files:http://api.met.no/weatherapi/gribfiles/ ... nt=weather or generally, any grib file from this page:http://om.yr.no/verdata/grib/
ZyGrib says: not a GRIB file, unreadable or... (the message box is in Dutch, not very useful to post a screenshot here)

Can anyone tell me why the files won't work? They did work a year ago.
Hello,

A grib file is a binary file (not completely standerdised) with an identification of the source at the top of the file.

There is also 2 formats GRIB1 and GRIB2. The norvegian files (source : http://om.yr.no/verdata/grib) are GRIB1.

In zyGrib, there is a test before opening the file on the identity, and if this ID is not recognised, the file is not open.

I cannot remember in wich source file of zygrib, the list is given, but if you find it, you can add the ID of the norvegian files and recompile and it will work.

May be the developper will add the info in a next version

Re: ZyGrib does not like Norwegian grib files

Posted: 19 Sep 2017 23:56
by ZFDennis
Of course! How could I forget the old adage 'Use the source, Luke' ;)

Although my proficiency in C is not very great, I should be able to identify where and why this file is rejected. If I can find the right place, I should be able to provide a correction. Nice reply, I will start my development environment right away.

Re: ZyGrib does not like Norwegian grib files

Posted: 25 Sep 2017 00:24
by ZFDennis

Code: Select all

	else if (   
			    (idCenter==88 && idModel==255 && idGrid==255)
			 || (idCenter==88 && idModel==230 && idGrid==255)
			 || (idCenter==88 && idModel==200 && idGrid==255)
			 || (idCenter==88 && idModel==67 && idGrid==255)
	) {
		dataCenterModel = NORWAY_METNO;
	}
in GribRecord.cpp line 103 should have a new condition:

Code: Select all

..
			 || (idCenter==88 && idModel==127 && idGrid==255)
Don't know if the files will work after this addition, but at least they won't be rejected because of a new model.