# stactools-usda-cdl
[![PyPI](https://img.shields.io/pypi/v/stactools-usda-cdl)](https://pypi.org/project/stactools-usda-cdl/)
- Name: usda-cdl
- Package: `stactools.usda_cdl`
- PyPI: <https://pypi.org/project/stactools-usda-cdl/>
- Owner: @gadomski, @pholleway
- Dataset homepage: <https://www.nass.usda.gov/Research_and_Science/Cropland/Release/index.php>
- STAC extensions used:
- [classification](https://github.com/stac-extensions/classification)
- [item-assets](https://github.com/stac-extensions/item-assets)
- [proj](https://github.com/stac-extensions/projection/)
- [raster](https://github.com/stac-extensions/raster/)
- Extra fields:
- `usda_cdl:type`: The [item type](#item-types).
- [Browse the example in human-readable form](https://radiantearth.github.io/stac-browser/#/external/raw.githubusercontent.com/stactools-packages/usda-cdl/main/examples/collection.json)
A stactools package for USDA Cropland Data Layer (CDL) product.
The USDA Cropland Data Layer (CDL) is a crop-specific land cover data layer. The data is provided at 30 m resolution over the Contiguous United States (CONUS) from 2008 to Present. The USDA CDL is produced using satellite imagery from the Landsat 8 OLI/TIRS sensor, the ISRO ResourceSat-2 LISS-3, and the ESA SENTINEL-2 sensors collected during the current growing season.
This package can generate STAC files from TIFF files that link to the Cloud-Optimized GeoTiff (COG) files.
## Item types
There are three primary item types in this dataset:
- `cropland`: Yearly crop-cover classification dataset, optionally with a confidence product.
- `cultivated`: A boolean raster describing whether a given pixel was "cultivated" in the target year.
- `frequency`: A set of four rasters that describe how often four main crop types were planted in the past fourteen years.
## Examples
There is an example collection at examples/collection.json.
### Tiling
While this stactools package can create items for the original, CONUS-wide GeoTIFFS, it also supports tiling the data into more manageable sized Cloud-Optimized GeoTIFFs.
To tile a GeoTIFF:
```shell
stac usda-cdl tile --size 500 tests/data-files/2021_30m_cdls.tif tiles
```
If you have a bunch of hrefs to existing tiles, you can use `stac.create_items_from_tiles` to intelligantly partition those hrefs by product type and tile:
```python
from stactools.usda_cdl import stac
from pathlib import Path
hrefs = list(Path("tests/data-files/tiles").glob("*.tif"))
items = stac.create_items_from_tiles(hrefs)
```
## Installation
```shell
pip install stactools-usda-cdl
```
## Command-line Usage
Use `stac usda-cdl --help` to see all subcommands and options.
### Collection
Create a collection:
```shell
stac usda-cdl create-collection collection.json
```
### Item
Create an item:
```shell
stac usda-cdl create-item /path/to/source/file.tif item.json
```
Get information about all options for item creation:
```shell
stac usda-cdl create-item --help
```
## Contributing
We use [pre-commit](https://pre-commit.com/) to check any changes.
To set up your development environment:
```shell
pip install -e .
pip install -r requirements-dev.txt
pre-commit install
```
To check all files:
```shell
pre-commit run --all-files
```
To run the tests:
```shell
pytest -vv
```
Raw data
{
"_id": null,
"home_page": "https://github.com/stactools-packages/usda-cdl",
"name": "stactools-usda-cdl",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "stactools,pystac,catalog,STAC",
"author": "Paola Holleway",
"author_email": "paolaholleway@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/49/59/b29759a02b0d37903b4b9af64222e16defaa435c561f574278cbb864ddf1/stactools-usda-cdl-0.1.2.tar.gz",
"platform": null,
"description": "# stactools-usda-cdl\n\n[![PyPI](https://img.shields.io/pypi/v/stactools-usda-cdl)](https://pypi.org/project/stactools-usda-cdl/)\n\n- Name: usda-cdl\n- Package: `stactools.usda_cdl`\n- PyPI: <https://pypi.org/project/stactools-usda-cdl/>\n- Owner: @gadomski, @pholleway\n- Dataset homepage: <https://www.nass.usda.gov/Research_and_Science/Cropland/Release/index.php>\n- STAC extensions used:\n - [classification](https://github.com/stac-extensions/classification)\n - [item-assets](https://github.com/stac-extensions/item-assets)\n - [proj](https://github.com/stac-extensions/projection/)\n - [raster](https://github.com/stac-extensions/raster/)\n- Extra fields:\n - `usda_cdl:type`: The [item type](#item-types).\n- [Browse the example in human-readable form](https://radiantearth.github.io/stac-browser/#/external/raw.githubusercontent.com/stactools-packages/usda-cdl/main/examples/collection.json)\n\nA stactools package for USDA Cropland Data Layer (CDL) product.\n\nThe USDA Cropland Data Layer (CDL) is a crop-specific land cover data layer. The data is provided at 30 m resolution over the Contiguous United States (CONUS) from 2008 to Present. The USDA CDL is produced using satellite imagery from the Landsat 8 OLI/TIRS sensor, the ISRO ResourceSat-2 LISS-3, and the ESA SENTINEL-2 sensors collected during the current growing season.\n\nThis package can generate STAC files from TIFF files that link to the Cloud-Optimized GeoTiff (COG) files.\n\n## Item types\n\nThere are three primary item types in this dataset:\n\n- `cropland`: Yearly crop-cover classification dataset, optionally with a confidence product.\n- `cultivated`: A boolean raster describing whether a given pixel was \"cultivated\" in the target year.\n- `frequency`: A set of four rasters that describe how often four main crop types were planted in the past fourteen years.\n\n## Examples\n\nThere is an example collection at examples/collection.json.\n\n### Tiling\n\nWhile this stactools package can create items for the original, CONUS-wide GeoTIFFS, it also supports tiling the data into more manageable sized Cloud-Optimized GeoTIFFs.\nTo tile a GeoTIFF:\n\n```shell\nstac usda-cdl tile --size 500 tests/data-files/2021_30m_cdls.tif tiles\n```\n\nIf you have a bunch of hrefs to existing tiles, you can use `stac.create_items_from_tiles` to intelligantly partition those hrefs by product type and tile:\n\n```python\nfrom stactools.usda_cdl import stac\nfrom pathlib import Path\nhrefs = list(Path(\"tests/data-files/tiles\").glob(\"*.tif\"))\nitems = stac.create_items_from_tiles(hrefs)\n```\n\n## Installation\n\n```shell\npip install stactools-usda-cdl\n```\n\n## Command-line Usage\n\nUse `stac usda-cdl --help` to see all subcommands and options.\n\n### Collection\n\nCreate a collection:\n\n```shell\nstac usda-cdl create-collection collection.json\n```\n\n### Item\n\nCreate an item:\n\n```shell\nstac usda-cdl create-item /path/to/source/file.tif item.json\n```\n\nGet information about all options for item creation:\n\n```shell\nstac usda-cdl create-item --help\n```\n\n## Contributing\n\nWe use [pre-commit](https://pre-commit.com/) to check any changes.\nTo set up your development environment:\n\n```shell\npip install -e .\npip install -r requirements-dev.txt\npre-commit install\n```\n\nTo check all files:\n\n```shell\npre-commit run --all-files\n```\n\nTo run the tests:\n\n```shell\npytest -vv\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "stactools package for USDA Cropland Data Layer",
"version": "0.1.2",
"split_keywords": [
"stactools",
"pystac",
"catalog",
"stac"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a4758f8931574b0cd806e540820bbe87e3759d35d9fd69b1c73db157442be924",
"md5": "8d00a7fc751629d10acc91fd1e9f01cd",
"sha256": "49b910d23601362698c3f90ae587d0e0d2abce32eb7b557a029c196a017c3eb3"
},
"downloads": -1,
"filename": "stactools_usda_cdl-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8d00a7fc751629d10acc91fd1e9f01cd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 15267,
"upload_time": "2023-01-12T19:33:22",
"upload_time_iso_8601": "2023-01-12T19:33:22.675199Z",
"url": "https://files.pythonhosted.org/packages/a4/75/8f8931574b0cd806e540820bbe87e3759d35d9fd69b1c73db157442be924/stactools_usda_cdl-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4959b29759a02b0d37903b4b9af64222e16defaa435c561f574278cbb864ddf1",
"md5": "b9f9a7194c2d8beab5f0cab759e1bce8",
"sha256": "01b4c4447579e88cd3e6d98458b7c90c8475d07d2a431dab1dfc83d2013884ce"
},
"downloads": -1,
"filename": "stactools-usda-cdl-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "b9f9a7194c2d8beab5f0cab759e1bce8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 14816,
"upload_time": "2023-01-12T19:33:24",
"upload_time_iso_8601": "2023-01-12T19:33:24.356434Z",
"url": "https://files.pythonhosted.org/packages/49/59/b29759a02b0d37903b4b9af64222e16defaa435c561f574278cbb864ddf1/stactools-usda-cdl-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-12 19:33:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "stactools-packages",
"github_project": "usda-cdl",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "stactools-usda-cdl"
}