Skip to content
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

Issue replacing values in a gribmessage #210

Open
criedel40 opened this issue Sep 26, 2022 · 3 comments
Open

Issue replacing values in a gribmessage #210

criedel40 opened this issue Sep 26, 2022 · 3 comments

Comments

@criedel40
Copy link

Hello,

I am trying to change the values associated with a gribmessage.

Say I have a GRIB file, call it grib1, that I want to change the values of to a new array that I have created, call it new_arr. I have tried going about directly setting grib1.values = new_arr (or grib1['values'] = new_arr) but neither option works. The resulting grib1.values is not the same as new_arr, rather some strange combination of the old array and new_arr.

Example: Original value in grib file: 2015.5
The value I want in the grib file: 215.6476593
The value that is in the grib file after setting it (grib1.values = new_arr): 216.33317871
Of course the example is just of a single value but it is happening everywhere in the array.

I checked and the precision of arrays all equal float64. Do you have to the same number of significant digits when trying to replace the old values with the new values?

How did you solve this? Any advice is greatly appreciated!

-Chris

@criedel40
Copy link
Author

Sorry typo: Original value in grib file: 215.5

@jswhit
Copy link
Owner

jswhit commented Oct 2, 2022

might have to do with the grib compression which is 'lossy'

@mobhuiyan98
Copy link

What is the solution to this, I am having the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants