From 800cdd1dee951bd7728a341a84589a08b77c6f18 Mon Sep 17 00:00:00 2001 From: Phil Varner Date: Wed, 13 Apr 2022 10:25:23 -0400 Subject: [PATCH 01/10] configure to use pre-commit with black, etc. --- .codespellignore | 1 + .flake8 | 5 +- .github/workflows/continuous-integration.yml | 11 +- .isort.cfg | 2 + .pre-commit-config.yaml | 40 +++++++ CHANGELOG.md | 13 ++ README.md | 20 +++- requirements-dev.txt | 12 +- scripts/format | 4 +- scripts/lint | 6 +- scripts/test | 2 +- src/stactools/naip/__init__.py | 6 +- src/stactools/naip/commands.py | 49 ++++---- src/stactools/naip/constants.py | 28 +++-- src/stactools/naip/stac.py | 119 +++++++++++-------- src/stactools/naip/utils.py | 16 +-- tests/test_commands.py | 49 ++++---- tests/test_stac.py | 3 +- tests/test_utils.py | 26 ++-- 19 files changed, 254 insertions(+), 158 deletions(-) create mode 100644 .isort.cfg create mode 100644 .pre-commit-config.yaml create mode 100644 CHANGELOG.md diff --git a/.codespellignore b/.codespellignore index e69de29..d9b9fbf 100644 --- a/.codespellignore +++ b/.codespellignore @@ -0,0 +1 @@ +naip \ No newline at end of file diff --git a/.flake8 b/.flake8 index df89ae0..470cf8b 100644 --- a/.flake8 +++ b/.flake8 @@ -9,7 +9,4 @@ max-line-length = 100 # W503, W504: flake8 reports this as incorrect, and scripts/format_code # changes code to it, so let format_code win. -# E126: Continuation line over-indented for hanging indent -# Conflicts with yapf formatting - -ignore = E127,W503,W504,E126 \ No newline at end of file +ignore = E127,W503,W504 \ No newline at end of file diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 2f6d932..1b2445a 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9"] + python-version: ["3.7", "3.8", "3.9", "3.10"] defaults: run: shell: bash -l {0} @@ -43,6 +43,12 @@ jobs: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.cfg', '**/requirements-dev.txt') }} restore-keys: ${{ runner.os }}-pip- + - name: Set up pre-commit cache + uses: actions/cache@v2 + with: + path: ~/.cache/pre-commit + key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml' )}} + restore-keys: ${{ runner.os }}-pre-commit- - name: Set up Conda with Python ${{ matrix.python-version }} uses: conda-incubator/setup-miniconda@v2 with: @@ -50,5 +56,8 @@ jobs: python-version: ${{ matrix.python-version }} - name: Update Conda's environemnt run: conda env update -f environment.yml -n test + - name: install rasterio 1.3a3 if python 3.10 + if: matrix.python-version == '3.10' + run: pip install rasterio==1.3a3 - name: Execute linters and test suites run: ./scripts/cibuild diff --git a/.isort.cfg b/.isort.cfg new file mode 100644 index 0000000..f238bf7 --- /dev/null +++ b/.isort.cfg @@ -0,0 +1,2 @@ +[settings] +profile = black diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..1d8f7c8 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,40 @@ +# Configuration file for pre-commit (https://pre-commit.com/). +# Please run `pre-commit run --all-files` when adding or changing entries. + +repos: + - repo: https://github.com/psf/black + rev: 22.3.0 + hooks: + - id: black + - repo: https://github.com/codespell-project/codespell + rev: v2.1.0 + hooks: + - id: codespell + args: [--ignore-words=.codespellignore] + types_or: [jupyter, markdown, python, shell] + - repo: https://github.com/PyCQA/flake8 + rev: 4.0.1 + hooks: + - id: flake8 + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v0.942 + hooks: + - id: mypy + # TODO lint test and scripts too + files: "^src/.*\\.py$" + args: + - --namespace-packages + - --ignore-missing-imports + - --explicit-package-bases + additional_dependencies: + - click != 8.1.0 + - numpy + - pyproj + - pystac + - types-requests + - types-python-dateutil + - repo: https://github.com/pycqa/isort + rev: 5.10.1 + hooks: + - id: isort + name: isort (python) diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..d073c00 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,13 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). This project attempts to match the major and minor versions of [stactools](https://github.com/stac-utils/stactools) and increments the patch number as needed. + +## Unreleased + +### Changed + +- updated stactools dependency to version 0.3.0 + +### Added diff --git a/README.md b/README.md index 9926e5d..ff2dae6 100644 --- a/README.md +++ b/README.md @@ -20,5 +20,23 @@ export AWS_REQUEST_PAYER='requester' stac naip create-item --fgdc m_3707763_se_18_060_20180825.txt \ VA 2018 s3://naip-analytic/va/2018/60cm/rgbir_cog/37077/m_3707763_se_18_060_20180825.tif \ json-dest/ +``` + +## Development + +```shell +pip install -r requirements-dev.txt +``` + + +Install pre-commit hooks with: -``` \ No newline at end of file +```shell +pre-commit install +``` + +Run these before commit with: + +```shell +pre-commit run --all-files +``` diff --git a/requirements-dev.txt b/requirements-dev.txt index 1d3447e..61e0943 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,11 +1,7 @@ +black codespell coverage flake8 -pylint -sphinx -sphinx-autobuild -sphinx-click -sphinxcontrib-fulltoc -sphinxcontrib-napoleon -toml -yapf +pre-commit +pytest +pytest-cov \ No newline at end of file diff --git a/scripts/format b/scripts/format index 36b28bc..14bc2aa 100755 --- a/scripts/format +++ b/scripts/format @@ -9,7 +9,7 @@ fi function usage() { echo -n \ "Usage: $(basename "$0") -Format code with yapf +Format code with black " } @@ -20,6 +20,6 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then usage else # Code formatting - yapf -ipr ${DIRS_TO_CHECK[@]} + pre-commit run black --all-files fi fi diff --git a/scripts/lint b/scripts/lint index e368f49..1216871 100755 --- a/scripts/lint +++ b/scripts/lint @@ -19,10 +19,6 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then if [ "${1:-}" = "--help" ]; then usage else - # Code formatting - yapf -dpr ${DIRS_TO_CHECK[@]} - # Lint - flake8 ${DIRS_TO_CHECK[@]} - + pre-commit run --all-files fi fi diff --git a/scripts/test b/scripts/test index d7a05c7..1421a6b 100755 --- a/scripts/test +++ b/scripts/test @@ -27,7 +27,7 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then docs/*.rst docs/**/*.rst \ docs/*.ipynb docs/**/*.ipynb - coverage run --source=${COVERAGE_DIRS} -m unittest discover tests/ + pytest --cov=stactools tests/ coverage xml fi fi diff --git a/src/stactools/naip/__init__.py b/src/stactools/naip/__init__.py index 2069ca7..bd842b4 100644 --- a/src/stactools/naip/__init__.py +++ b/src/stactools/naip/__init__.py @@ -1,9 +1,9 @@ # flake8: noqa -from stactools.naip.stac import create_item - import stactools.core +from stactools.naip.stac import create_item + stactools.core.use_fsspec() @@ -15,4 +15,4 @@ def register_plugin(registry): registry.register_subcommand(commands.create_naip_command) -__version__ = '0.1.6' +__version__ = "0.1.6" diff --git a/src/stactools/naip/commands.py b/src/stactools/naip/commands.py index 59cd15a..e340211 100644 --- a/src/stactools/naip/commands.py +++ b/src/stactools/naip/commands.py @@ -1,5 +1,5 @@ -import logging import json +import logging import os import click @@ -15,28 +15,23 @@ def create_naip_command(cli): NAIP imagery. """ - @cli.group('naip', - short_help=("Commands for working with " - "NAIP imagery.")) + @cli.group("naip", short_help="Commands for working with " "NAIP imagery.") def naip(): pass - @naip.command('create-item', - short_help='Create a STAC Item from NAIP imagery data') - @click.argument('state') - @click.argument('year') - @click.argument('cog_href') - @click.argument('dst') - @click.option('-f', '--fgdc', help='HREF to FGDC metadata.') - @click.option('-t', - '--thumbnail', - help='HREF to the thumbnail for this NAIP tile') + @naip.command("create-item", short_help="Create a STAC Item from NAIP imagery data") + @click.argument("state") + @click.argument("year") + @click.argument("cog_href") + @click.argument("dst") + @click.option("-f", "--fgdc", help="HREF to FGDC metadata.") + @click.option("-t", "--thumbnail", help="HREF to the thumbnail for this NAIP tile") @click.option( - '-p', - '--providers', - help='Path to JSON file containing array of additional providers') - def create_item_command(state, year, cog_href, dst, fgdc, thumbnail, - providers): + "-p", + "--providers", + help="Path to JSON file containing array of additional providers", + ) + def create_item_command(state, year, cog_href, dst, fgdc, thumbnail, providers): """Creates a STAC Item based on metadata from a NAIP tile. STATE is the state this NAIP tile belongs to. @@ -52,14 +47,16 @@ def create_item_command(state, year, cog_href, dst, fgdc, thumbnail, pystac.Provider.from_dict(d) for d in json.load(f) ] - item = create_item(state, - year, - cog_href, - fgdc_metadata_href=fgdc, - thumbnail_href=thumbnail, - additional_providers=additional_providers) + item = create_item( + state, + year, + cog_href, + fgdc_metadata_href=fgdc, + thumbnail_href=thumbnail, + additional_providers=additional_providers, + ) - item_path = os.path.join(dst, '{}.json'.format(item.id)) + item_path = os.path.join(dst, "{}.json".format(item.id)) item.set_self_href(item_path) item.save_object() diff --git a/src/stactools/naip/constants.py b/src/stactools/naip/constants.py index 59b2a0d..ee58fc9 100644 --- a/src/stactools/naip/constants.py +++ b/src/stactools/naip/constants.py @@ -1,7 +1,8 @@ import pystac from pystac.extensions.eo import Band +from pystac.provider import ProviderRole -NAIP_ID = 'usda-naip' +NAIP_ID = "usda-naip" NAIP_TITLE = "NAIP: National Agriculture Imagery Program" NAIP_DESCRIPTION = """ The National Agriculture Imagery Program (NAIP) acquires aerial imagery @@ -19,19 +20,24 @@ Older images were collected using 3 bands (Red, Green, and Blue: RGB), but newer imagery is usually collected with an additional near-infrared band (RGBN). -""".strip('\n') +""".strip( + "\n" +) -NAIP_LICENSE = 'PDDL-1.0' +NAIP_LICENSE = "PDDL-1.0" USDA_PROVIDER = pystac.Provider( - name='USDA Farm Service Agency', - url=('https://www.fsa.usda.gov/programs-and-services/aerial-photography' - '/imagery-programs/naip-imagery/'), - roles=['producer', 'licensor']) + name="USDA Farm Service Agency", + url=( + "https://www.fsa.usda.gov/programs-and-services/aerial-photography" + "/imagery-programs/naip-imagery/" + ), + roles=[ProviderRole.PRODUCER, ProviderRole.LICENSOR], +) NAIP_BANDS = [ - Band.create(name="Red", common_name='red'), - Band.create(name="Green", common_name='green'), - Band.create(name="Blue", common_name='blue'), - Band.create(name="NIR", common_name='nir', description="near-infrared") + Band.create(name="Red", common_name="red"), + Band.create(name="Green", common_name="green"), + Band.create(name="Blue", common_name="blue"), + Band.create(name="NIR", common_name="nir", description="near-infrared"), ] diff --git a/src/stactools/naip/stac.py b/src/stactools/naip/stac.py index 97b2e1a..383d47a 100644 --- a/src/stactools/naip/stac.py +++ b/src/stactools/naip/stac.py @@ -3,15 +3,15 @@ import dateutil.parser import pystac +import rasterio as rio from pystac.extensions.eo import EOExtension from pystac.extensions.item_assets import ItemAssetsExtension from pystac.extensions.projection import ProjectionExtension from pystac.utils import str_to_datetime -from shapely.geometry import shape, box, mapping -import rasterio as rio - -from stactools.core.projection import reproject_geom +from shapely.geometry import box, mapping, shape from stactools.core.io import read_text +from stactools.core.projection import reproject_geom + from stactools.naip import constants from stactools.naip.utils import parse_fgdc_metadata @@ -28,7 +28,7 @@ def naip_item_id(state, resource_name): str: The STAC ID to use for this scene. """ - return '{}_{}'.format(state, os.path.splitext(resource_name)[0]) + return "{}_{}".format(state, os.path.splitext(resource_name)[0]) def create_collection(seasons: List[int]) -> pystac.Collection: @@ -40,10 +40,15 @@ def create_collection(seasons: List[int]) -> pystac.Collection: """ extent = pystac.Extent( pystac.SpatialExtent(bboxes=[[-124.784, 24.744, -66.951, 49.346]]), - pystac.TemporalExtent(intervals=[[ - pystac.utils.str_to_datetime(f"{min(seasons)}-01-01T00:00:00Z"), - pystac.utils.str_to_datetime(f"{max(seasons)}-01-01T00:00:00Z") - ]])) + pystac.TemporalExtent( + intervals=[ + [ + pystac.utils.str_to_datetime(f"{min(seasons)}-01-01T00:00:00Z"), + pystac.utils.str_to_datetime(f"{max(seasons)}-01-01T00:00:00Z"), + ] + ] + ), + ) collection = pystac.Collection( id=constants.NAIP_ID, @@ -53,26 +58,29 @@ def create_collection(seasons: List[int]) -> pystac.Collection: providers=[constants.USDA_PROVIDER], extent=extent, extra_fields={ - 'item_assets': { - 'image': { + "item_assets": { + "image": { "eo:bands": [b.properties for b in constants.NAIP_BANDS], "roles": ["data"], "title": "RGBIR COG tile", - "type": pystac.MediaType.COG + "type": pystac.MediaType.COG, }, } - }) + }, + ) ItemAssetsExtension.add_to(collection) return collection -def create_item(state, - year, - cog_href, - fgdc_metadata_href: Optional[str], - thumbnail_href=None, - additional_providers=None): +def create_item( + state, + year, + cog_href, + fgdc_metadata_href: Optional[str], + thumbnail_href=None, + additional_providers=None, +): """Creates a STAC Item from NAIP data. Args: @@ -100,10 +108,9 @@ def create_item(state, image_shape = list(ds.shape) original_bbox = list(ds.bounds) transform = list(ds.transform) - geom = reproject_geom(ds.crs, - 'epsg:4326', - mapping(box(*ds.bounds)), - precision=6) + geom = reproject_geom( + ds.crs, "epsg:4326", mapping(box(*ds.bounds)), precision=6 + ) if fgdc_metadata_href is not None: fgdc_metadata_text = read_text(fgdc_metadata_href) @@ -111,9 +118,8 @@ def create_item(state, else: fgdc = {} - if 'Distribution_Information' in fgdc: - resource_desc = fgdc['Distribution_Information'][ - 'Resource_Description'] + if "Distribution_Information" in fgdc: + resource_desc = fgdc["Distribution_Information"]["Resource_Description"] else: resource_desc = os.path.basename(cog_href) item_id = naip_item_id(state, resource_desc) @@ -122,20 +128,20 @@ def create_item(state, if any(fgdc): dt = str_to_datetime( - fgdc['Identification_Information']['Time_Period_of_Content'] - ['Time_Period_Information']['Single_Date/Time']['Calendar_Date']) + fgdc["Identification_Information"]["Time_Period_of_Content"][ + "Time_Period_Information" + ]["Single_Date/Time"]["Calendar_Date"] + ) else: fname = os.path.splitext(os.path.basename(cog_href))[0] - fname_date = fname.split('_')[5] + fname_date = fname.split("_")[5] dt = dateutil.parser.isoparse(fname_date) - properties = {'naip:state': state, 'naip:year': year} + properties = {"naip:state": state, "naip:year": year} - item = pystac.Item(id=item_id, - geometry=geom, - bbox=bounds, - datetime=dt, - properties=properties) + item = pystac.Item( + id=item_id, geometry=geom, bbox=bounds, datetime=dt, properties=properties + ) # Common metadata item.common_metadata.providers = [constants.USDA_PROVIDER] @@ -155,31 +161,40 @@ def create_item(state, # COG item.add_asset( - 'image', - pystac.Asset(href=cog_href, - media_type=pystac.MediaType.COG, - roles=['data'], - title="RGBIR COG tile")) + "image", + pystac.Asset( + href=cog_href, + media_type=pystac.MediaType.COG, + roles=["data"], + title="RGBIR COG tile", + ), + ) # Metadata - if any(fgdc): + if any(fgdc) and fgdc_metadata_href is not None: item.add_asset( - 'metadata', - pystac.Asset(href=fgdc_metadata_href, - media_type=pystac.MediaType.TEXT, - roles=['metadata'], - title='FGDC Metdata')) + "metadata", + pystac.Asset( + href=fgdc_metadata_href, + media_type=pystac.MediaType.TEXT, + roles=["metadata"], + title="FGDC Metadata", + ), + ) if thumbnail_href is not None: media_type = pystac.MediaType.JPEG - if thumbnail_href.lower().endswith('png'): + if thumbnail_href.lower().endswith("png"): media_type = pystac.MediaType.PNG item.add_asset( - 'thumbnail', - pystac.Asset(href=thumbnail_href, - media_type=media_type, - roles=['thumbnail'], - title='Thumbnail')) + "thumbnail", + pystac.Asset( + href=thumbnail_href, + media_type=media_type, + roles=["thumbnail"], + title="Thumbnail", + ), + ) asset_eo = EOExtension.ext(item.assets["image"]) asset_eo.bands = constants.NAIP_BANDS diff --git a/src/stactools/naip/utils.py b/src/stactools/naip/utils.py index 814ad33..7a384dd 100644 --- a/src/stactools/naip/utils.py +++ b/src/stactools/naip/utils.py @@ -2,7 +2,7 @@ def parse_fgdc_metadata(md_text): - line_pattern = r'([\s]*)([^:]+)*(\:?)[\s]*(.*)' + line_pattern = r"([\s]*)([^:]+)*(\:?)[\s]*(.*)" def _parse(lines, group_indent=0): result = {} @@ -12,9 +12,9 @@ def _parse(lines, group_indent=0): # Peek at the next line to see if we're done this group line = lines[0] # Replace stray carriage returns - line = line.replace('^M', '') + line = line.replace("^M", "") # Replace tabs with 4 spaces - line = line.replace('\t', ' ') + line = line.replace("\t", " ") if not line.strip(): lines.pop(0) @@ -22,7 +22,7 @@ def _parse(lines, group_indent=0): m = re.search(line_pattern, line) if not m: - raise Exception('Could not parses line:\n{}\n'.format(line)) + raise Exception("Could not parses line:\n{}\n".format(line)) this_indent = len(m.group(1)) @@ -37,14 +37,14 @@ def _parse(lines, group_indent=0): # If we're collecting multi-line text values, # just add the line to the result text. if is_multiline_text: - result_text += ' {}'.format(line.strip()) + result_text += " {}".format(line.strip()) continue this_key = m.group(2) - key_flag = m.group(3) != '' and ' ' not in this_key + key_flag = m.group(3) != "" and " " not in this_key this_value = m.group(4) - if key_flag and this_value != '': + if key_flag and this_value != "": result[this_key] = this_value.strip() else: if key_flag: @@ -58,4 +58,4 @@ def _parse(lines, group_indent=0): else: return result - return _parse(md_text.split('\n'), group_indent=0)['Metadata'] + return _parse(md_text.split("\n"), group_indent=0)["Metadata"] diff --git a/tests/test_commands.py b/tests/test_commands.py index 991c107..6dc09e3 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -2,32 +2,36 @@ from tempfile import TemporaryDirectory import pystac - -from stactools.naip.commands import create_naip_command from stactools.testing import CliTestCase +from stactools.naip.commands import create_naip_command from tests import test_data class CreateItemTest(CliTestCase): - def create_subcommand_functions(self): return [create_naip_command] def test_create_item(self): - fgdc_href = test_data.get_path( - 'data-files/m_3008501_ne_16_1_20110815.txt') + fgdc_href = test_data.get_path("data-files/m_3008501_ne_16_1_20110815.txt") cog_href = test_data.get_path( - 'data-files/m_3008501_ne_16_1_20110815-downsampled.tif') + "data-files/m_3008501_ne_16_1_20110815-downsampled.tif" + ) with TemporaryDirectory() as tmp_dir: cmd = [ - 'naip', 'create-item', 'al', '2011', cog_href, '--fgdc', - fgdc_href, tmp_dir + "naip", + "create-item", + "al", + "2011", + cog_href, + "--fgdc", + fgdc_href, + tmp_dir, ] self.run_command(cmd) - jsons = [p for p in os.listdir(tmp_dir) if p.endswith('.json')] + jsons = [p for p in os.listdir(tmp_dir) if p.endswith(".json")] self.assertEqual(len(jsons), 1) item_path = os.path.join(tmp_dir, jsons[0]) @@ -37,21 +41,26 @@ def test_create_item(self): item.validate() def test_create_item_no_resource_desc(self): - fgdc_href = test_data.get_path( - 'data-files/m_4207201_ne_18_h_20160809.txt') + fgdc_href = test_data.get_path("data-files/m_4207201_ne_18_h_20160809.txt") cog_href = ( - 'https://naipeuwest.blob.core.windows.net/' - 'naip/v002/vt/2016/vt_060cm_2016/42072/m_4207201_ne_18_h_20160809.tif' + "https://naipeuwest.blob.core.windows.net/" + "naip/v002/vt/2016/vt_060cm_2016/42072/m_4207201_ne_18_h_20160809.tif" ) with TemporaryDirectory() as tmp_dir: cmd = [ - 'naip', 'create-item', 'al', '2016', cog_href, '--fgdc', - fgdc_href, tmp_dir + "naip", + "create-item", + "al", + "2016", + cog_href, + "--fgdc", + fgdc_href, + tmp_dir, ] self.run_command(cmd) - jsons = [p for p in os.listdir(tmp_dir) if p.endswith('.json')] + jsons = [p for p in os.listdir(tmp_dir) if p.endswith(".json")] self.assertEqual(len(jsons), 1) item_path = os.path.join(tmp_dir, jsons[0]) @@ -62,15 +71,15 @@ def test_create_item_no_resource_desc(self): def test_create_item_no_fgdc(self): cog_href = ( - 'https://naipeuwest.blob.core.windows.net/' - 'naip/v002/ar/2010/ar_100cm_2010/33093/m_3309302_sw_15_1_20100623.tif' + "https://naipeuwest.blob.core.windows.net/" + "naip/v002/ar/2010/ar_100cm_2010/33093/m_3309302_sw_15_1_20100623.tif" ) with TemporaryDirectory() as tmp_dir: - cmd = ['naip', 'create-item', 'al', '2016', cog_href, tmp_dir] + cmd = ["naip", "create-item", "al", "2016", cog_href, tmp_dir] self.run_command(cmd) - jsons = [p for p in os.listdir(tmp_dir) if p.endswith('.json')] + jsons = [p for p in os.listdir(tmp_dir) if p.endswith(".json")] self.assertEqual(len(jsons), 1) item_path = os.path.join(tmp_dir, jsons[0]) diff --git a/tests/test_stac.py b/tests/test_stac.py index 5c0ec07..50f1d5e 100644 --- a/tests/test_stac.py +++ b/tests/test_stac.py @@ -4,9 +4,8 @@ class StacTest(unittest.TestCase): - def test_create_collection(self): collection = create_collection(seasons=[2011, 2013, 2015, 2017, 2019]) - collection.set_self_href('http://example.com/collection.json') + collection.set_self_href("http://example.com/collection.json") collection.validate() diff --git a/tests/test_utils.py b/tests/test_utils.py index 7d55246..78f4a76 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,31 +1,29 @@ import unittest from stactools.naip.utils import parse_fgdc_metadata - from tests import test_data # Test cases, file names to keys and values that should exist. FGDC_FILES = { - 'm_4107212_se_18_060_20180816.txt': { - 'Distribution_Information': { - 'Resource_Description': 'm_4107212_se_18_060_20180816_20181211.tif' + "m_4107212_se_18_060_20180816.txt": { + "Distribution_Information": { + "Resource_Description": "m_4107212_se_18_060_20180816_20181211.tif" }, - 'Identification_Information': { - 'Spatial_Domain': { - 'Bounding_Coordinates': { - 'West_Bounding_Coordinate': '-72.5625', - 'East_Bounding_Coordinate': '-72.5000', - 'North_Bounding_Coordinate': '41.8125', - 'South_Bounding_Coordinate': '41.7500' + "Identification_Information": { + "Spatial_Domain": { + "Bounding_Coordinates": { + "West_Bounding_Coordinate": "-72.5625", + "East_Bounding_Coordinate": "-72.5000", + "North_Bounding_Coordinate": "41.8125", + "South_Bounding_Coordinate": "41.7500", } } - } + }, } } class UtilsTest(unittest.TestCase): - def check_values(self, actual_dict, expected_dict): for k in expected_dict: self.assertIn(k, actual_dict) @@ -39,7 +37,7 @@ def check_values(self, actual_dict, expected_dict): def test_parses_fgdc(self): for test_file, expected in FGDC_FILES.items(): - path = test_data.get_path('data-files/{}'.format(test_file)) + path = test_data.get_path("data-files/{}".format(test_file)) with self.subTest(test_file): with open(path) as f: fgdc_txt = f.read() From 588bd96647c7427593be4a1e26ced839740039e6 Mon Sep 17 00:00:00 2001 From: Phil Varner Date: Wed, 13 Apr 2022 10:29:26 -0400 Subject: [PATCH 02/10] remove unused import --- src/stactools/naip/__init__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/stactools/naip/__init__.py b/src/stactools/naip/__init__.py index bd842b4..1e425c0 100644 --- a/src/stactools/naip/__init__.py +++ b/src/stactools/naip/__init__.py @@ -2,8 +2,6 @@ import stactools.core -from stactools.naip.stac import create_item - stactools.core.use_fsspec() From eb5ef78eb27d46e382451a004f661c0a6ec2e38f Mon Sep 17 00:00:00 2001 From: Phil Varner Date: Wed, 13 Apr 2022 10:45:17 -0400 Subject: [PATCH 03/10] don't run 3.10 in ci --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 1b2445a..c56087f 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.7", "3.8", "3.9"] # 3.10 fails with proj_identify error defaults: run: shell: bash -l {0} From 0e8b10c7ee54ec16a05feff2e7504fde5cb9bfa1 Mon Sep 17 00:00:00 2001 From: Phil Varner Date: Wed, 13 Apr 2022 11:10:48 -0400 Subject: [PATCH 04/10] add grid extension --- ...m_3707763_se_18_060_20180825_20190211.json | 126 +++++++ m_3707763_se_18_060_20180825.txt | 317 ++++++++++++++++++ src/stactools/naip/grid.py | 107 ++++++ src/stactools/naip/stac.py | 15 +- 4 files changed, 562 insertions(+), 3 deletions(-) create mode 100644 json-dest/VA_m_3707763_se_18_060_20180825_20190211.json create mode 100644 m_3707763_se_18_060_20180825.txt create mode 100644 src/stactools/naip/grid.py diff --git a/json-dest/VA_m_3707763_se_18_060_20180825_20190211.json b/json-dest/VA_m_3707763_se_18_060_20180825_20190211.json new file mode 100644 index 0000000..8541e46 --- /dev/null +++ b/json-dest/VA_m_3707763_se_18_060_20180825_20190211.json @@ -0,0 +1,126 @@ +{ + "type": "Feature", + "stac_version": "1.0.0", + "id": "VA_m_3707763_se_18_060_20180825_20190211", + "properties": { + "naip:state": "VA", + "naip:year": "2018", + "providers": [ + { + "name": "USDA Farm Service Agency", + "roles": [ + "producer", + "licensor" + ], + "url": "https://www.fsa.usda.gov/programs-and-services/aerial-photography/imagery-programs/naip-imagery/" + } + ], + "gsd": 0.5999999999999955, + "proj:epsg": 26918, + "proj:shape": [ + 12859, + 10457 + ], + "proj:bbox": [ + 305096.4, + 4096683.0, + 311370.6, + 4104398.4 + ], + "proj:transform": [ + 0.5999999999999955, + 0.0, + 305096.4, + 0.0, + -0.5999999999999928, + 4104398.4, + 0.0, + 0.0, + 1.0 + ], + "grid:code": "DOQQ-3707763SE", + "datetime": "2018-08-25T00:00:00Z" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -77.119789, + 36.997386 + ], + [ + -77.121722, + 37.066888 + ], + [ + -77.192249, + 37.065605 + ], + [ + -77.190251, + 36.996106 + ], + [ + -77.119789, + 36.997386 + ] + ] + ] + }, + "links": [ + { + "rel": "self", + "href": "/Users/philvarner/code/naip/json-dest/VA_m_3707763_se_18_060_20180825_20190211.json", + "type": "application/json" + } + ], + "assets": { + "image": { + "href": "s3://naip-analytic/va/2018/60cm/rgbir_cog/37077/m_3707763_se_18_060_20180825.tif", + "type": "image/tiff; application=geotiff; profile=cloud-optimized", + "title": "RGBIR COG tile", + "eo:bands": [ + { + "name": "Red", + "common_name": "red" + }, + { + "name": "Green", + "common_name": "green" + }, + { + "name": "Blue", + "common_name": "blue" + }, + { + "name": "NIR", + "common_name": "nir", + "description": "near-infrared" + } + ], + "roles": [ + "data" + ] + }, + "metadata": { + "href": "m_3707763_se_18_060_20180825.txt", + "type": "text/plain", + "title": "FGDC Metadata", + "roles": [ + "metadata" + ] + } + }, + "bbox": [ + -77.192249, + 36.996106, + -77.119789, + 37.066888 + ], + "stac_extensions": [ + "https://stac-extensions.github.io/eo/v1.0.0/schema.json", + "https://stac-extensions.github.io/projection/v1.0.0/schema.json", + "https://stac-extensions.github.io/grid/v1.0.0/schema.json" + ] +} \ No newline at end of file diff --git a/m_3707763_se_18_060_20180825.txt b/m_3707763_se_18_060_20180825.txt new file mode 100644 index 0000000..c14ef9c --- /dev/null +++ b/m_3707763_se_18_060_20180825.txt @@ -0,0 +1,317 @@ +Metadata: + Identification_Information: + Citation: + Citation_Information: + Originator: USDA-FPAC-BC-APFO Aerial Photography Field Office + Publication_Date: 20191105 + Title: NAIP Digital Georectified Image + Geospatial_Data_Presentation_Form: remote-sensing image + Publication_Information: + Publication_Place: Salt Lake City, Utah + Publisher: USDA-FPAC-BC-APFO Aerial Photography Field Office + Description: + Abstract: + This data set contains imagery from the National Agriculture + Imagery Program (NAIP). The NAIP program is administered by + USDA FSA and has been established to support two main FSA + strategic goals centered on agricultural production. + These are, increase stewardship of America's natural resources + while enhancing the environment, and to ensure commodities + are procured and distributed effectively and efficiently to + increase food security. The NAIP program supports these goals by + acquiring and providing ortho imagery that has been collected + during the agricultural growing season in the U.S. The NAIP + ortho imagery is tailored to meet FSA requirements and is a + fundamental tool used to support FSA farm and conservation + programs. Ortho imagery provides an effective, intuitive + means of communication about farm program administration + between FSA and stakeholders. + New technology and innovation is identified by fostering and + maintaining a relationship with vendors and government + partners, and by keeping pace with the broader geospatial + community. As a result of these efforts the NAIP program + provides three main products: DOQQ tiles, + Compressed County Mosaics (CCM), and Seamline shape files + The Contract specifications for NAIP imagery have changed + over time reflecting agency requirements and improving + technologies. These changes include image resolution, + horizontal accuracy, coverage area, and number of bands. + In general, flying seasons are established by FSA and are + targeted for peak crop growing conditions. The NAIP + acquisition cycle is based on a minimum 3 year refresh of base + ortho imagery. The tiling format of the NAIP imagery is based + on a 3.75' x 3.75' quarter quadrangle with a 300 pixel buffer + on all four sides. NAIP quarter quads are formatted to the UTM + coordinate system using the North American Datum of 1983. + NAIP imagery may contain as much as 10% cloud cover per tile. + Purpose: + NAIP imagery is available for distribution within 60 days + of the end of a flying season and is intended to provide current + information of agricultural conditions in support of USDA farm + programs. For USDA Farm Service Agency, the 1 meter and 1/2 meter + GSD product provides an ortho image base for Common Land Unit + boundaries and other data sets. The 100, 50, and 30 centimeter NAIP + imagery is generally acquired in projects covering full states in + cooperation with state government and other federal agencies that + use the imagery for a variety of purposes including land use + planning and natural resource assessment. The NAIP is also used + for disaster response. While suitable for a variety of uses, + prior to 2007 the 2 meter GSD NAIP imagery was primarily intended + to assess "crop condition and compliance" to USDA farm program + conditions. The 2 meter imagery was generally acquired only + for agricultural areas within state projects. + Time_Period_of_Content: + Time_Period_Information: + Single_Date/Time: + Calendar_Date: 20180825 + Currentness_Reference: Ground Condition + Status: + Progress: Complete + Maintenance_and_Update_Frequency: Irregular + Spatial_Domain: + Bounding_Coordinates: + West_Bounding_Coordinate: -77.1875 + East_Bounding_Coordinate: -77.1250 + North_Bounding_Coordinate: 37.0625 + South_Bounding_Coordinate: 37.0000 + Keywords: + Theme: + Theme_Keyword_Thesaurus: None + Theme_Keyword: farming + Theme_Keyword: Digital Ortho rectified Image + Theme_Keyword: Ortho Rectification + Theme_Keyword: Quarter Quadrangle + Theme_Keyword: NAIP + Theme_Keyword: Aerial Compliance + Theme_Keyword: Compliance + Place: + Place_Keyword_Thesaurus: Geographic Names Information System + Place_Keyword: VA + Place_Keyword: Sussex + Place_Keyword: 51183 + Place_Keyword: VA183 + Place_Keyword: SUSSEX CO VA FSA + Place_Keyword: 3707763 + Place_Keyword: DISPUTANTA SOUTH, SE + Place_Keyword: DISPUTANTA SOUTH + Access_Constraints: There are no limitations for access. + Use_Constraints: + None. The USDA-FPAC-BC Aerial Photography Field office + asks to be credited in derived products. + Point_of_Contact: + Contact_Information: + Contact_Organization_Primary: + Contact_Organization: Aerial Photography Field Office (APFO) + Contact_Address: + Address_Type: mailing and physical address + Address: 125 S. State Street Suite 6416 + City: Salt Lake City + State_or_Province: Utah + Postal_Code: 84138 + Country: USA + Contact_Voice_Telephone: 801-844-2922 + Contact_Facsimile_Telephone: 801-956-3653 + Contact_Electronic_Mail_Address: apfo.sales@slc.usda.gov + Browse_Graphic: + Browse_Graphic_File_Name: None + Browse_Graphic_File_Description: None + Browse_Graphic_File_Type: None + Native_Data_Set_Environment: Unknown + Data_Quality_Information: + Logical_Consistency_Report: + NAIP 3.75 minute tile file names are based + on the USGS quadrangle naming convention. + Completeness_Report: None + Positional_Accuracy: + Horizontal_Positional_Accuracy: + Horizontal_Positional_Accuracy_Report: + NAIP horizontal accuracy specifications have evolved over + the life of the program. From 2003 to 2004 the + specifications were as follows: 1-meter GSD imagery was + to match within 3-meters, and 2-meter GSD to match within 10 + meters of reference imagery. For 2005 the 1-meter GSD + specification was changed to 5 meters matching the reference + imagery. In 2006 a pilot project was performed using true + ground specifications rather than reference imagery. All + states used the same specifications as 2005 except Utah, + which required a match of +/- 6 meters to true ground. + In 2007 all specifications were the same as 2006 except + Arizona used true ground specifications and all other states + used reference imagery. In 2008 and subsequent years + no 2-meter GSD imagery was acquired and all specifications + were the same as 2007 except approximately half of the + states acquired used true ground specifications and the + other half used reference imagery. The 2008 states that + used absolute ground control where; Indiana, Minnesota, + New Hampshire, North Carolina, Texas, Vermont, and Virginia. + From 2009 to present all NAIP imagery acquisitions used + the +/- 6 meters to ground specification. + Lineage: + Source_Information: + Source_Citation: + Citation_Information: + Originator: USDA-FSA-APFO Aerial Photography Field Office + Publication_Date: 20191105 + Title: DISPUTANTA SOUTH, SE + Geospatial_Data_Presentation_Form: remote-sensing image + Type_of_Source_Media: UnKnown + Source_Time_Period_of_Content: + Time_Period_Information: + Single_Date/Time: + Calendar_Date: 20180825 + Source_Currentness_Reference: + Aerial Photography Date for aerial photo source. + Source_Citation_Abbreviation: Georectifed Image + Source_Contribution: Digital Georectifed Image. + + Process_Step: + Process_Description: + DOQQ Production Process Description; USDA FSA APFO NAIP Program 2018; State: Virginia. + The imagery was collected using the following digital sensors: Leica ADS-100 (Serial Number + 10510), Leica ADS-100 (Serial Number 10515), Leica ADS-100 (Serial Number 10522), Leica + ADS-100 (Serial Number 10530), Leica ADS-100 (Serial Number 10552), with Flight and Sensor + Control Management System (FCMS) firmware: v4.54, Cameras are calibrated radiometrically + and geometrically by the manufacturer and are all certified by the USGS. Collection was + performed using a combination of the following twin-engine aircraft with turbines flying at + 16,457 ft above mean terrain. Plane types: C441, Tail numbers: N2NQ, N414EH, N440EH, + N441EH, N441FS, With these flying heights, there is a 30% sidelap, giving the collected data + nominal ground sampling distance of 0.40 meters at 16,457 feet. Based-upon the CCD Array + configuration present in the ADS digital sensor, imagery for each flight line is 20,000-pixels in + width. Red, Green, Blue, Near-Infrared and Panchromatic image bands were collected. The + ADS 100 has the following band specifications: Red 619-651, Green 525-585, Blue 435-495, + Near Infrared 808-882, all values are in nanometers. Collected data was downloaded to + portable hard drives and shipped to the processing facility daily. Raw flight data was extracted + from external data drives using XPro software. Airborne GPS / IMU data was post-processed + using Inertial Explorer software and reviewed to ensure sufficient accuracy for project + requirements. Using Xpro software, planar rectified images were generated from the + collected data for use in image quality review. The planar rectified images were generated at + native resolution using a two standard deviation histogram stretch. Factors considered during + this review included but were not limited to the presence of smoke and/or cloud cover, + contrails, light conditions, sun glint and any sensor or hardware-related issues that potentially + could result in faulty data. When necessary, image strips identified as not meeting image + quality specifications were re-flown to obtain suitable imagery. Aero triangulation blocks + were defined primarily by order of acquisition and consisted of four to seventeen strips. + Image tie points providing the observations for the least squares bundle adjustment were + selected from the images using an auto correlation algorithm. Photogrammetric control + points consisted of photo identifiable control points, collected using GPS field survey + techniques. The control points were loaded into a softcopy workstation and measured in the + acquired image strips. A least squares bundle adjustment of image pass points, control points + and the ABGPS was performed to develop an aero triangulation solution for each block using + XPro software. Upon final bundle adjustment, the triangulated strips were ortho-rectified to + the digital elevation model (DEM). The most recent USGS 10-meter DEMs were used in the + rectification process. Positional accuracy was reviewed in the rectified imagery by visually + verifying the horizontal positioning of the known photo-identifiable survey locations using + ArcGIS software. The red, green, blue, and infrared bands were combined to generate a final + ortho-rectified image strip. The ADS sensor collects fourteen bit image data which requires + radiometric adjustment for output in standard eight bit image channels. The ortho-rectified + image strips were produced with the full 16 bit data range, allowing radiometric adjustment + to the 8 bit range to be performed on a strip by strip basis during the final mosaicking steps. + The 16 bit data range was adjusted for display in standard eight bit image channels by + defining a piecewise histogram stretch using OrthoVista Radiometrix software. A constant + stretch was defined for each image collection period, and then strip by strip adjustments + were made as needed to account for changes in sun angle and azimuth during the collection + period. Strip adjustments were also made to match the strips histograms as closely as + possible to APFO specified histogram metrics and color balance requirements. Automated + balancing algorithms were applied to account for bi-directional reflectance as a final step + before the conversion to 8 bit data range. The imagery was mosaicked using manual seam + line generation in OrthoVista + Process_Date: 20191105 + Spatial_Data_Organization_Information: + Indirect_Spatial_Reference: Sussex County, VA + Direct_Spatial_Reference_Method: Raster + Raster_Object_Information: + Raster_Object_Type: Pixel + Row_Count: 1 + Column_Count: 1 + Spatial_Reference_Information: + Horizontal_Coordinate_System_Definition: + Planar: + Grid_Coordinate_System: + Grid_Coordinate_System_Name: Universal Transverse Mercator + Universal_Transverse_Mercator: + UTM_Zone_Number: 18 + Transverse_Mercator: + Scale_Factor_at_Central_Meridian: 0.9996 + Longitude_of_Central_Meridian: -75.0 + Latitude_of_Projection_Origin: 0.0 + False_Easting: 500000 + False_Northing: 0.0 + Planar_Coordinate_Information: + Planar_Coordinate_Encoding_Method: row and column + Coordinate_Representation: + Abscissa_Resolution: .6 + Ordinate_Resolution: .6 + Planar_Distance_Units: meters + Geodetic_Model: + Horizontal_Datum_Name: North American Datum of 1983 + Ellipsoid_Name: Geodetic Reference System 80 (GRS 80) + Semi-major_Axis: 6378137 + Denominator_of_Flattening_Ratio: 298.257 + Entity_and_Attribute_Information: + Overview_Description: + Entity_and_Attribute_Overview: + 32-bit pixels, 4 band color(RGBIR) values 0 - 255 + Entity_and_Attribute_Detail_Citation: None + Distribution_Information: + Distributor: + Contact_Information: + Contact_Person_Primary: + Contact_Person: Supervisor Customer Services Section + Contact_Organization: + USDA-FPAC-BC-APFO Aerial Photography Field Office + Contact_Address: + Address_Type: mailing and physical address + Address: 125 S. State Street Suite 6416 + City: Salt Lake City + State_or_Province: Utah + Postal_Code: 84138 + Country: USA + Contact_Voice_Telephone: 801-844-2922 + Contact_Facsimile_Telephone: 801-956-3653 + Contact_Electronic_Mail_Address: apfo.sales@slc.usda.gov + Distribution_Liability: + In no event shall the creators, custodians, or distributors + of this information be liable for any damages arising out + of its use (or the inability to use it). + Standard_Order_Process: + Digital_Form: + Digital_Transfer_Information: + Format_Name: GeoTIFF - Georeferenced Tagged Image File Format + Format_Information_Content: Multispectral 4-band + Digital_Transfer_Option: + Offline_Option: + Offline_Media: CD-ROM + Recording_Format: ISO 9660 Mode 1 Level 2 Extensions + Offline_Option: + Offline_Media: DVD-R + Recording_Format: ISO 9660 + Offline_Option: + Offline_Media: USB Hard Disk + Recording_Format: NTFS + Offline_Option:^M + Offline_Media: USB Flash Thumb Drive^M + Recording_Format: NTFS^M + Fees: + Contact the Aerial Photography Field Office + for more information + Resource_Description: + m_3707763_se_18_060_20180825_20190211.tif + Metadata_Reference_Information: + Metadata_Date: 20191105 + Metadata_Contact: + Contact_Information: + Contact_Organization_Primary: + Contact_Organization: + USDA-FPAC-BC-APFO Aerial Photography Field Office + Contact_Address: + Address_Type: mailing and physical address + Address: 125 S. State Street Suite 6416 + City: Salt Lake City + State_or_Province: Utah + Postal_Code: 84138 + Country: USA + Contact_Voice_Telephone: 801-844-2922 + Metadata_Standard_Name: + Content Standard for Digital Geospatial Metadata + Metadata_Standard_Version: FGDC-STD-001-1998 + diff --git a/src/stactools/naip/grid.py b/src/stactools/naip/grid.py new file mode 100644 index 0000000..13bd556 --- /dev/null +++ b/src/stactools/naip/grid.py @@ -0,0 +1,107 @@ +"""Implements the :stac-ext:`Grid Extension `.""" + +import re +from typing import Any, Dict, Optional, Pattern, Set, Union, cast + +import pystac +from pystac.extensions.base import ExtensionManagementMixin, PropertiesExtension +from pystac.extensions.hooks import ExtensionHooks + +SCHEMA_URI: str = "https://stac-extensions.github.io/grid/v1.0.0/schema.json" +PREFIX: str = "grid:" + +# Field names +CODE_PROP: str = PREFIX + "code" # required + +CODE_REGEX: str = r"[A-Z]+-[-_.A-Za-z0-9]+" +CODE_PATTERN: Pattern[str] = re.compile(CODE_REGEX) + + +def validated_code(v: str) -> str: + if not isinstance(v, str): + raise ValueError("Invalid Grid code: must be str") + if not CODE_PATTERN.fullmatch(v): + raise ValueError( + f"Invalid Grid code: {v}" f" does not match the regex {CODE_REGEX}" + ) + return v + + +class GridExtension( + PropertiesExtension, + ExtensionManagementMixin[Union[pystac.Item, pystac.Collection]], +): + """A concrete implementation of :class:`GridExtension` on an :class:`~pystac.Item` + that extends the properties of the Item to include properties defined in the + :stac-ext:`Grid Extension `. + + This class should generally not be instantiated directly. Instead, call + :meth:`GridExtension.ext` on an :class:`~pystac.Item` to extend it. + + .. code-block:: python + + >>> item: pystac.Item = ... + >>> proj_ext = GridExtension.ext(item) + """ + + item: pystac.Item + """The :class:`~pystac.Item` being extended.""" + + properties: Dict[str, Any] + """The :class:`~pystac.Item` properties, including extension properties.""" + + def __init__(self, item: pystac.Item): + self.item = item + self.properties = item.properties + + def __repr__(self) -> str: + return "".format(self.item.id) + + def apply(self, code: str) -> None: + """Applies Grid extension properties to the extended Item. + + Args: + code : REQUIRED. The code of the Item's grid location. + """ + self.code = validated_code(code) + + @property + def code(self) -> Optional[str]: + """Get or sets the latitude band of the datasource.""" + return self._get_property(CODE_PROP, str) + + @code.setter + def code(self, v: str) -> None: + self._set_property(CODE_PROP, validated_code(v), pop_if_none=False) + + @classmethod + def get_schema_uri(cls) -> str: + return SCHEMA_URI + + @classmethod + def ext(cls, obj: pystac.Item, add_if_missing: bool = False) -> "GridExtension": + """Extends the given STAC Object with properties from the :stac-ext:`Grid + Extension `. + + This extension can be applied to instances of :class:`~pystac.Item`. + + Raises: + + pystac.ExtensionTypeError : If an invalid object type is passed. + """ + if isinstance(obj, pystac.Item): + cls.validate_has_extension(obj, add_if_missing) + return cast(GridExtension, GridExtension(obj)) + else: + raise pystac.ExtensionTypeError( + f"Grid Extension does not apply to type '{type(obj).__name__}'" + ) + + +class GridExtensionHooks(ExtensionHooks): + schema_uri: str = SCHEMA_URI + prev_extension_ids: Set[str] = set() + stac_object_types = {pystac.STACObjectType.ITEM} + + +Grid_EXTENSION_HOOKS: ExtensionHooks = GridExtensionHooks() diff --git a/src/stactools/naip/stac.py b/src/stactools/naip/stac.py index 383d47a..4661b2b 100644 --- a/src/stactools/naip/stac.py +++ b/src/stactools/naip/stac.py @@ -1,5 +1,6 @@ import os -from typing import List, Optional +import re +from typing import Final, List, Optional, Pattern import dateutil.parser import pystac @@ -13,8 +14,11 @@ from stactools.core.projection import reproject_geom from stactools.naip import constants +from stactools.naip.grid import GridExtension from stactools.naip.utils import parse_fgdc_metadata +DOQQ_PATTERN: Final[Pattern[str]] = re.compile(r"[A-Za-z]{2}_m_(\d{7})_(ne|se|nw|sw)_") + def naip_item_id(state, resource_name): """Generates a STAC Item ID based on the state and the "Resource Description" @@ -149,16 +153,21 @@ def create_item( item.common_metadata.providers.extend(additional_providers) item.common_metadata.gsd = gsd - # eo, for asset bands + # EO Extension, for asset bands EOExtension.add_to(item) - # proj + # Projection Extension projection = ProjectionExtension.ext(item, add_if_missing=True) projection.epsg = epsg projection.shape = image_shape projection.bbox = original_bbox projection.transform = transform + # Grid Extension + grid = GridExtension.ext(item, add_if_missing=True) + if match := DOQQ_PATTERN.search(item_id): + grid.code = f"DOQQ-{match.group(1)}{match.group(2).upper()}" + # COG item.add_asset( "image", From f7200ea032f5a567925e0ada8242add9ad217f94 Mon Sep 17 00:00:00 2001 From: Phil Varner Date: Wed, 13 Apr 2022 11:11:50 -0400 Subject: [PATCH 05/10] remove file --- ...m_3707763_se_18_060_20180825_20190211.json | 126 ------------------ 1 file changed, 126 deletions(-) delete mode 100644 json-dest/VA_m_3707763_se_18_060_20180825_20190211.json diff --git a/json-dest/VA_m_3707763_se_18_060_20180825_20190211.json b/json-dest/VA_m_3707763_se_18_060_20180825_20190211.json deleted file mode 100644 index 8541e46..0000000 --- a/json-dest/VA_m_3707763_se_18_060_20180825_20190211.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "type": "Feature", - "stac_version": "1.0.0", - "id": "VA_m_3707763_se_18_060_20180825_20190211", - "properties": { - "naip:state": "VA", - "naip:year": "2018", - "providers": [ - { - "name": "USDA Farm Service Agency", - "roles": [ - "producer", - "licensor" - ], - "url": "https://www.fsa.usda.gov/programs-and-services/aerial-photography/imagery-programs/naip-imagery/" - } - ], - "gsd": 0.5999999999999955, - "proj:epsg": 26918, - "proj:shape": [ - 12859, - 10457 - ], - "proj:bbox": [ - 305096.4, - 4096683.0, - 311370.6, - 4104398.4 - ], - "proj:transform": [ - 0.5999999999999955, - 0.0, - 305096.4, - 0.0, - -0.5999999999999928, - 4104398.4, - 0.0, - 0.0, - 1.0 - ], - "grid:code": "DOQQ-3707763SE", - "datetime": "2018-08-25T00:00:00Z" - }, - "geometry": { - "type": "Polygon", - "coordinates": [ - [ - [ - -77.119789, - 36.997386 - ], - [ - -77.121722, - 37.066888 - ], - [ - -77.192249, - 37.065605 - ], - [ - -77.190251, - 36.996106 - ], - [ - -77.119789, - 36.997386 - ] - ] - ] - }, - "links": [ - { - "rel": "self", - "href": "/Users/philvarner/code/naip/json-dest/VA_m_3707763_se_18_060_20180825_20190211.json", - "type": "application/json" - } - ], - "assets": { - "image": { - "href": "s3://naip-analytic/va/2018/60cm/rgbir_cog/37077/m_3707763_se_18_060_20180825.tif", - "type": "image/tiff; application=geotiff; profile=cloud-optimized", - "title": "RGBIR COG tile", - "eo:bands": [ - { - "name": "Red", - "common_name": "red" - }, - { - "name": "Green", - "common_name": "green" - }, - { - "name": "Blue", - "common_name": "blue" - }, - { - "name": "NIR", - "common_name": "nir", - "description": "near-infrared" - } - ], - "roles": [ - "data" - ] - }, - "metadata": { - "href": "m_3707763_se_18_060_20180825.txt", - "type": "text/plain", - "title": "FGDC Metadata", - "roles": [ - "metadata" - ] - } - }, - "bbox": [ - -77.192249, - 36.996106, - -77.119789, - 37.066888 - ], - "stac_extensions": [ - "https://stac-extensions.github.io/eo/v1.0.0/schema.json", - "https://stac-extensions.github.io/projection/v1.0.0/schema.json", - "https://stac-extensions.github.io/grid/v1.0.0/schema.json" - ] -} \ No newline at end of file From 0652aec3db8d857953cf4ec7fef16b11aa796fe8 Mon Sep 17 00:00:00 2001 From: Phil Varner Date: Wed, 13 Apr 2022 11:13:40 -0400 Subject: [PATCH 06/10] remove file --- m_3707763_se_18_060_20180825.txt | 317 ------------------------------- 1 file changed, 317 deletions(-) delete mode 100644 m_3707763_se_18_060_20180825.txt diff --git a/m_3707763_se_18_060_20180825.txt b/m_3707763_se_18_060_20180825.txt deleted file mode 100644 index c14ef9c..0000000 --- a/m_3707763_se_18_060_20180825.txt +++ /dev/null @@ -1,317 +0,0 @@ -Metadata: - Identification_Information: - Citation: - Citation_Information: - Originator: USDA-FPAC-BC-APFO Aerial Photography Field Office - Publication_Date: 20191105 - Title: NAIP Digital Georectified Image - Geospatial_Data_Presentation_Form: remote-sensing image - Publication_Information: - Publication_Place: Salt Lake City, Utah - Publisher: USDA-FPAC-BC-APFO Aerial Photography Field Office - Description: - Abstract: - This data set contains imagery from the National Agriculture - Imagery Program (NAIP). The NAIP program is administered by - USDA FSA and has been established to support two main FSA - strategic goals centered on agricultural production. - These are, increase stewardship of America's natural resources - while enhancing the environment, and to ensure commodities - are procured and distributed effectively and efficiently to - increase food security. The NAIP program supports these goals by - acquiring and providing ortho imagery that has been collected - during the agricultural growing season in the U.S. The NAIP - ortho imagery is tailored to meet FSA requirements and is a - fundamental tool used to support FSA farm and conservation - programs. Ortho imagery provides an effective, intuitive - means of communication about farm program administration - between FSA and stakeholders. - New technology and innovation is identified by fostering and - maintaining a relationship with vendors and government - partners, and by keeping pace with the broader geospatial - community. As a result of these efforts the NAIP program - provides three main products: DOQQ tiles, - Compressed County Mosaics (CCM), and Seamline shape files - The Contract specifications for NAIP imagery have changed - over time reflecting agency requirements and improving - technologies. These changes include image resolution, - horizontal accuracy, coverage area, and number of bands. - In general, flying seasons are established by FSA and are - targeted for peak crop growing conditions. The NAIP - acquisition cycle is based on a minimum 3 year refresh of base - ortho imagery. The tiling format of the NAIP imagery is based - on a 3.75' x 3.75' quarter quadrangle with a 300 pixel buffer - on all four sides. NAIP quarter quads are formatted to the UTM - coordinate system using the North American Datum of 1983. - NAIP imagery may contain as much as 10% cloud cover per tile. - Purpose: - NAIP imagery is available for distribution within 60 days - of the end of a flying season and is intended to provide current - information of agricultural conditions in support of USDA farm - programs. For USDA Farm Service Agency, the 1 meter and 1/2 meter - GSD product provides an ortho image base for Common Land Unit - boundaries and other data sets. The 100, 50, and 30 centimeter NAIP - imagery is generally acquired in projects covering full states in - cooperation with state government and other federal agencies that - use the imagery for a variety of purposes including land use - planning and natural resource assessment. The NAIP is also used - for disaster response. While suitable for a variety of uses, - prior to 2007 the 2 meter GSD NAIP imagery was primarily intended - to assess "crop condition and compliance" to USDA farm program - conditions. The 2 meter imagery was generally acquired only - for agricultural areas within state projects. - Time_Period_of_Content: - Time_Period_Information: - Single_Date/Time: - Calendar_Date: 20180825 - Currentness_Reference: Ground Condition - Status: - Progress: Complete - Maintenance_and_Update_Frequency: Irregular - Spatial_Domain: - Bounding_Coordinates: - West_Bounding_Coordinate: -77.1875 - East_Bounding_Coordinate: -77.1250 - North_Bounding_Coordinate: 37.0625 - South_Bounding_Coordinate: 37.0000 - Keywords: - Theme: - Theme_Keyword_Thesaurus: None - Theme_Keyword: farming - Theme_Keyword: Digital Ortho rectified Image - Theme_Keyword: Ortho Rectification - Theme_Keyword: Quarter Quadrangle - Theme_Keyword: NAIP - Theme_Keyword: Aerial Compliance - Theme_Keyword: Compliance - Place: - Place_Keyword_Thesaurus: Geographic Names Information System - Place_Keyword: VA - Place_Keyword: Sussex - Place_Keyword: 51183 - Place_Keyword: VA183 - Place_Keyword: SUSSEX CO VA FSA - Place_Keyword: 3707763 - Place_Keyword: DISPUTANTA SOUTH, SE - Place_Keyword: DISPUTANTA SOUTH - Access_Constraints: There are no limitations for access. - Use_Constraints: - None. The USDA-FPAC-BC Aerial Photography Field office - asks to be credited in derived products. - Point_of_Contact: - Contact_Information: - Contact_Organization_Primary: - Contact_Organization: Aerial Photography Field Office (APFO) - Contact_Address: - Address_Type: mailing and physical address - Address: 125 S. State Street Suite 6416 - City: Salt Lake City - State_or_Province: Utah - Postal_Code: 84138 - Country: USA - Contact_Voice_Telephone: 801-844-2922 - Contact_Facsimile_Telephone: 801-956-3653 - Contact_Electronic_Mail_Address: apfo.sales@slc.usda.gov - Browse_Graphic: - Browse_Graphic_File_Name: None - Browse_Graphic_File_Description: None - Browse_Graphic_File_Type: None - Native_Data_Set_Environment: Unknown - Data_Quality_Information: - Logical_Consistency_Report: - NAIP 3.75 minute tile file names are based - on the USGS quadrangle naming convention. - Completeness_Report: None - Positional_Accuracy: - Horizontal_Positional_Accuracy: - Horizontal_Positional_Accuracy_Report: - NAIP horizontal accuracy specifications have evolved over - the life of the program. From 2003 to 2004 the - specifications were as follows: 1-meter GSD imagery was - to match within 3-meters, and 2-meter GSD to match within 10 - meters of reference imagery. For 2005 the 1-meter GSD - specification was changed to 5 meters matching the reference - imagery. In 2006 a pilot project was performed using true - ground specifications rather than reference imagery. All - states used the same specifications as 2005 except Utah, - which required a match of +/- 6 meters to true ground. - In 2007 all specifications were the same as 2006 except - Arizona used true ground specifications and all other states - used reference imagery. In 2008 and subsequent years - no 2-meter GSD imagery was acquired and all specifications - were the same as 2007 except approximately half of the - states acquired used true ground specifications and the - other half used reference imagery. The 2008 states that - used absolute ground control where; Indiana, Minnesota, - New Hampshire, North Carolina, Texas, Vermont, and Virginia. - From 2009 to present all NAIP imagery acquisitions used - the +/- 6 meters to ground specification. - Lineage: - Source_Information: - Source_Citation: - Citation_Information: - Originator: USDA-FSA-APFO Aerial Photography Field Office - Publication_Date: 20191105 - Title: DISPUTANTA SOUTH, SE - Geospatial_Data_Presentation_Form: remote-sensing image - Type_of_Source_Media: UnKnown - Source_Time_Period_of_Content: - Time_Period_Information: - Single_Date/Time: - Calendar_Date: 20180825 - Source_Currentness_Reference: - Aerial Photography Date for aerial photo source. - Source_Citation_Abbreviation: Georectifed Image - Source_Contribution: Digital Georectifed Image. - - Process_Step: - Process_Description: - DOQQ Production Process Description; USDA FSA APFO NAIP Program 2018; State: Virginia. - The imagery was collected using the following digital sensors: Leica ADS-100 (Serial Number - 10510), Leica ADS-100 (Serial Number 10515), Leica ADS-100 (Serial Number 10522), Leica - ADS-100 (Serial Number 10530), Leica ADS-100 (Serial Number 10552), with Flight and Sensor - Control Management System (FCMS) firmware: v4.54, Cameras are calibrated radiometrically - and geometrically by the manufacturer and are all certified by the USGS. Collection was - performed using a combination of the following twin-engine aircraft with turbines flying at - 16,457 ft above mean terrain. Plane types: C441, Tail numbers: N2NQ, N414EH, N440EH, - N441EH, N441FS, With these flying heights, there is a 30% sidelap, giving the collected data - nominal ground sampling distance of 0.40 meters at 16,457 feet. Based-upon the CCD Array - configuration present in the ADS digital sensor, imagery for each flight line is 20,000-pixels in - width. Red, Green, Blue, Near-Infrared and Panchromatic image bands were collected. The - ADS 100 has the following band specifications: Red 619-651, Green 525-585, Blue 435-495, - Near Infrared 808-882, all values are in nanometers. Collected data was downloaded to - portable hard drives and shipped to the processing facility daily. Raw flight data was extracted - from external data drives using XPro software. Airborne GPS / IMU data was post-processed - using Inertial Explorer software and reviewed to ensure sufficient accuracy for project - requirements. Using Xpro software, planar rectified images were generated from the - collected data for use in image quality review. The planar rectified images were generated at - native resolution using a two standard deviation histogram stretch. Factors considered during - this review included but were not limited to the presence of smoke and/or cloud cover, - contrails, light conditions, sun glint and any sensor or hardware-related issues that potentially - could result in faulty data. When necessary, image strips identified as not meeting image - quality specifications were re-flown to obtain suitable imagery. Aero triangulation blocks - were defined primarily by order of acquisition and consisted of four to seventeen strips. - Image tie points providing the observations for the least squares bundle adjustment were - selected from the images using an auto correlation algorithm. Photogrammetric control - points consisted of photo identifiable control points, collected using GPS field survey - techniques. The control points were loaded into a softcopy workstation and measured in the - acquired image strips. A least squares bundle adjustment of image pass points, control points - and the ABGPS was performed to develop an aero triangulation solution for each block using - XPro software. Upon final bundle adjustment, the triangulated strips were ortho-rectified to - the digital elevation model (DEM). The most recent USGS 10-meter DEMs were used in the - rectification process. Positional accuracy was reviewed in the rectified imagery by visually - verifying the horizontal positioning of the known photo-identifiable survey locations using - ArcGIS software. The red, green, blue, and infrared bands were combined to generate a final - ortho-rectified image strip. The ADS sensor collects fourteen bit image data which requires - radiometric adjustment for output in standard eight bit image channels. The ortho-rectified - image strips were produced with the full 16 bit data range, allowing radiometric adjustment - to the 8 bit range to be performed on a strip by strip basis during the final mosaicking steps. - The 16 bit data range was adjusted for display in standard eight bit image channels by - defining a piecewise histogram stretch using OrthoVista Radiometrix software. A constant - stretch was defined for each image collection period, and then strip by strip adjustments - were made as needed to account for changes in sun angle and azimuth during the collection - period. Strip adjustments were also made to match the strips histograms as closely as - possible to APFO specified histogram metrics and color balance requirements. Automated - balancing algorithms were applied to account for bi-directional reflectance as a final step - before the conversion to 8 bit data range. The imagery was mosaicked using manual seam - line generation in OrthoVista - Process_Date: 20191105 - Spatial_Data_Organization_Information: - Indirect_Spatial_Reference: Sussex County, VA - Direct_Spatial_Reference_Method: Raster - Raster_Object_Information: - Raster_Object_Type: Pixel - Row_Count: 1 - Column_Count: 1 - Spatial_Reference_Information: - Horizontal_Coordinate_System_Definition: - Planar: - Grid_Coordinate_System: - Grid_Coordinate_System_Name: Universal Transverse Mercator - Universal_Transverse_Mercator: - UTM_Zone_Number: 18 - Transverse_Mercator: - Scale_Factor_at_Central_Meridian: 0.9996 - Longitude_of_Central_Meridian: -75.0 - Latitude_of_Projection_Origin: 0.0 - False_Easting: 500000 - False_Northing: 0.0 - Planar_Coordinate_Information: - Planar_Coordinate_Encoding_Method: row and column - Coordinate_Representation: - Abscissa_Resolution: .6 - Ordinate_Resolution: .6 - Planar_Distance_Units: meters - Geodetic_Model: - Horizontal_Datum_Name: North American Datum of 1983 - Ellipsoid_Name: Geodetic Reference System 80 (GRS 80) - Semi-major_Axis: 6378137 - Denominator_of_Flattening_Ratio: 298.257 - Entity_and_Attribute_Information: - Overview_Description: - Entity_and_Attribute_Overview: - 32-bit pixels, 4 band color(RGBIR) values 0 - 255 - Entity_and_Attribute_Detail_Citation: None - Distribution_Information: - Distributor: - Contact_Information: - Contact_Person_Primary: - Contact_Person: Supervisor Customer Services Section - Contact_Organization: - USDA-FPAC-BC-APFO Aerial Photography Field Office - Contact_Address: - Address_Type: mailing and physical address - Address: 125 S. State Street Suite 6416 - City: Salt Lake City - State_or_Province: Utah - Postal_Code: 84138 - Country: USA - Contact_Voice_Telephone: 801-844-2922 - Contact_Facsimile_Telephone: 801-956-3653 - Contact_Electronic_Mail_Address: apfo.sales@slc.usda.gov - Distribution_Liability: - In no event shall the creators, custodians, or distributors - of this information be liable for any damages arising out - of its use (or the inability to use it). - Standard_Order_Process: - Digital_Form: - Digital_Transfer_Information: - Format_Name: GeoTIFF - Georeferenced Tagged Image File Format - Format_Information_Content: Multispectral 4-band - Digital_Transfer_Option: - Offline_Option: - Offline_Media: CD-ROM - Recording_Format: ISO 9660 Mode 1 Level 2 Extensions - Offline_Option: - Offline_Media: DVD-R - Recording_Format: ISO 9660 - Offline_Option: - Offline_Media: USB Hard Disk - Recording_Format: NTFS - Offline_Option:^M - Offline_Media: USB Flash Thumb Drive^M - Recording_Format: NTFS^M - Fees: - Contact the Aerial Photography Field Office - for more information - Resource_Description: - m_3707763_se_18_060_20180825_20190211.tif - Metadata_Reference_Information: - Metadata_Date: 20191105 - Metadata_Contact: - Contact_Information: - Contact_Organization_Primary: - Contact_Organization: - USDA-FPAC-BC-APFO Aerial Photography Field Office - Contact_Address: - Address_Type: mailing and physical address - Address: 125 S. State Street Suite 6416 - City: Salt Lake City - State_or_Province: Utah - Postal_Code: 84138 - Country: USA - Contact_Voice_Telephone: 801-844-2922 - Metadata_Standard_Name: - Content Standard for Digital Geospatial Metadata - Metadata_Standard_Version: FGDC-STD-001-1998 - From bea65e8c4d0b9ad0e3eca8057637a2d7866330ad Mon Sep 17 00:00:00 2001 From: Phil Varner Date: Wed, 13 Apr 2022 13:36:22 -0400 Subject: [PATCH 07/10] remove 3.7 from matrix --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index c56087f..96969e2 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9"] # 3.10 fails with proj_identify error + python-version: ["3.8", "3.9"] # 3.10 fails with proj_identify error defaults: run: shell: bash -l {0} From a381d4189573bb254dbd44c75c4a6719da9e2691 Mon Sep 17 00:00:00 2001 From: Phil Varner Date: Wed, 13 Apr 2022 13:45:48 -0400 Subject: [PATCH 08/10] remove 3.7 from matrix --- ...m_3707763_se_18_060_20180825_20190211.json | 126 +++++++ m_3707763_se_18_060_20180825.txt | 317 ++++++++++++++++++ setup.cfg | 2 +- 3 files changed, 444 insertions(+), 1 deletion(-) create mode 100644 json-dest/VA_m_3707763_se_18_060_20180825_20190211.json create mode 100644 m_3707763_se_18_060_20180825.txt diff --git a/json-dest/VA_m_3707763_se_18_060_20180825_20190211.json b/json-dest/VA_m_3707763_se_18_060_20180825_20190211.json new file mode 100644 index 0000000..5b43efa --- /dev/null +++ b/json-dest/VA_m_3707763_se_18_060_20180825_20190211.json @@ -0,0 +1,126 @@ +{ + "type": "Feature", + "stac_version": "1.0.0", + "id": "VA_m_3707763_se_18_060_20180825_20190211", + "properties": { + "naip:state": "VA", + "naip:year": "2018", + "providers": [ + { + "name": "USDA Farm Service Agency", + "roles": [ + "producer", + "licensor" + ], + "url": "https://www.fsa.usda.gov/programs-and-services/aerial-photography/imagery-programs/naip-imagery/" + } + ], + "gsd": 0.5999999999999955, + "proj:epsg": 26918, + "proj:shape": [ + 12859, + 10457 + ], + "proj:bbox": [ + 305096.4, + 4096683.0, + 311370.6, + 4104398.4 + ], + "proj:transform": [ + 0.5999999999999955, + 0.0, + 305096.4, + 0.0, + -0.5999999999999928, + 4104398.4, + 0.0, + 0.0, + 1.0 + ], + "grid:code": "DOQQ-3707763SE", + "datetime": "2018-08-25T12:00:00Z" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -77.119789, + 36.997386 + ], + [ + -77.121722, + 37.066888 + ], + [ + -77.192249, + 37.065605 + ], + [ + -77.190251, + 36.996106 + ], + [ + -77.119789, + 36.997386 + ] + ] + ] + }, + "links": [ + { + "rel": "self", + "href": "/Users/philvarner/code/naip/json-dest/VA_m_3707763_se_18_060_20180825_20190211.json", + "type": "application/json" + } + ], + "assets": { + "image": { + "href": "s3://naip-analytic/va/2018/60cm/rgbir_cog/37077/m_3707763_se_18_060_20180825.tif", + "type": "image/tiff; application=geotiff; profile=cloud-optimized", + "title": "RGBIR COG tile", + "eo:bands": [ + { + "name": "Red", + "common_name": "red" + }, + { + "name": "Green", + "common_name": "green" + }, + { + "name": "Blue", + "common_name": "blue" + }, + { + "name": "NIR", + "common_name": "nir", + "description": "near-infrared" + } + ], + "roles": [ + "data" + ] + }, + "metadata": { + "href": "m_3707763_se_18_060_20180825.txt", + "type": "text/plain", + "title": "FGDC Metadata", + "roles": [ + "metadata" + ] + } + }, + "bbox": [ + -77.192249, + 36.996106, + -77.119789, + 37.066888 + ], + "stac_extensions": [ + "https://stac-extensions.github.io/eo/v1.0.0/schema.json", + "https://stac-extensions.github.io/projection/v1.0.0/schema.json", + "https://stac-extensions.github.io/grid/v1.0.0/schema.json" + ] +} \ No newline at end of file diff --git a/m_3707763_se_18_060_20180825.txt b/m_3707763_se_18_060_20180825.txt new file mode 100644 index 0000000..c14ef9c --- /dev/null +++ b/m_3707763_se_18_060_20180825.txt @@ -0,0 +1,317 @@ +Metadata: + Identification_Information: + Citation: + Citation_Information: + Originator: USDA-FPAC-BC-APFO Aerial Photography Field Office + Publication_Date: 20191105 + Title: NAIP Digital Georectified Image + Geospatial_Data_Presentation_Form: remote-sensing image + Publication_Information: + Publication_Place: Salt Lake City, Utah + Publisher: USDA-FPAC-BC-APFO Aerial Photography Field Office + Description: + Abstract: + This data set contains imagery from the National Agriculture + Imagery Program (NAIP). The NAIP program is administered by + USDA FSA and has been established to support two main FSA + strategic goals centered on agricultural production. + These are, increase stewardship of America's natural resources + while enhancing the environment, and to ensure commodities + are procured and distributed effectively and efficiently to + increase food security. The NAIP program supports these goals by + acquiring and providing ortho imagery that has been collected + during the agricultural growing season in the U.S. The NAIP + ortho imagery is tailored to meet FSA requirements and is a + fundamental tool used to support FSA farm and conservation + programs. Ortho imagery provides an effective, intuitive + means of communication about farm program administration + between FSA and stakeholders. + New technology and innovation is identified by fostering and + maintaining a relationship with vendors and government + partners, and by keeping pace with the broader geospatial + community. As a result of these efforts the NAIP program + provides three main products: DOQQ tiles, + Compressed County Mosaics (CCM), and Seamline shape files + The Contract specifications for NAIP imagery have changed + over time reflecting agency requirements and improving + technologies. These changes include image resolution, + horizontal accuracy, coverage area, and number of bands. + In general, flying seasons are established by FSA and are + targeted for peak crop growing conditions. The NAIP + acquisition cycle is based on a minimum 3 year refresh of base + ortho imagery. The tiling format of the NAIP imagery is based + on a 3.75' x 3.75' quarter quadrangle with a 300 pixel buffer + on all four sides. NAIP quarter quads are formatted to the UTM + coordinate system using the North American Datum of 1983. + NAIP imagery may contain as much as 10% cloud cover per tile. + Purpose: + NAIP imagery is available for distribution within 60 days + of the end of a flying season and is intended to provide current + information of agricultural conditions in support of USDA farm + programs. For USDA Farm Service Agency, the 1 meter and 1/2 meter + GSD product provides an ortho image base for Common Land Unit + boundaries and other data sets. The 100, 50, and 30 centimeter NAIP + imagery is generally acquired in projects covering full states in + cooperation with state government and other federal agencies that + use the imagery for a variety of purposes including land use + planning and natural resource assessment. The NAIP is also used + for disaster response. While suitable for a variety of uses, + prior to 2007 the 2 meter GSD NAIP imagery was primarily intended + to assess "crop condition and compliance" to USDA farm program + conditions. The 2 meter imagery was generally acquired only + for agricultural areas within state projects. + Time_Period_of_Content: + Time_Period_Information: + Single_Date/Time: + Calendar_Date: 20180825 + Currentness_Reference: Ground Condition + Status: + Progress: Complete + Maintenance_and_Update_Frequency: Irregular + Spatial_Domain: + Bounding_Coordinates: + West_Bounding_Coordinate: -77.1875 + East_Bounding_Coordinate: -77.1250 + North_Bounding_Coordinate: 37.0625 + South_Bounding_Coordinate: 37.0000 + Keywords: + Theme: + Theme_Keyword_Thesaurus: None + Theme_Keyword: farming + Theme_Keyword: Digital Ortho rectified Image + Theme_Keyword: Ortho Rectification + Theme_Keyword: Quarter Quadrangle + Theme_Keyword: NAIP + Theme_Keyword: Aerial Compliance + Theme_Keyword: Compliance + Place: + Place_Keyword_Thesaurus: Geographic Names Information System + Place_Keyword: VA + Place_Keyword: Sussex + Place_Keyword: 51183 + Place_Keyword: VA183 + Place_Keyword: SUSSEX CO VA FSA + Place_Keyword: 3707763 + Place_Keyword: DISPUTANTA SOUTH, SE + Place_Keyword: DISPUTANTA SOUTH + Access_Constraints: There are no limitations for access. + Use_Constraints: + None. The USDA-FPAC-BC Aerial Photography Field office + asks to be credited in derived products. + Point_of_Contact: + Contact_Information: + Contact_Organization_Primary: + Contact_Organization: Aerial Photography Field Office (APFO) + Contact_Address: + Address_Type: mailing and physical address + Address: 125 S. State Street Suite 6416 + City: Salt Lake City + State_or_Province: Utah + Postal_Code: 84138 + Country: USA + Contact_Voice_Telephone: 801-844-2922 + Contact_Facsimile_Telephone: 801-956-3653 + Contact_Electronic_Mail_Address: apfo.sales@slc.usda.gov + Browse_Graphic: + Browse_Graphic_File_Name: None + Browse_Graphic_File_Description: None + Browse_Graphic_File_Type: None + Native_Data_Set_Environment: Unknown + Data_Quality_Information: + Logical_Consistency_Report: + NAIP 3.75 minute tile file names are based + on the USGS quadrangle naming convention. + Completeness_Report: None + Positional_Accuracy: + Horizontal_Positional_Accuracy: + Horizontal_Positional_Accuracy_Report: + NAIP horizontal accuracy specifications have evolved over + the life of the program. From 2003 to 2004 the + specifications were as follows: 1-meter GSD imagery was + to match within 3-meters, and 2-meter GSD to match within 10 + meters of reference imagery. For 2005 the 1-meter GSD + specification was changed to 5 meters matching the reference + imagery. In 2006 a pilot project was performed using true + ground specifications rather than reference imagery. All + states used the same specifications as 2005 except Utah, + which required a match of +/- 6 meters to true ground. + In 2007 all specifications were the same as 2006 except + Arizona used true ground specifications and all other states + used reference imagery. In 2008 and subsequent years + no 2-meter GSD imagery was acquired and all specifications + were the same as 2007 except approximately half of the + states acquired used true ground specifications and the + other half used reference imagery. The 2008 states that + used absolute ground control where; Indiana, Minnesota, + New Hampshire, North Carolina, Texas, Vermont, and Virginia. + From 2009 to present all NAIP imagery acquisitions used + the +/- 6 meters to ground specification. + Lineage: + Source_Information: + Source_Citation: + Citation_Information: + Originator: USDA-FSA-APFO Aerial Photography Field Office + Publication_Date: 20191105 + Title: DISPUTANTA SOUTH, SE + Geospatial_Data_Presentation_Form: remote-sensing image + Type_of_Source_Media: UnKnown + Source_Time_Period_of_Content: + Time_Period_Information: + Single_Date/Time: + Calendar_Date: 20180825 + Source_Currentness_Reference: + Aerial Photography Date for aerial photo source. + Source_Citation_Abbreviation: Georectifed Image + Source_Contribution: Digital Georectifed Image. + + Process_Step: + Process_Description: + DOQQ Production Process Description; USDA FSA APFO NAIP Program 2018; State: Virginia. + The imagery was collected using the following digital sensors: Leica ADS-100 (Serial Number + 10510), Leica ADS-100 (Serial Number 10515), Leica ADS-100 (Serial Number 10522), Leica + ADS-100 (Serial Number 10530), Leica ADS-100 (Serial Number 10552), with Flight and Sensor + Control Management System (FCMS) firmware: v4.54, Cameras are calibrated radiometrically + and geometrically by the manufacturer and are all certified by the USGS. Collection was + performed using a combination of the following twin-engine aircraft with turbines flying at + 16,457 ft above mean terrain. Plane types: C441, Tail numbers: N2NQ, N414EH, N440EH, + N441EH, N441FS, With these flying heights, there is a 30% sidelap, giving the collected data + nominal ground sampling distance of 0.40 meters at 16,457 feet. Based-upon the CCD Array + configuration present in the ADS digital sensor, imagery for each flight line is 20,000-pixels in + width. Red, Green, Blue, Near-Infrared and Panchromatic image bands were collected. The + ADS 100 has the following band specifications: Red 619-651, Green 525-585, Blue 435-495, + Near Infrared 808-882, all values are in nanometers. Collected data was downloaded to + portable hard drives and shipped to the processing facility daily. Raw flight data was extracted + from external data drives using XPro software. Airborne GPS / IMU data was post-processed + using Inertial Explorer software and reviewed to ensure sufficient accuracy for project + requirements. Using Xpro software, planar rectified images were generated from the + collected data for use in image quality review. The planar rectified images were generated at + native resolution using a two standard deviation histogram stretch. Factors considered during + this review included but were not limited to the presence of smoke and/or cloud cover, + contrails, light conditions, sun glint and any sensor or hardware-related issues that potentially + could result in faulty data. When necessary, image strips identified as not meeting image + quality specifications were re-flown to obtain suitable imagery. Aero triangulation blocks + were defined primarily by order of acquisition and consisted of four to seventeen strips. + Image tie points providing the observations for the least squares bundle adjustment were + selected from the images using an auto correlation algorithm. Photogrammetric control + points consisted of photo identifiable control points, collected using GPS field survey + techniques. The control points were loaded into a softcopy workstation and measured in the + acquired image strips. A least squares bundle adjustment of image pass points, control points + and the ABGPS was performed to develop an aero triangulation solution for each block using + XPro software. Upon final bundle adjustment, the triangulated strips were ortho-rectified to + the digital elevation model (DEM). The most recent USGS 10-meter DEMs were used in the + rectification process. Positional accuracy was reviewed in the rectified imagery by visually + verifying the horizontal positioning of the known photo-identifiable survey locations using + ArcGIS software. The red, green, blue, and infrared bands were combined to generate a final + ortho-rectified image strip. The ADS sensor collects fourteen bit image data which requires + radiometric adjustment for output in standard eight bit image channels. The ortho-rectified + image strips were produced with the full 16 bit data range, allowing radiometric adjustment + to the 8 bit range to be performed on a strip by strip basis during the final mosaicking steps. + The 16 bit data range was adjusted for display in standard eight bit image channels by + defining a piecewise histogram stretch using OrthoVista Radiometrix software. A constant + stretch was defined for each image collection period, and then strip by strip adjustments + were made as needed to account for changes in sun angle and azimuth during the collection + period. Strip adjustments were also made to match the strips histograms as closely as + possible to APFO specified histogram metrics and color balance requirements. Automated + balancing algorithms were applied to account for bi-directional reflectance as a final step + before the conversion to 8 bit data range. The imagery was mosaicked using manual seam + line generation in OrthoVista + Process_Date: 20191105 + Spatial_Data_Organization_Information: + Indirect_Spatial_Reference: Sussex County, VA + Direct_Spatial_Reference_Method: Raster + Raster_Object_Information: + Raster_Object_Type: Pixel + Row_Count: 1 + Column_Count: 1 + Spatial_Reference_Information: + Horizontal_Coordinate_System_Definition: + Planar: + Grid_Coordinate_System: + Grid_Coordinate_System_Name: Universal Transverse Mercator + Universal_Transverse_Mercator: + UTM_Zone_Number: 18 + Transverse_Mercator: + Scale_Factor_at_Central_Meridian: 0.9996 + Longitude_of_Central_Meridian: -75.0 + Latitude_of_Projection_Origin: 0.0 + False_Easting: 500000 + False_Northing: 0.0 + Planar_Coordinate_Information: + Planar_Coordinate_Encoding_Method: row and column + Coordinate_Representation: + Abscissa_Resolution: .6 + Ordinate_Resolution: .6 + Planar_Distance_Units: meters + Geodetic_Model: + Horizontal_Datum_Name: North American Datum of 1983 + Ellipsoid_Name: Geodetic Reference System 80 (GRS 80) + Semi-major_Axis: 6378137 + Denominator_of_Flattening_Ratio: 298.257 + Entity_and_Attribute_Information: + Overview_Description: + Entity_and_Attribute_Overview: + 32-bit pixels, 4 band color(RGBIR) values 0 - 255 + Entity_and_Attribute_Detail_Citation: None + Distribution_Information: + Distributor: + Contact_Information: + Contact_Person_Primary: + Contact_Person: Supervisor Customer Services Section + Contact_Organization: + USDA-FPAC-BC-APFO Aerial Photography Field Office + Contact_Address: + Address_Type: mailing and physical address + Address: 125 S. State Street Suite 6416 + City: Salt Lake City + State_or_Province: Utah + Postal_Code: 84138 + Country: USA + Contact_Voice_Telephone: 801-844-2922 + Contact_Facsimile_Telephone: 801-956-3653 + Contact_Electronic_Mail_Address: apfo.sales@slc.usda.gov + Distribution_Liability: + In no event shall the creators, custodians, or distributors + of this information be liable for any damages arising out + of its use (or the inability to use it). + Standard_Order_Process: + Digital_Form: + Digital_Transfer_Information: + Format_Name: GeoTIFF - Georeferenced Tagged Image File Format + Format_Information_Content: Multispectral 4-band + Digital_Transfer_Option: + Offline_Option: + Offline_Media: CD-ROM + Recording_Format: ISO 9660 Mode 1 Level 2 Extensions + Offline_Option: + Offline_Media: DVD-R + Recording_Format: ISO 9660 + Offline_Option: + Offline_Media: USB Hard Disk + Recording_Format: NTFS + Offline_Option:^M + Offline_Media: USB Flash Thumb Drive^M + Recording_Format: NTFS^M + Fees: + Contact the Aerial Photography Field Office + for more information + Resource_Description: + m_3707763_se_18_060_20180825_20190211.tif + Metadata_Reference_Information: + Metadata_Date: 20191105 + Metadata_Contact: + Contact_Information: + Contact_Organization_Primary: + Contact_Organization: + USDA-FPAC-BC-APFO Aerial Photography Field Office + Contact_Address: + Address_Type: mailing and physical address + Address: 125 S. State Street Suite 6416 + City: Salt Lake City + State_or_Province: Utah + Postal_Code: 84138 + Country: USA + Contact_Voice_Telephone: 801-844-2922 + Metadata_Standard_Name: + Content Standard for Digital Geospatial Metadata + Metadata_Standard_Version: FGDC-STD-001-1998 + diff --git a/setup.cfg b/setup.cfg index 1771fa9..480a5e9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -22,7 +22,7 @@ classifiers = Programming Language :: Python :: 3.9 [options] -python_requires = ">=3.6, <=3.9" +python_requires = >=3.8,<=3.9 package_dir = =src packages = find_namespace: From bc0e3b77edb4b93010df464907e4a6ff6f3f24d2 Mon Sep 17 00:00:00 2001 From: Phil Varner Date: Wed, 13 Apr 2022 13:46:20 -0400 Subject: [PATCH 09/10] remove files --- ...m_3707763_se_18_060_20180825_20190211.json | 126 ------- m_3707763_se_18_060_20180825.txt | 317 ------------------ 2 files changed, 443 deletions(-) delete mode 100644 json-dest/VA_m_3707763_se_18_060_20180825_20190211.json delete mode 100644 m_3707763_se_18_060_20180825.txt diff --git a/json-dest/VA_m_3707763_se_18_060_20180825_20190211.json b/json-dest/VA_m_3707763_se_18_060_20180825_20190211.json deleted file mode 100644 index 5b43efa..0000000 --- a/json-dest/VA_m_3707763_se_18_060_20180825_20190211.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "type": "Feature", - "stac_version": "1.0.0", - "id": "VA_m_3707763_se_18_060_20180825_20190211", - "properties": { - "naip:state": "VA", - "naip:year": "2018", - "providers": [ - { - "name": "USDA Farm Service Agency", - "roles": [ - "producer", - "licensor" - ], - "url": "https://www.fsa.usda.gov/programs-and-services/aerial-photography/imagery-programs/naip-imagery/" - } - ], - "gsd": 0.5999999999999955, - "proj:epsg": 26918, - "proj:shape": [ - 12859, - 10457 - ], - "proj:bbox": [ - 305096.4, - 4096683.0, - 311370.6, - 4104398.4 - ], - "proj:transform": [ - 0.5999999999999955, - 0.0, - 305096.4, - 0.0, - -0.5999999999999928, - 4104398.4, - 0.0, - 0.0, - 1.0 - ], - "grid:code": "DOQQ-3707763SE", - "datetime": "2018-08-25T12:00:00Z" - }, - "geometry": { - "type": "Polygon", - "coordinates": [ - [ - [ - -77.119789, - 36.997386 - ], - [ - -77.121722, - 37.066888 - ], - [ - -77.192249, - 37.065605 - ], - [ - -77.190251, - 36.996106 - ], - [ - -77.119789, - 36.997386 - ] - ] - ] - }, - "links": [ - { - "rel": "self", - "href": "/Users/philvarner/code/naip/json-dest/VA_m_3707763_se_18_060_20180825_20190211.json", - "type": "application/json" - } - ], - "assets": { - "image": { - "href": "s3://naip-analytic/va/2018/60cm/rgbir_cog/37077/m_3707763_se_18_060_20180825.tif", - "type": "image/tiff; application=geotiff; profile=cloud-optimized", - "title": "RGBIR COG tile", - "eo:bands": [ - { - "name": "Red", - "common_name": "red" - }, - { - "name": "Green", - "common_name": "green" - }, - { - "name": "Blue", - "common_name": "blue" - }, - { - "name": "NIR", - "common_name": "nir", - "description": "near-infrared" - } - ], - "roles": [ - "data" - ] - }, - "metadata": { - "href": "m_3707763_se_18_060_20180825.txt", - "type": "text/plain", - "title": "FGDC Metadata", - "roles": [ - "metadata" - ] - } - }, - "bbox": [ - -77.192249, - 36.996106, - -77.119789, - 37.066888 - ], - "stac_extensions": [ - "https://stac-extensions.github.io/eo/v1.0.0/schema.json", - "https://stac-extensions.github.io/projection/v1.0.0/schema.json", - "https://stac-extensions.github.io/grid/v1.0.0/schema.json" - ] -} \ No newline at end of file diff --git a/m_3707763_se_18_060_20180825.txt b/m_3707763_se_18_060_20180825.txt deleted file mode 100644 index c14ef9c..0000000 --- a/m_3707763_se_18_060_20180825.txt +++ /dev/null @@ -1,317 +0,0 @@ -Metadata: - Identification_Information: - Citation: - Citation_Information: - Originator: USDA-FPAC-BC-APFO Aerial Photography Field Office - Publication_Date: 20191105 - Title: NAIP Digital Georectified Image - Geospatial_Data_Presentation_Form: remote-sensing image - Publication_Information: - Publication_Place: Salt Lake City, Utah - Publisher: USDA-FPAC-BC-APFO Aerial Photography Field Office - Description: - Abstract: - This data set contains imagery from the National Agriculture - Imagery Program (NAIP). The NAIP program is administered by - USDA FSA and has been established to support two main FSA - strategic goals centered on agricultural production. - These are, increase stewardship of America's natural resources - while enhancing the environment, and to ensure commodities - are procured and distributed effectively and efficiently to - increase food security. The NAIP program supports these goals by - acquiring and providing ortho imagery that has been collected - during the agricultural growing season in the U.S. The NAIP - ortho imagery is tailored to meet FSA requirements and is a - fundamental tool used to support FSA farm and conservation - programs. Ortho imagery provides an effective, intuitive - means of communication about farm program administration - between FSA and stakeholders. - New technology and innovation is identified by fostering and - maintaining a relationship with vendors and government - partners, and by keeping pace with the broader geospatial - community. As a result of these efforts the NAIP program - provides three main products: DOQQ tiles, - Compressed County Mosaics (CCM), and Seamline shape files - The Contract specifications for NAIP imagery have changed - over time reflecting agency requirements and improving - technologies. These changes include image resolution, - horizontal accuracy, coverage area, and number of bands. - In general, flying seasons are established by FSA and are - targeted for peak crop growing conditions. The NAIP - acquisition cycle is based on a minimum 3 year refresh of base - ortho imagery. The tiling format of the NAIP imagery is based - on a 3.75' x 3.75' quarter quadrangle with a 300 pixel buffer - on all four sides. NAIP quarter quads are formatted to the UTM - coordinate system using the North American Datum of 1983. - NAIP imagery may contain as much as 10% cloud cover per tile. - Purpose: - NAIP imagery is available for distribution within 60 days - of the end of a flying season and is intended to provide current - information of agricultural conditions in support of USDA farm - programs. For USDA Farm Service Agency, the 1 meter and 1/2 meter - GSD product provides an ortho image base for Common Land Unit - boundaries and other data sets. The 100, 50, and 30 centimeter NAIP - imagery is generally acquired in projects covering full states in - cooperation with state government and other federal agencies that - use the imagery for a variety of purposes including land use - planning and natural resource assessment. The NAIP is also used - for disaster response. While suitable for a variety of uses, - prior to 2007 the 2 meter GSD NAIP imagery was primarily intended - to assess "crop condition and compliance" to USDA farm program - conditions. The 2 meter imagery was generally acquired only - for agricultural areas within state projects. - Time_Period_of_Content: - Time_Period_Information: - Single_Date/Time: - Calendar_Date: 20180825 - Currentness_Reference: Ground Condition - Status: - Progress: Complete - Maintenance_and_Update_Frequency: Irregular - Spatial_Domain: - Bounding_Coordinates: - West_Bounding_Coordinate: -77.1875 - East_Bounding_Coordinate: -77.1250 - North_Bounding_Coordinate: 37.0625 - South_Bounding_Coordinate: 37.0000 - Keywords: - Theme: - Theme_Keyword_Thesaurus: None - Theme_Keyword: farming - Theme_Keyword: Digital Ortho rectified Image - Theme_Keyword: Ortho Rectification - Theme_Keyword: Quarter Quadrangle - Theme_Keyword: NAIP - Theme_Keyword: Aerial Compliance - Theme_Keyword: Compliance - Place: - Place_Keyword_Thesaurus: Geographic Names Information System - Place_Keyword: VA - Place_Keyword: Sussex - Place_Keyword: 51183 - Place_Keyword: VA183 - Place_Keyword: SUSSEX CO VA FSA - Place_Keyword: 3707763 - Place_Keyword: DISPUTANTA SOUTH, SE - Place_Keyword: DISPUTANTA SOUTH - Access_Constraints: There are no limitations for access. - Use_Constraints: - None. The USDA-FPAC-BC Aerial Photography Field office - asks to be credited in derived products. - Point_of_Contact: - Contact_Information: - Contact_Organization_Primary: - Contact_Organization: Aerial Photography Field Office (APFO) - Contact_Address: - Address_Type: mailing and physical address - Address: 125 S. State Street Suite 6416 - City: Salt Lake City - State_or_Province: Utah - Postal_Code: 84138 - Country: USA - Contact_Voice_Telephone: 801-844-2922 - Contact_Facsimile_Telephone: 801-956-3653 - Contact_Electronic_Mail_Address: apfo.sales@slc.usda.gov - Browse_Graphic: - Browse_Graphic_File_Name: None - Browse_Graphic_File_Description: None - Browse_Graphic_File_Type: None - Native_Data_Set_Environment: Unknown - Data_Quality_Information: - Logical_Consistency_Report: - NAIP 3.75 minute tile file names are based - on the USGS quadrangle naming convention. - Completeness_Report: None - Positional_Accuracy: - Horizontal_Positional_Accuracy: - Horizontal_Positional_Accuracy_Report: - NAIP horizontal accuracy specifications have evolved over - the life of the program. From 2003 to 2004 the - specifications were as follows: 1-meter GSD imagery was - to match within 3-meters, and 2-meter GSD to match within 10 - meters of reference imagery. For 2005 the 1-meter GSD - specification was changed to 5 meters matching the reference - imagery. In 2006 a pilot project was performed using true - ground specifications rather than reference imagery. All - states used the same specifications as 2005 except Utah, - which required a match of +/- 6 meters to true ground. - In 2007 all specifications were the same as 2006 except - Arizona used true ground specifications and all other states - used reference imagery. In 2008 and subsequent years - no 2-meter GSD imagery was acquired and all specifications - were the same as 2007 except approximately half of the - states acquired used true ground specifications and the - other half used reference imagery. The 2008 states that - used absolute ground control where; Indiana, Minnesota, - New Hampshire, North Carolina, Texas, Vermont, and Virginia. - From 2009 to present all NAIP imagery acquisitions used - the +/- 6 meters to ground specification. - Lineage: - Source_Information: - Source_Citation: - Citation_Information: - Originator: USDA-FSA-APFO Aerial Photography Field Office - Publication_Date: 20191105 - Title: DISPUTANTA SOUTH, SE - Geospatial_Data_Presentation_Form: remote-sensing image - Type_of_Source_Media: UnKnown - Source_Time_Period_of_Content: - Time_Period_Information: - Single_Date/Time: - Calendar_Date: 20180825 - Source_Currentness_Reference: - Aerial Photography Date for aerial photo source. - Source_Citation_Abbreviation: Georectifed Image - Source_Contribution: Digital Georectifed Image. - - Process_Step: - Process_Description: - DOQQ Production Process Description; USDA FSA APFO NAIP Program 2018; State: Virginia. - The imagery was collected using the following digital sensors: Leica ADS-100 (Serial Number - 10510), Leica ADS-100 (Serial Number 10515), Leica ADS-100 (Serial Number 10522), Leica - ADS-100 (Serial Number 10530), Leica ADS-100 (Serial Number 10552), with Flight and Sensor - Control Management System (FCMS) firmware: v4.54, Cameras are calibrated radiometrically - and geometrically by the manufacturer and are all certified by the USGS. Collection was - performed using a combination of the following twin-engine aircraft with turbines flying at - 16,457 ft above mean terrain. Plane types: C441, Tail numbers: N2NQ, N414EH, N440EH, - N441EH, N441FS, With these flying heights, there is a 30% sidelap, giving the collected data - nominal ground sampling distance of 0.40 meters at 16,457 feet. Based-upon the CCD Array - configuration present in the ADS digital sensor, imagery for each flight line is 20,000-pixels in - width. Red, Green, Blue, Near-Infrared and Panchromatic image bands were collected. The - ADS 100 has the following band specifications: Red 619-651, Green 525-585, Blue 435-495, - Near Infrared 808-882, all values are in nanometers. Collected data was downloaded to - portable hard drives and shipped to the processing facility daily. Raw flight data was extracted - from external data drives using XPro software. Airborne GPS / IMU data was post-processed - using Inertial Explorer software and reviewed to ensure sufficient accuracy for project - requirements. Using Xpro software, planar rectified images were generated from the - collected data for use in image quality review. The planar rectified images were generated at - native resolution using a two standard deviation histogram stretch. Factors considered during - this review included but were not limited to the presence of smoke and/or cloud cover, - contrails, light conditions, sun glint and any sensor or hardware-related issues that potentially - could result in faulty data. When necessary, image strips identified as not meeting image - quality specifications were re-flown to obtain suitable imagery. Aero triangulation blocks - were defined primarily by order of acquisition and consisted of four to seventeen strips. - Image tie points providing the observations for the least squares bundle adjustment were - selected from the images using an auto correlation algorithm. Photogrammetric control - points consisted of photo identifiable control points, collected using GPS field survey - techniques. The control points were loaded into a softcopy workstation and measured in the - acquired image strips. A least squares bundle adjustment of image pass points, control points - and the ABGPS was performed to develop an aero triangulation solution for each block using - XPro software. Upon final bundle adjustment, the triangulated strips were ortho-rectified to - the digital elevation model (DEM). The most recent USGS 10-meter DEMs were used in the - rectification process. Positional accuracy was reviewed in the rectified imagery by visually - verifying the horizontal positioning of the known photo-identifiable survey locations using - ArcGIS software. The red, green, blue, and infrared bands were combined to generate a final - ortho-rectified image strip. The ADS sensor collects fourteen bit image data which requires - radiometric adjustment for output in standard eight bit image channels. The ortho-rectified - image strips were produced with the full 16 bit data range, allowing radiometric adjustment - to the 8 bit range to be performed on a strip by strip basis during the final mosaicking steps. - The 16 bit data range was adjusted for display in standard eight bit image channels by - defining a piecewise histogram stretch using OrthoVista Radiometrix software. A constant - stretch was defined for each image collection period, and then strip by strip adjustments - were made as needed to account for changes in sun angle and azimuth during the collection - period. Strip adjustments were also made to match the strips histograms as closely as - possible to APFO specified histogram metrics and color balance requirements. Automated - balancing algorithms were applied to account for bi-directional reflectance as a final step - before the conversion to 8 bit data range. The imagery was mosaicked using manual seam - line generation in OrthoVista - Process_Date: 20191105 - Spatial_Data_Organization_Information: - Indirect_Spatial_Reference: Sussex County, VA - Direct_Spatial_Reference_Method: Raster - Raster_Object_Information: - Raster_Object_Type: Pixel - Row_Count: 1 - Column_Count: 1 - Spatial_Reference_Information: - Horizontal_Coordinate_System_Definition: - Planar: - Grid_Coordinate_System: - Grid_Coordinate_System_Name: Universal Transverse Mercator - Universal_Transverse_Mercator: - UTM_Zone_Number: 18 - Transverse_Mercator: - Scale_Factor_at_Central_Meridian: 0.9996 - Longitude_of_Central_Meridian: -75.0 - Latitude_of_Projection_Origin: 0.0 - False_Easting: 500000 - False_Northing: 0.0 - Planar_Coordinate_Information: - Planar_Coordinate_Encoding_Method: row and column - Coordinate_Representation: - Abscissa_Resolution: .6 - Ordinate_Resolution: .6 - Planar_Distance_Units: meters - Geodetic_Model: - Horizontal_Datum_Name: North American Datum of 1983 - Ellipsoid_Name: Geodetic Reference System 80 (GRS 80) - Semi-major_Axis: 6378137 - Denominator_of_Flattening_Ratio: 298.257 - Entity_and_Attribute_Information: - Overview_Description: - Entity_and_Attribute_Overview: - 32-bit pixels, 4 band color(RGBIR) values 0 - 255 - Entity_and_Attribute_Detail_Citation: None - Distribution_Information: - Distributor: - Contact_Information: - Contact_Person_Primary: - Contact_Person: Supervisor Customer Services Section - Contact_Organization: - USDA-FPAC-BC-APFO Aerial Photography Field Office - Contact_Address: - Address_Type: mailing and physical address - Address: 125 S. State Street Suite 6416 - City: Salt Lake City - State_or_Province: Utah - Postal_Code: 84138 - Country: USA - Contact_Voice_Telephone: 801-844-2922 - Contact_Facsimile_Telephone: 801-956-3653 - Contact_Electronic_Mail_Address: apfo.sales@slc.usda.gov - Distribution_Liability: - In no event shall the creators, custodians, or distributors - of this information be liable for any damages arising out - of its use (or the inability to use it). - Standard_Order_Process: - Digital_Form: - Digital_Transfer_Information: - Format_Name: GeoTIFF - Georeferenced Tagged Image File Format - Format_Information_Content: Multispectral 4-band - Digital_Transfer_Option: - Offline_Option: - Offline_Media: CD-ROM - Recording_Format: ISO 9660 Mode 1 Level 2 Extensions - Offline_Option: - Offline_Media: DVD-R - Recording_Format: ISO 9660 - Offline_Option: - Offline_Media: USB Hard Disk - Recording_Format: NTFS - Offline_Option:^M - Offline_Media: USB Flash Thumb Drive^M - Recording_Format: NTFS^M - Fees: - Contact the Aerial Photography Field Office - for more information - Resource_Description: - m_3707763_se_18_060_20180825_20190211.tif - Metadata_Reference_Information: - Metadata_Date: 20191105 - Metadata_Contact: - Contact_Information: - Contact_Organization_Primary: - Contact_Organization: - USDA-FPAC-BC-APFO Aerial Photography Field Office - Contact_Address: - Address_Type: mailing and physical address - Address: 125 S. State Street Suite 6416 - City: Salt Lake City - State_or_Province: Utah - Postal_Code: 84138 - Country: USA - Contact_Voice_Telephone: 801-844-2922 - Metadata_Standard_Name: - Content Standard for Digital Geospatial Metadata - Metadata_Standard_Version: FGDC-STD-001-1998 - From 865aefe647d215394c0e8888c4973a0f523cc1d3 Mon Sep 17 00:00:00 2001 From: Phil Varner Date: Wed, 13 Apr 2022 15:38:01 -0400 Subject: [PATCH 10/10] fix python_requires --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 480a5e9..db95c83 100644 --- a/setup.cfg +++ b/setup.cfg @@ -22,7 +22,7 @@ classifiers = Programming Language :: Python :: 3.9 [options] -python_requires = >=3.8,<=3.9 +python_requires = >=3.8,<3.10 package_dir = =src packages = find_namespace: