-
Notifications
You must be signed in to change notification settings - Fork 78
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
Bug in grib writing #385
Comments
Hi @dasarkisov, Thanks for your interesting question! I downloaded some t2m data from the website and tried your sample program (thanks for providing a nice easy way to replicate the issue), but for me I got t2m in my resulting dataset, and do not see an obvious way that your problem could happen. Could you do the following please? Add this line at the top of your script:
and then add this line after reading the GRIB into xarray:
(and then the equivalent for the second dataset you get). This will let us compare the GRIB keys stored in the dataset, and maybe this will give us a clue as to what is going on. For your second question, I think you should be able to copy the original variable and change its values just using standard xarray functions. As long as it retains the 'GRIB_' attributes, it should end up in the resulting GRIB file when you write it. |
@iainrussell Thank you very much for your reply!
Here is the output of the original grib-file:
Unfortunately, the Here is the output of
Regarding the second topic: I do can make a copy of any dataset and write it along with others to the gribfile, but as far as I know at this point, I am unable to create fully custom dataset with arbitrary naming of attributes. This is bacause the cfgrib reaches ecCodes and writes files strictly according to its regulations. For example, whenever I tried to change GRIB_name attribute to any arbitrary one, it got me an error; the same with any other attribute. Many attributes are read-only, others have strict limit for values the can take. The only thing possible is changing the data variable values themselves... I tried to write an "indices" data variable containing values like [ [0, 0, 1], [1, 1, 0], [0, 1, 1] ], but failed to name such a dataset. |
Got a grib file from grib filter with only one field - 2-m temperature. Here I open, the grib, write it right away to a test file, and then reopen to see the results. Have a look at how it does the writing:
Output:
The question: why on earth does it change the name of 2-m temperature data variable 't2m' to lifted index 'lftx'??
Another question: along with the 't2m' data variable, I need to build a side (custom) data variable (as dataarray) within the same grib file, that would mimic the 't2m' (have the same dimensions/coordinates), but have custom values. Is it possible to build such custom data variable and write it together with the original 't2m' data variable?
The text was updated successfully, but these errors were encountered: