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 levels into separated datasets #408

Open
julienvienne opened this issue Dec 11, 2024 · 0 comments
Open

Read levels into separated datasets #408

julienvienne opened this issue Dec 11, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@julienvienne
Copy link

Is your feature request related to a problem? Please describe.

Hi,
I am currently struggling for reading a mixed parameter grib file which contains (among others) temperature parameter ('t') at 100m and 200m. I would like these to be read in separated datasets, but it seems that the cfgrib.open_datasets() method automatically merge the record into the heightAboveLevel dimension (see example below).
Is there a workaround to read all grib record independantly and create one dataset for each, letting enduser merge the datasets by himself ?

Describe the solution you'd like

  • use level filtering key to create separated datasets
  • make the squeeze=False option working for this
  • add new method or option to read all records without merging

Describe alternatives you've considered

I have tried to include the level keys for making separated datasets, but the levels are merged anyway into the same variable :

                datasets = cfgrib.open_datasets(
                    grib_file,
                    chunks={'latitude': 2000, 'longitude': 2000},
                    backend_kwargs={'indexpath': idx_path,
                                    'read_keys': ['shortName', 'typeOfLevel', 'level'],
                                    'squeeze': False,
                                    'filter_by_keys': {
                                        'typeOfLevel': 'heightAboveGround',
                                        "level": [0,2,100,200]
                                    }
                                    }
                )

Additional context

No response

Organisation

Weathernews

@julienvienne julienvienne added the enhancement New feature or request label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant