There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,49 @@ | ||
# Reading data using backends | ||
|
||
## Introduction | ||
|
||
You can [read different types of files](https://docs.xarray.dev/en/stable/user-guide/io.html) in `xr.open_dataset` by specifying the engine to be used: | ||
|
||
```python | ||
import xarray as xr | ||
xr.open_dataset("my_file.grib" , engine="cfgrib") | ||
``` | ||
|
||
Navigating Xarray backends can be confusing, | ||
so we recommend checking out [this flow chart](https://docs.xarray.dev/en/stable/user-guide/io.html) | ||
to help you figure out which engine you need and how to use it. | ||
|
||
You can see what backends are currently available in your working environment | ||
with `xarray.backends.list_engines()`. | ||
|
||
## Why use the Xarray backend API to write your own backend? | ||
|
||
- Your users don't need to learn a new interface; they can use `xr.open_dataset` with the `engine` kwarg. | ||
- With little extra effort you can have lazy loading with Dask. Simply implement a function for reading blocks and Xarray will manage lazy loading with Dask for you. | ||
- It's easy to implement: using the backend API (introduced in v0.18.0), you don't need to integrate any code in Xarray. | ||
|
||
## More Information | ||
|
||
See the [documentation](https://docs.xarray.dev/en/stable/internals/how-to-add-new-backend.html) for more details on adding and registering a new backend. | ||
|
||
Follow the tutorials on creating a new backend for binary files. | ||
|
||
```{tableofcontents} | ||
|
||
``` | ||
|
||
### Links to internal backends | ||
|
||
- [netcdf4](https://pypi.org/project/netCDF4/) - netCDF4 | ||
- [scipy](https://scipy.org/) - netCDF3 | ||
- [zarr](https://pypi.org/project/zarr/) - Zarr | ||
- [pydap](https://pydap.github.io/pydap/) - Data Access Protocol (DAP/DODS/OPeNDAP) | ||
- [h5netcdf](https://h5netcdf.org/) - hdf5 | ||
JessicaS11 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Links to external backends (not comprehensive) | ||
|
||
- [cfgrib](https://github.com/ecmwf/cfgrib) - GRIB | ||
- [tiledb](https://github.com/TileDB-Inc/TileDB-CF-Py) - TileDB | ||
- [rioxarray](https://corteva.github.io/rioxarray/stable/) - GeoTIFF, JPEG-2000, ESRI-hdr, etc (via GDAL) | ||
- [xarray-sentinel](https://github.com/bopen/xarray-sentinel) - Sentinel-1 SAFE | ||
- ... |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.