Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split into COG and NetCDF sub-packages #11

Merged
merged 25 commits into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e4a7459
wip
pjhartzell Dec 14, 2022
812453f
wip: cog collection refactor
pjhartzell Dec 15, 2022
4f5ed31
wip: cog collection and items running
pjhartzell Dec 17, 2022
9c3a801
wip: complete netcdf and cog collection split
pjhartzell Dec 18, 2022
8217679
feat: add CLI
pjhartzell Dec 18, 2022
748d2b2
chore: add basic CLI smoke tests
pjhartzell Dec 18, 2022
2aaf4fd
fix!: remove version extension in netcdf items
pjhartzell Dec 18, 2022
ba35ea4
fix: remove class list from cog collection summaries
pjhartzell Dec 19, 2022
b1fac86
fix: remove class list from netcdf Collection and Item
pjhartzell Dec 19, 2022
959adf5
fix: move all proj entries to Item properties
pjhartzell Dec 19, 2022
12a9215
fix: update netcdf asset title
pjhartzell Dec 19, 2022
15095f8
Merge branch 'main' into tile-cogs
pjhartzell Dec 19, 2022
499fd61
chore: make asset hrefs absolute
pjhartzell Dec 19, 2022
1104929
fix: sundry collection and item tweaks
pjhartzell Dec 19, 2022
4980c5c
chore: update readme and changelog
pjhartzell Dec 19, 2022
4bc9c75
fix: format
pjhartzell Dec 19, 2022
a7185cd
fix: increase CI timeout to allow external data download
pjhartzell Dec 19, 2022
1c16bd9
fix: make COG Item bbox a list
pjhartzell Dec 20, 2022
a7d4147
feat: add external test data caching to CI
pjhartzell Dec 20, 2022
5e4ddcf
Revert "feat: add external test data caching to CI"
pjhartzell Dec 20, 2022
9494639
fix: corrects cog resampling
pjhartzell Dec 20, 2022
bb564f5
Update environment.yml
pjhartzell Dec 20, 2022
1724564
chore: update setup.cfg to list all imported packages
pjhartzell Dec 20, 2022
c64ee38
fix!: use grid extension in place of custom field for tile
pjhartzell Dec 20, 2022
3316941
chore: update readme to reflect use of grid extension
pjhartzell Dec 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
python-matrix:
name: python-matrix
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
Expand Down
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ number as needed.

### Added

- Nothing.
- Dedicated NetCDF and COG Collections
- COG Tiler

### Deprecated

- Nothing.

### Removed

- Nothing.
- Single Item creation containing worldwide COGs and NetCDF assets.

### Fixed

Expand Down
85 changes: 29 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,77 +11,65 @@
- STAC extensions used:
- [classification](https://github.com/stac-extensions/classification/)
- [datacube](https://github.com/stac-extensions/datacube/)
- [grid](https://github.com/stac-extensions/grid/)
- [item-assets](https://github.com/stac-extensions/item-assets)
- [processing](https://github.com/stac-extensions/processing/)
- [proj](https://github.com/stac-extensions/projection/)
- [projection](https://github.com/stac-extensions/projection/)
- [raster](https://github.com/stac-extensions/raster/)
- [version](https://github.com/stac-extensions/version/)
- [scientific](https://github.com/stac-extensions/scientific)
- Extra fields:
- None
- `esa_cci_lc:version`: Land cover product version.
- [Browse the example in human-readable form](https://radiantearth.github.io/stac-browser/#/external/raw.githubusercontent.com/stactools-packages/esa-cci-lc/main/examples/catalog.json)

A stactools package for ESA's Climate Change Initiative (CCI) Land Cover (LC)
product.
## Background

This dataset provides global maps describing the land surface classes,
A stactools package for ESA's Climate Change Initiative (CCI) Land Cover (LC)
product. The ESA CCI LC dataset provides global maps describing the land surface classes,
which have been defined using the United Nations Food and Agriculture
Organization's (UN FAO) Land Cover Classification System (LCCS).
In addition to the land cover (LC) maps, four quality flags are produced to
document the reliability of the classification and change detection.
In order to ensure continuity, these land cover maps are consistent with the
series of global annual LC maps from the 1990s to 2015 produced by the
European Space Agency (ESA) Climate Change Initiative (CCI).

This package can generate STAC files from netCDF files and that either link to
the original netCDF files or to Cloud-Optimized GeoTiff (COG) files.
Two STAC Collections, and corresponding Items, can be generated with this package:

## STAC Examples
1. esa-cci-lc: A Collection of COG tiles generated from the source NetCDF data files.
2. esa-cci-lc-netcdf: A Collection describing the source NetCDF data files.

- [Collection](examples/collection.json)
- [Item](examples/item.json)
- [Browse the example in human-readable form](https://radiantearth.github.io/stac-browser/#/external/raw.githubusercontent.com/stactools-packages/esa-cci-lc/main/examples/collection.json)
If you are interested in creating single STAC Items for each source NetCDF file along with worldwide COGs (not tiled), see release [v0.1.0](https://github.com/stactools-packages/esa-cci-lc/releases/tag/v0.1.0).

## Installation

```shell
pip install stactools-esa-cci-lc
```

## Command-line Usage

Use `stac esa-cci-lc --help` to see all subcommands and options.
## STAC Examples

### Collection
- Collections
- [Tiled COGs](examples/esa-cci-lc/collection.json)
- [Source NetCDF](examples/esa-cci-lc-netcdf/collection.json)

Create a collection:
- Items
- [Tiled COGs](examples/esa-cci-lc/C3S-LC-L4-LCCS-Map-300m-P1Y-2018-v2.1.1-N79W180/C3S-LC-L4-LCCS-Map-300m-P1Y-2018-v2.1.1-N79W180.json)
- [Source NetCDF](examples/esa-cci-lc-netcdf/C3S-LC-L4-LCCS-Map-300m-P1Y-2018-v2.1.1/C3S-LC-L4-LCCS-Map-300m-P1Y-2018-v2.1.1.json)

```shell
stac esa-cci-lc create-collection collection.json
```
The example Collections and Items in the `examples` directory can be created by running `./scripts/create_examples.py`.

Get information about all options for collection creation:
## Installation

```shell
stac esa-cci-lc create-collection --help
pip install stactools-esa-cci-lc
```

### Item
## Command-line Usage

Create an item with netCDF and COG assets:
To create the NetCDF Collection:

```shell
stac esa-cci-lc create-item /path/to/source/file.nc item.json --collection collection.json
stac esa-cci-lc netcdf create-collection collection.json
```

Create an item with only COG assets:
To convert a NetCDF to tiled COGs and create an Item for each tile:

```shell
stac esa-cci-lc create-item /path/to/source/file.nc item.json --collection collection.json --nonetcdf TRUE
stac esa-cci-lc cog create-items /path/to/source/file.nc /path/to/output/directory
```

Get information about all options for item creation:

```shell
stac esa-cci-lc create-item --help
```
Use `stac esa-cci-lc --help` to see all subcommands and options.

## Contributing

Expand All @@ -105,18 +93,3 @@ To run the tests:
```shell
pytest -vv
```

### Tests

Due to the large file sizes, the data files for the tests are missing in this repository.
To run the tests, please download the files for 1992, 2015, 2016 and 2020 from the
[Climate Data Store](https://cds.climate.copernicus.eu/cdsapp#!/dataset/satellite-land-cover?tab=form).
You can download them all at once in a ZIP or gzipped TAR file and then extract the `.nc` files
to the `tests/data-files/external` folder.

The CI doesn't run any tests for item generation due to the missing data files.
Please ensure you've tested the changes against the data files locally!

Also, due to the long processing time of the tests with COGs conversion (in total 3-4 hours on
my local machine), the tests by default run without COG processing (i.e. `--nocog` is enabled).
To run the tests with COG generation, please run `pytest -vv --withcog`.
1 change: 0 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ dependencies:
- conda-forge::gdal>=3.4
- conda-forge::geos>=3.3
- conda-forge::rasterio>=1.3
- conda-forge::libstdcxx-ng # gdal dependency. Make sure it's from the same channel as gdal
Loading