C2SM / icon-vis

Collection of Python scripts and notebooks to demonstrate plotting on the ICON grid.
BSD 3-Clause "New" or "Revised" License
15 stars 6 forks source link

Plot read-only grib files #12

Closed DanielLeuenberger closed 2 years ago

DanielLeuenberger commented 2 years ago

When plotting a grib file, an index file is generated in the same folder than the original grib file. When the directory is not writable, this is not possible. Is there a way to circumvent this?

victoria-cherkas commented 2 years ago

Hi Daniel, The index file is created by cfgrib, and can be turned off as per their instructions here: https://github.com/ecmwf/cfgrib#grib-index-file

GRIB index file By default cfgrib saves the index of the GRIB file to disk appending .idx to the GRIB file name. Index files are an experimental and completely optional feature, feel free to remove them and try again in case of problems. Index files saving can be disable passing adding indexpath='' to the backend_kwargs keyword argument.

eg as below.

psy.open_dataset(
                file,
                engine="cfgrib",
                backend_kwargs={"indexpath": "", "errors": "ignore"},
            )

Let me know if this is still not solving the issue.

DanielLeuenberger commented 2 years ago

Thanks for this info. Together with the documentation, I managed to plot also read-only grid files.