Skip to content

Commit

Permalink
xcube server STAC example to open geotiff and levels
Browse files Browse the repository at this point in the history
  • Loading branch information
konstntokas committed Jun 28, 2024
1 parent ce1153b commit 4151bea
Show file tree
Hide file tree
Showing 523 changed files with 4,866 additions and 119 deletions.
43 changes: 26 additions & 17 deletions examples/xcube_server/README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
## About this xcube Server demo
## About this xcube server STAC example

### Running the xcube Server demo configuration
When running the xcube server, a STAC catalog is built dynamically, where each data
sets assigned in the configuration file `config.yml` is linked to a STAC item. To run
the xcube serve follow the section below. To access the data via the STAC using the
`xcube-stac` plugin, refer to the notebook `examples/xcube_server_stac_s3.ipynb`.

```shell
conda activate xcube
cd xcube
xcube serve --traceback --loglevel DETAIL serve --prefix api/v1 -vvv -c examples/serve/demo/config.yml
### Running the xcube Server using the configuration stored in `config.yml`
we start the [xcube server](https://xcube.readthedocs.io/en/latest/examples/xcube_serve.html#running-the-server),
by directing into the `xcube-stac` directory and running the
following command line in the terminal:

```bash
"xcube serve --verbose -c examples/xcube_server/config.yml"
```

### Test data

The following data is used by the demo configuration `config.yml`:

* `cube.nc`: NetCDF data cube example

* `cube-1-250-250.zarr`: Zarr version of `cube.nc`.
The following data is used by the configuration `config.yml`:

* `cube-5-100-200.zarr`: Time-chunked version of `cube.nc`.
* `cube-1-250-250.zarr`: data cute in zarr format with
chunking (time, lat, lon) = (1, 250, 250)

* `cube-1-250-250.levels`: Multi-level/multi-resolution (image pyramid)
version of `cube.nc`.
version of `cube-1-250-250.zarr`.

* `sample-geotiff.tif`: A simple GeoTIFF

* `sample-cog.tif`: A Cloud-optimized GeoTIFF with 3 overview levels
downloaded from
https://rb.gy/h8qz14
This image is one of many free GeoTIFFs available from
* `sample-cog.tif`: A Cloud-optimized GeoTIFF with 3 overview levels downloaded from
https://rb.gy/h8qz14. This image is one of many free GeoTIFFs available from
[Sentinel-2](https://registry.opendata.aws/sentinel-2-l2a-cogs/).

### Access to SpatioTemporalAssetCatalog (STAC)

When running the xcube server, the STAC catalog is published at
http://localhost:8080/ogc. Individual items can be accessed at
http://localhost:8080/ogc/collections/datacubes/items/{dataset_identifier},
where the dataset_identifier is assigned in the configuration file in the
`Identifier` field for the respective dataset.

8 changes: 4 additions & 4 deletions examples/xcube_server/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ DataStores:
- Identifier: local_datasets
StoreId: file
StoreParams:
root: xcube_server
root: examples/xcube_server
Datasets:
- Path: cube.nc
Title: NetCDF file
Identifier: netcdf_file
- Path: cube-1-250-250.levels
Title: levels file
Identifier: levels_file
- Path: cube-1-250-250.zarr
Title: zarr file
Identifier: zarr_file
Expand Down
4 changes: 4 additions & 0 deletions examples/xcube_server/cube-1-250-250.levels/0.zarr/.zattrs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"Conventions": "CF-1.7",
"coordinates": "lat_bnds time_bnds lon_bnds"
}
3 changes: 3 additions & 0 deletions examples/xcube_server/cube-1-250-250.levels/0.zarr/.zgroup
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"zarr_format": 2
}
Loading

0 comments on commit 4151bea

Please sign in to comment.