Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/stac-utils/stac-terminal

Output info on STAC Items in the terminal
https://github.com/stac-utils/stac-terminal

Last synced: about 2 months ago
JSON representation

Output info on STAC Items in the terminal

Awesome Lists containing this project

README

        

# stacterm

This library is for displaying information (tables, calendars, plots,
histograms) about [STAC](https://stacspec.org/) Items in the terminal. It takes
as input a STAC ItemCollection (a GeoJSON FeatureCollection of STAC Items),
either by specifying a filename or by piping output from another program.

## Installation

Install from PyPi:

```cmdline
❯ pip install stacterm
```

PySTAC and Pandas are required, along with two dependencies for rendering
tables ([termtables](https://pypi.org/project/termtables/)) and plots
([plotext](https://pypi.org/project/plotext/)) in the terminal.

## Usage

stacterm main usage is as a CLI progam `stacterm`. Use help to see options
available:

```cmdline
❯ stacterm -h
usage: stacterm [-h] {table,cal,hist,plot} ...

Terminal STAC

positional arguments:
{table,cal,hist,plot}
table Output a table
cal Output a calendar
hist Output a histogram
plot Output a plot

optional arguments:
-h, --help show this help message and exit
```

All of the sub-commands in `stacterm` can take optional field names. A field
name is:

- `id`: The ID of the Item
- `collection`: The collection of the Item
- Dates
- `date`: The date portion of the Item's `datetime` field
- `year-month`: The year and month of the Item's `datetime` field
- `year`: The year of the Item's `datetime` field
- Any property

`stacterm` reads from in stdin allowing other programs to pipe output to it,
such as [pystac-client](https://github.com/stac-utils/pystac-client).

```cmdline
❯ export STAC_API_URL=https://earth-search.aws.element84.com/v0
❯ stac-client search --intersects aoi.json \
--datetime 2020-07-01/2020-12-31 \
-c sentinel-s2-l2a-cogs landsat-8-l1-c1 | stacterm cal --label platform
```

The detailed usage examples below are all shown using the item collection from
a search saved to a file and redirected to stdin.

![](images/cal.png)

### Tables

Use `stacterm` to display tabularized data from a saved ItemCollection.

```cmdline