-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Weird behavior when writing and reopening gribfiles #253
Comments
grib2 compression is lossy, rewriting the same data multiple times will progressively lose information |
I follow the procedure, where I open a gribfile containing temperature field, perform some calculations with the field and write it back down. Then later I take the result and do the same procedure. I cannot afford to loose any information. |
You can turn off compression by setting the dataRepresentationTemplateNumber key to 4 and then re-writing the file (there's a |
Is it a command line program only? I wish I could do it in my main script.
|
take a look at the source code. Note that this only works for GRIB2 files. |
Yep, I had already had, thank you. At the bottom of the source code, there is just what I did above:
But the 'dataRepresentationTemplateNumber' value (which should be 4 in my case) does not change. Should I ignore this and write the grib anyway? |
1) Why does the pygrib writes the values 273.15 as 273.1499939?
Here is what I have:
Here is what is written to a grib-message in the end:
This is such a pain later on.
2) After some computations, I have the following array and again write it to a grib-message:
Then I write grib-message to a grib-file, saving it as a new one, and then reopen the new grib-file only to behold the the following values:
Why on Earth the values are different from those I had been writing??
3) An now the most ridiculous thing. When I write an array like this:
save message, save grib-file, reopen again, here is what I get:
Value "273.15" against value "273.1045...". What the hell? I'm sure it's me missing something out...
The text was updated successfully, but these errors were encountered: