diff --git a/docs/usage.md b/docs/usage.md index 2d8e9397..1d542ba8 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -271,67 +271,7 @@ but this requires some [upstream changes](https://github.com/TomNicholas/Virtual ### Automatic ordering using coordinate data -Sometimes we don't have a priori knowledge of which files contain what content, and we would like to concatenate them in an order dictated by their coordinates (e.g. so that a `time` coordinate monotonically increases into the future). - -For this we will actually want to create xarray indexes, so that we can use the values in them to determine the correct concatenation order. This requires loading coordinate values into memory, the same way that `xarray.open_dataset` does by default. - -To open a virtual dataset but with in-memory indexes along 1D [dimension coordinates](), pass `indexes=None` to `open_virtual_dataset` (which is the default). - -```python -vds1 = open_virtual_dataset('air1.nc') -vds2 = open_virtual_dataset('air2.nc') -``` - -Now we can see that some indexes have been created by default. - -```python -vds1.xindexes -``` -``` -Indexes: - lat PandasIndex - lon PandasIndex - time PandasIndex -``` - -To use these indexes to infer concatenation order we can use `xarray.combine_by_coords`. - -```python -combined_vds = xr.combine_by_coords([vds2, vds1]) -combined_vds -``` -``` - Size: 8MB -Dimensions: (time: 2920, lat: 25, lon: 53) -Coordinates: - * lat (lat) float32 100B 75.0 72.5 70.0 67.5 65.0 ... 22.5 20.0 17.5 15.0 - * lon (lon) float32 212B 200.0 202.5 205.0 207.5 ... 325.0 327.5 330.0 - * time (time) datetime64[ns] 23kB 2013-01-01 ... 2014-12-31T18:00:00 -Data variables: - air (time, lat, lon) int16 8MB ManifestArray