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

Read key as specific data type #207

Open
jkempe opened this issue Aug 1, 2022 · 1 comment
Open

Read key as specific data type #207

jkempe opened this issue Aug 1, 2022 · 1 comment

Comments

@jkempe
Copy link

jkempe commented Aug 1, 2022

Is it possible to select what data type a specific key should be read as?

The case I would like to use this for is to be able to read grb.indicatorOfTypeOfLevel as a long. Not as a string.
Now grb.indicatorOfTypeOfLevel returns 'sfc' but I would like it to return 105.
This can be done in in Eccodes tools by appending :l to the key.
Similar functionality seams to be available for index creation but I can´t see it is possible when reading keys.

Is this currently not possible or have I failed to read the doc properly?

Thanks
Jesper

@shahramn
Copy link

shahramn commented Aug 1, 2022

In the ecCodes Python3 bindings one can do:
eccodes.codes_get_long(gid, "indicatorOfTypeOfLevel")
and you get back an integer

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

2 participants