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

Not specifying step will not return all available steps #23

Open
notoriusjack opened this issue Jul 27, 2023 · 2 comments
Open

Not specifying step will not return all available steps #23

notoriusjack opened this issue Jul 27, 2023 · 2 comments

Comments

@notoriusjack
Copy link

According to the documentation, not specifying step should return all available time steps, however if I try to do so I only get back the first time step 0

from ecmwf.opendata import Client
def get_ECMWF_open_data_grib_ensemble(target, stream, param, number):
    try:
        client = Client(source="ecmwf")
        downloaded_file = client.retrieve(
            target = target,
            stream=stream,
            param=param,
            number=number,
        )
        return downloaded_file

    except:
        print('The ECMWF service is not currently available, please try again later')

grib_stream = 'enfo'
grib_format = 'grib2'
grib_target = f'aaa_{grib_stream}.{grib_format}'
grib_param = ["10u", "10v"]
grib_number = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]
grib_file = get_ECMWF_open_data_grib_ensemble(grib_target, grib_stream, grib_param, grib_number)

ds = xr.open_mfdataset(grib_target, engine='cfgrib', parallel=True, chunks={'step': 3, 'number': 3,},
                               backend_kwargs={'filter_by_keys': {'typeOfLevel': 'heightAboveGround', 'topLevel': 10}, })
print(ds)

ensemble = 11 #21
mask = (ds.number.values == ensemble)
xarr = ds.sel(number=mask).squeeze(drop=True)
print('xarr')
print(xarr)

print(xarr.coords['step'].values)
@e22tracey
Copy link

I've also come across this issue. Hopefully this comment bumps the issue.

@tportwood
Copy link

Same here.

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