Closed raybellwaves closed 1 year ago
I see the error is displayed via
https://github.com/ecmwf/cfgrib/blob/master/cfgrib/dataset.py#L656
Need to see how to pass that to xarray
Think i got it
import cfgrib
import sys
import fsspec
import xarray as xr
file = fsspec.open_local("simplecache::s3://ecmwf-forecasts/20230727/00z/0p4-beta/oper/20230727000000-0h-oper-fc.grib2", s3={"anon": True}, filecache={"cache_storage": "/tmp/files"})
ds = xr.open_dataset(file, engine="cfgrib")
try:
ds = xr.open_dataset(file, engine="cfgrib", backend_kwargs={"errors": "raise"})
except cfgrib.dataset.DatasetBuildError as e:
print(f"Error occurred: {e}")
sys.exit(1)
Thanks Ray, we're working on writing some proper documentation written for cfgrib - this is a good example of a hidden feature!
What happened?
Reading in ECMWF data on s3. Seeing
In my terminal but the code continues. I would like it to exit.
Not sure why it says Traceback is behaves more like a warning than as error
What are the steps to reproduce the bug?