GribApiDotNet / GribApi.NET

A powerful .NET library for reading and writing GRIB 1 and 2 files
Apache License 2.0
54 stars 28 forks source link

Problem getting Currents value with Hycomm grib 2 file #63

Closed silv2015 closed 7 years ago

silv2015 commented 7 years ago

Hi! Great Library!

I can process most of my grib 1 and 2 files! This is working great!

But I came under a problem today as I was processing a grib2 file. To be more precise, I am extracting a message from a grib2(Hycomm) and I am trying to get the Sea Current.

The problem is that the value seems to increase for no reason as the coordinates change in GeoSpatialValues and it even doesn't make any sense, the Sea Current is supposed to be in meter per second!

Here is the file I have a problem with...it contains only the U component of the current but I have the same problem with V component: 20170526120000.zip

I hope you can find the problem! If you want me to test anything or send you other files, just let me know!

Thanks!

Here is a snapshot of the output with the attached file...

Lat: -90 Lon: -228.259013197499 Val: 417655.514090896 Lat: -90 Lon: -228.175683260013 Val: 418866.111747146 Lat: -90 Lon: -228.092353322528 Val: 420078.461356521 Lat: -90 Lon: -228.009023385042 Val: 421292.562919021 Lat: -90 Lon: -227.925693447557 Val: 422508.416434646 Lat: -90 Lon: -227.842363510071 Val: 423726.021903396 Lat: -90 Lon: -227.759033572586 Val: 424945.379325271 Lat: -90 Lon: -227.6757036351 Val: 426166.488700271 Lat: -90 Lon: -227.592373697615 Val: 427389.350028396 Lat: -90 Lon: -227.509043760129 Val: 428613.963309646 Lat: -90 Lon: -227.425713822643 Val: 429840.328544021 Lat: -90 Lon: -227.342383885158 Val: 431068.445731521 Lat: -90 Lon: -227.259053947672 Val: 432298.314872146 Lat: -90 Lon: -227.175724010187 Val: 433529.935965896 Lat: -90 Lon: -227.092394072701 Val: 434763.309012771 Lat: -90 Lon: -227.009064135216 Val: 435998.434012771 Lat: -90 Lon: -226.92573419773 Val: 437235.310965896 Lat: -90 Lon: -226.842404260245 Val: 438473.939872146 Lat: -90 Lon: -226.759074322759 Val: 439714.320731521 Lat: -90 Lon: -226.675744385274 Val: 440956.453544021 Lat: -90 Lon: -226.592414447788 Val: 442200.338309646 Lat: -90 Lon: -226.509084510303 Val: 443445.975028396 Lat: -90 Lon: -226.425754572817 Val: 444693.363700271 Lat: -90 Lon: -226.342424635332 Val: 445942.504325271 Lat: -90 Lon: -226.259094697846 Val: 447193.396903396 Lat: -90 Lon: -226.17576476036 Val: 448446.041434646 Lat: -90 Lon: -226.092434822875 Val: 449700.437919021 Lat: -90 Lon: -226.009104885389 Val: 450956.586356521 Lat: -90 Lon: -225.925774947904 Val: 452214.486747146 Lat: -90 Lon: -225.842445010418 Val: 453474.139090896 Lat: -90 Lon: -225.759115072933 Val: 454735.543387771 Lat: -90 Lon: -225.675785135447 Val: 455998.699637771 Lat: -90 Lon: -225.592455197962 Val: 457263.607840896 Lat: -90 Lon: -225.509125260476 Val: 458530.267997146 Lat: -90 Lon: -225.425795322991 Val: 459798.680106521 Lat: -90 Lon: -225.342465385505 Val: 461068.844169021 Lat: -90 Lon: -225.25913544802 Val: 462340.760184646

IdahoSixString commented 7 years ago

Hello @silv2015

Not sure if this is your issue or not. However, I found when working with U and V components I needed to set MultipleFieldMessages = true.

using (var file = new GribFile(ctx.GribFile)) { file.Context.EnableMultipleFieldMessages = true; }

silv2015 commented 7 years ago

@IdahoSixString thanks for the answer but it's not related to my problem. I already set this flag to true and I have both U and V components.

it's just that the data makes no sense as the value are increasing without any reason and is really too big.

0x1mason commented 7 years ago

This may be a bug in grib_api. I'll check.

silv2015 commented 7 years ago

Thanks a lot! I also asked my grib provider to check the data, just in case!

silv2015 commented 7 years ago

Hi!

Just quick update to my problem. I received, as a test, the same data but in GRIB1 format and the data looks all good!

Unfortunately, the GRIB1 file is like 1.2GB !!! So for me it's really not an option for me!

But the problem seems to be related to GRIB2 only....

Still investigating...

RajeshManam commented 7 years ago

Hi, is there any way to create GRIB1 file by reading GRIB2 file?

jnyrup commented 7 years ago

@RajeshManam please create a new issue with your question. This makes it easier to manage and avoids spamming subscribers to this issue. (Sorry for spamming the subscribers to this thread)

RajeshManam commented 7 years ago

Created new issue, thank you for guidance.

0x1mason commented 7 years ago

@silv2015 Is this still an issue for you?

silv2015 commented 7 years ago

Sorry for the delay! Actually, I switch from Hycomm to MyOcean which gives me the same data that I need and the format I received from MyOcean is GRIB1.

So the problem is still there but it's no longer affecting me as I'm using another source.

Thanks a lot