From d8bc4c741b091a6e7c6e3cf42f7e293633f35c1d Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Thu, 14 Mar 2019 17:51:51 -0400 Subject: [PATCH 01/17] move code to read json file into parse_args function --- satsearch/main.py | 6 ------ satsearch/parser.py | 8 +++++++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/satsearch/main.py b/satsearch/main.py index 7903d85..cc4a996 100644 --- a/satsearch/main.py +++ b/satsearch/main.py @@ -54,12 +54,6 @@ def cli(): parser = SatUtilsParser.newbie(description='sat-search (v%s)' % __version__) kwargs = parser.parse_args(sys.argv[1:]) - # if a filename, read the GeoJSON file - if 'intersects' in kwargs: - if os.path.exists(kwargs['intersects']): - with open(kwargs['intersects']) as f: - kwargs['intersects'] = json.loads(f.read()) - cmd = kwargs.pop('command', None) if cmd is not None: main(**kwargs) diff --git a/satsearch/parser.py b/satsearch/parser.py index 9fd2d8f..3795301 100644 --- a/satsearch/parser.py +++ b/satsearch/parser.py @@ -1,4 +1,4 @@ -from copy import deepcopy +import json import os import sys import logging @@ -61,6 +61,12 @@ def parse_args(self, *args, **kwargs): if 'filename' in args: config.FILENAME = args.pop('filename') + # if a filename, read the GeoJSON file + if 'intersects' in args: + if os.path.exists(args['intersects']): + with open(args['intersects']) as f: + args['intersects'] = json.loads(f.read()) + return args @classmethod From 2052b71ee0a2ad5e84f6b91666475a6e42b09228 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Thu, 14 Mar 2019 17:52:15 -0400 Subject: [PATCH 02/17] increment version --- satsearch/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/satsearch/version.py b/satsearch/version.py index fc79d63..bcbf44d 100644 --- a/satsearch/version.py +++ b/satsearch/version.py @@ -1 +1 @@ -__version__ = '0.2.1' +__version__ = '0.2.2b1' From fb10b05f03e38cddac2df18ea460f71709d513f2 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Thu, 14 Mar 2019 17:52:58 -0400 Subject: [PATCH 03/17] add to changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7edf4b..433de45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Changed +- Parser module now handles reading JSON from file + ## [v0.2.1] - 2019-02-14 From c056a01a805a69cd95a19709e79037e08e4fff66 Mon Sep 17 00:00:00 2001 From: lishrimp Date: Tue, 16 Apr 2019 20:59:38 -0700 Subject: [PATCH 04/17] Update search.py Fixed a bug that the joined url did not include 'items' in the path --- satsearch/search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/satsearch/search.py b/satsearch/search.py index 94cfa73..a58a3dd 100644 --- a/satsearch/search.py +++ b/satsearch/search.py @@ -95,7 +95,7 @@ def items_by_id(cls, ids, collection): """ Return Items from collection with matching ids """ col = cls.collection(collection) items = [] - base_url = urljoin(config.API_URL, 'collections/%s/items' % collection) + base_url = urljoin(config.API_URL, 'collections/%s/items/' % collection) for id in ids: try: items.append(Item(cls.query(urljoin(base_url, id)))) From ec2801a91bd7c05bb7c664a13decb82e3c34cd03 Mon Sep 17 00:00:00 2001 From: lishrimp Date: Tue, 23 Apr 2019 16:13:48 -0700 Subject: [PATCH 05/17] Update version.py --- satsearch/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/satsearch/version.py b/satsearch/version.py index fc79d63..020ed73 100644 --- a/satsearch/version.py +++ b/satsearch/version.py @@ -1 +1 @@ -__version__ = '0.2.1' +__version__ = '0.2.2' From b48164f00b43ee3d37e9c46955be7b1211737f11 Mon Sep 17 00:00:00 2001 From: lishrimp Date: Tue, 23 Apr 2019 16:16:38 -0700 Subject: [PATCH 06/17] Changed the order of comparison symbols Changed the order of symbols so that the <=, >= symbols can correctly be interpreted --- satsearch/search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/satsearch/search.py b/satsearch/search.py index 94cfa73..840940a 100644 --- a/satsearch/search.py +++ b/satsearch/search.py @@ -36,7 +36,7 @@ def search(cls, **kwargs): kwargs['property'] = [] kwargs['property'].append(q) del kwargs['collection'] - symbols = {'=': 'eq', '>': 'gt', '<': 'lt', '>=': 'gte', '<=': 'lte'} + symbols = {'>=': 'gte', '<=': 'lte', '=': 'eq', '>': 'gt', '<': 'lt'} if 'property' in kwargs and isinstance(kwargs['property'], list): queries = {} for prop in kwargs['property']: From 4fa48f57f6cea08dce068344b77e94b0c40947bf Mon Sep 17 00:00:00 2001 From: Seungwoo Lee Date: Thu, 25 Apr 2019 21:04:26 -0700 Subject: [PATCH 07/17] Added a test for converting the <= operator in the query --- satsearch/search.py | 7 ++++--- test/test_search.py | 9 ++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/satsearch/search.py b/satsearch/search.py index 840940a..5fcfa00 100644 --- a/satsearch/search.py +++ b/satsearch/search.py @@ -19,6 +19,8 @@ class SatSearchError(Exception): class Search(object): """ One search query (possibly multiple pages) """ + search_op_list = ['>=', '<=', '=', '>', '<'] + search_op_to_stac_op = {'>=': 'gte', '<=': 'lte', '=': 'eq', '>': 'gt', '<': 'lt'} def __init__(self, **kwargs): """ Initialize a Search object with parameters """ @@ -36,14 +38,13 @@ def search(cls, **kwargs): kwargs['property'] = [] kwargs['property'].append(q) del kwargs['collection'] - symbols = {'>=': 'gte', '<=': 'lte', '=': 'eq', '>': 'gt', '<': 'lt'} if 'property' in kwargs and isinstance(kwargs['property'], list): queries = {} for prop in kwargs['property']: - for s in symbols: + for s in Search.search_op_list: parts = prop.split(s) if len(parts) == 2: - queries = dict_merge(queries, {parts[0]: {symbols[s]: parts[1]}}) + queries = dict_merge(queries, {parts[0]: {Search.search_op_to_stac_op[s]: parts[1]}}) break del kwargs['property'] kwargs['query'] = queries diff --git a/test/test_search.py b/test/test_search.py index 28b1174..a43ce8f 100644 --- a/test/test_search.py +++ b/test/test_search.py @@ -88,4 +88,11 @@ def test_get_ids_without_collection(self): def test_query_bad_url(self): with self.assertRaises(SatSearchError): - Search.query(url=os.path.join(config.API_URL, 'collections/nosuchcollection')) \ No newline at end of file + Search.query(url=os.path.join(config.API_URL, 'collections/nosuchcollection')) + + def test_search_property_operator(self): + expected = {'query': {'eo:cloud_cover': {'lte': '10'}, 'collection': {'eq': 'Sentinel-2A'}}} + instance = Search.search(collection='Sentinel-2A', + property=['eo:cloud_cover<=10']) + actual = instance.kwargs + assert actual == expected From 94f5a7e552f0f4f04f1748b2444256cf24f81ea9 Mon Sep 17 00:00:00 2001 From: Seungwoo Lee Date: Thu, 25 Apr 2019 21:09:00 -0700 Subject: [PATCH 08/17] fixed the collection name --- test/test_search.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_search.py b/test/test_search.py index a43ce8f..38ac08f 100644 --- a/test/test_search.py +++ b/test/test_search.py @@ -91,8 +91,8 @@ def test_query_bad_url(self): Search.query(url=os.path.join(config.API_URL, 'collections/nosuchcollection')) def test_search_property_operator(self): - expected = {'query': {'eo:cloud_cover': {'lte': '10'}, 'collection': {'eq': 'Sentinel-2A'}}} - instance = Search.search(collection='Sentinel-2A', + expected = {'query': {'eo:cloud_cover': {'lte': '10'}, 'collection': {'eq': 'sentinel-2-l1c'}}} + instance = Search.search(collection='sentinel-2-l1c', property=['eo:cloud_cover<=10']) actual = instance.kwargs assert actual == expected From cf2454a99c8a2c35762a5b8f76afd354548ec162 Mon Sep 17 00:00:00 2001 From: Seungwoo Lee Date: Thu, 25 Apr 2019 21:11:18 -0700 Subject: [PATCH 09/17] Reverted the version to 0.2.1 --- satsearch/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/satsearch/version.py b/satsearch/version.py index 020ed73..fc79d63 100644 --- a/satsearch/version.py +++ b/satsearch/version.py @@ -1 +1 @@ -__version__ = '0.2.2' +__version__ = '0.2.1' From 1e3a2891a95d54292e14b04b7122f80d28022a84 Mon Sep 17 00:00:00 2001 From: Sam Murphy Date: Mon, 13 May 2019 12:13:15 +0100 Subject: [PATCH 10/17] small typo exaplained --> explained --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ed96f67..3485d3d 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ With sat-search you can search a STAC compliant API with full querying support ( Sat-search is a Python 3 library that can incorporated into other applications. A [Jupyter notebook tutorial](tutorial-1.ipynb) is included that covers all the main features of the library. -Sat-search also comes with a Command Line Interface (CLI), which is exaplained more below. +Sat-search also comes with a Command Line Interface (CLI), which is explained more below. #### The CLI The sat-search CLI has an extensive online help that can be printed with the `-h` switch. From 7f3b6ece5f6448f776b854f50cbaabdacc96f3b2 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Thu, 19 Sep 2019 22:56:54 -0400 Subject: [PATCH 11/17] combine parser and main modules into single cli module --- README.md | 7 ++-- satsearch/{parser.py => cli.py} | 62 +++++++++++++++++++++++++++-- satsearch/main.py | 63 ------------------------------ satsearch/version.py | 2 +- test/{test_main.py => test_cli.py} | 43 +++++++++++++++++++- test/test_parser.py | 50 ------------------------ 6 files changed, 106 insertions(+), 121 deletions(-) rename satsearch/{parser.py => cli.py} (77%) delete mode 100644 satsearch/main.py rename test/{test_main.py => test_cli.py} (60%) delete mode 100644 test/test_parser.py diff --git a/README.md b/README.md index ed96f67..de8bb4f 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ $ pip install . ``` #### Versions -The latest version of sat-search is 0.2.0, which uses the STAC spec v0.6.0. To install other versions of sat-search, specify the version in the call to pip. +The latest version of sat-search is 0.3.0, which uses [STAC v0.7.0](https://github.com/radiantearth/stac-spec/tree/v0.7.0). To install other versions of sat-search, specify the version in the call to pip. ```bash pip install sat-search==0.2.0 @@ -32,8 +32,9 @@ The table below shows the corresponding versions between sat-search and STAC. Ad | sat-search | STAC | | -------- | ---- | -| 0.1.x | 0.5.0 | -| 0.2.x | 0.6.0 | +| 0.1.x | 0.5.x - 0.6.x | +| 0.2.x | 0.5.x - 0.6.x | +| 0.3.x | 0.7.x | ## Using sat-search diff --git a/satsearch/parser.py b/satsearch/cli.py similarity index 77% rename from satsearch/parser.py rename to satsearch/cli.py index 3795301..e466c26 100644 --- a/satsearch/parser.py +++ b/satsearch/cli.py @@ -1,13 +1,15 @@ +import argparse import json +import logging import os import sys -import logging -import argparse import satsearch.config as config -from satstac.utils import dict_merge from .version import __version__ +from satsearch import Search +from satstac import Items +from satstac.utils import dict_merge class SatUtilsParser(argparse.ArgumentParser): @@ -102,3 +104,57 @@ def __call__(self, parser, namespace, values, option_string=None): for val in values: n, v = val.split('=') setattr(namespace, n, {'eq': v}) + + +def main(items=None, printmd=None, printcal=False, found=False, + save=None, download=None, requestor_pays=False, **kwargs): + """ Main function for performing a search """ + + if items is None: + ## if there are no items then perform a search + search = Search.search(**kwargs) + if found: + num = search.found() + print('%s items found' % num) + return num + items = search.items() + else: + # otherwise, load a search from a file + items = Items.load(items) + + print('%s items found' % len(items)) + + # print metadata + if printmd is not None: + print(items.summary(printmd)) + + # print calendar + if printcal: + print(items.calendar()) + + # save all metadata in JSON file + if save is not None: + items.save(filename=save) + + # download files given `download` keys + if download is not None: + if 'ALL' in download: + # get complete set of assets + download = set([k for i in items for k in i.assets]) + for key in download: + items.download(key=key, path=config.DATADIR, filename=config.FILENAME, requestor_pays=requestor_pays) + + return items + + +def cli(): + parser = SatUtilsParser.newbie(description='sat-search (v%s)' % __version__) + kwargs = parser.parse_args(sys.argv[1:]) + + cmd = kwargs.pop('command', None) + if cmd is not None: + main(**kwargs) + + +if __name__ == "__main__": + cli() diff --git a/satsearch/main.py b/satsearch/main.py deleted file mode 100644 index cc4a996..0000000 --- a/satsearch/main.py +++ /dev/null @@ -1,63 +0,0 @@ -import os -import sys -import json -from .version import __version__ -from satsearch import Search -from satstac import Items -from satsearch.parser import SatUtilsParser - -import satsearch.config as config - - -def main(items=None, printmd=None, printcal=False, found=False, - save=None, download=None, requestor_pays=False, **kwargs): - """ Main function for performing a search """ - - if items is None: - ## if there are no items then perform a search - search = Search.search(**kwargs) - if found: - num = search.found() - print('%s items found' % num) - return num - items = search.items() - else: - # otherwise, load a search from a file - items = Items.load(items) - - print('%s items found' % len(items)) - - # print metadata - if printmd is not None: - print(items.summary(printmd)) - - # print calendar - if printcal: - print(items.calendar()) - - # save all metadata in JSON file - if save is not None: - items.save(filename=save) - - # download files given `download` keys - if download is not None: - if 'ALL' in download: - # get complete set of assets - download = set([k for i in items for k in i.assets]) - for key in download: - items.download(key=key, path=config.DATADIR, filename=config.FILENAME, requestor_pays=requestor_pays) - - return items - - -def cli(): - parser = SatUtilsParser.newbie(description='sat-search (v%s)' % __version__) - kwargs = parser.parse_args(sys.argv[1:]) - - cmd = kwargs.pop('command', None) - if cmd is not None: - main(**kwargs) - - -if __name__ == "__main__": - cli() diff --git a/satsearch/version.py b/satsearch/version.py index bcbf44d..b36052c 100644 --- a/satsearch/version.py +++ b/satsearch/version.py @@ -1 +1 @@ -__version__ = '0.2.2b1' +__version__ = '0.3.0b1' diff --git a/test/test_main.py b/test/test_cli.py similarity index 60% rename from test/test_main.py rename to test/test_cli.py index dc409d3..81cbe94 100644 --- a/test/test_main.py +++ b/test/test_cli.py @@ -4,9 +4,10 @@ from unittest.mock import patch import json import shutil -import satsearch.main as main import satsearch.config as config +from satsearch.cli import main, SatUtilsParser + testpath = os.path.dirname(__file__) config.DATADIR = testpath @@ -17,6 +18,46 @@ class Test(unittest.TestCase): num_scenes = 653 + args = 'search --datetime 2017-01-01 -p eo:cloud_cover=0/20 eo:platform=landsat-8' + + @classmethod + def get_test_parser(cls): + """ Get testing parser with search and load subcommands """ + parser = SatUtilsParser.newbie(description='sat-search testing') + return parser + + def test_empty_parse_args(self): + """ Parse empty arguments """ + parser = self.get_test_parser() #import pdb; pdb.set_trace() + with self.assertRaises(SystemExit): + args = parser.parse_args([]) + + def test_empty_parse_search_args(self): + """ Parse empty arguments """ + parser = self.get_test_parser() + args = parser.parse_args(['search']) + self.assertEqual(len(args), 3) + self.assertFalse(args['printcal']) + + def test_parse_args(self): + """ Parse arguments """ + parser = self.get_test_parser() + args = self.args.split(' ') + + args = parser.parse_args(args) + self.assertEqual(len(args), 5) + self.assertEqual(args['datetime'], '2017-01-01') + #assert(args['eo:cloud_cover'] == '0/20') + #self.assertEqual(args['cloud_from'], 0) + #self.assertEqual(args['cloud_to'], 20) + #self.assertEqual(args['satellite_name'], 'Landsat-8') + #self.assertEqual(args['dayOrNight'], 'DAY') + + def _test_parse_args_badcloud(self): + parser = self.get_test_parser() + with self.assertRaises(ValueError): + args = parser.parse_args('search --datetime 2017-01-01 --cloud 0.5 eo:platform Landsat-8'.split(' ')) + def test_main(self): """ Run main function """ items = main.main(datetime='2019-01-02', **{'collection': 'landsat-8-l1'}) diff --git a/test/test_parser.py b/test/test_parser.py deleted file mode 100644 index f7a836d..0000000 --- a/test/test_parser.py +++ /dev/null @@ -1,50 +0,0 @@ -import os -import unittest -from satsearch.parser import SatUtilsParser - - -testpath = os.path.dirname(__file__) - - -class Test(unittest.TestCase): - """ Test main module """ - - args = 'search --datetime 2017-01-01 -p eo:cloud_cover=0/20 eo:platform=landsat-8' - - @classmethod - def get_test_parser(cls): - """ Get testing parser with search and load subcommands """ - parser = SatUtilsParser.newbie(description='sat-search testing') - return parser - - def test_empty_parse_args(self): - """ Parse empty arguments """ - parser = self.get_test_parser() #import pdb; pdb.set_trace() - with self.assertRaises(SystemExit): - args = parser.parse_args([]) - - def test_empty_parse_search_args(self): - """ Parse empty arguments """ - parser = self.get_test_parser() - args = parser.parse_args(['search']) - self.assertEqual(len(args), 3) - self.assertFalse(args['printcal']) - - def test_parse_args(self): - """ Parse arguments """ - parser = self.get_test_parser() - args = self.args.split(' ') - - args = parser.parse_args(args) - self.assertEqual(len(args), 5) - self.assertEqual(args['datetime'], '2017-01-01') - #assert(args['eo:cloud_cover'] == '0/20') - #self.assertEqual(args['cloud_from'], 0) - #self.assertEqual(args['cloud_to'], 20) - #self.assertEqual(args['satellite_name'], 'Landsat-8') - #self.assertEqual(args['dayOrNight'], 'DAY') - - def _test_parse_args_badcloud(self): - parser = self.get_test_parser() - with self.assertRaises(ValueError): - args = parser.parse_args('search --datetime 2017-01-01 --cloud 0.5 eo:platform Landsat-8'.split(' ')) From 073dc71b495cb0fa03876faddabcd3d714fe5a98 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Thu, 19 Sep 2019 22:59:56 -0400 Subject: [PATCH 12/17] bump sat-stac version to 0.3.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 0b96c0f..49f1548 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -sat-stac~=0.1.2 +sat-stac~=0.3.0 From 41df013eaaf42a47c655ad279a23ed7cd481d821 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Fri, 20 Sep 2019 11:23:26 -0400 Subject: [PATCH 13/17] update tests --- satsearch/cli.py | 4 +- satsearch/config.py | 2 +- satsearch/search.py | 6 +- test/landsat-item1.json | 176 +++++++++++++++++++++++++++++----------- test/landsat-item2.json | 175 ++++++++++++++++++++++++++++----------- test/test_cli.py | 18 ++-- test/test_search.py | 10 +-- 7 files changed, 279 insertions(+), 112 deletions(-) diff --git a/satsearch/cli.py b/satsearch/cli.py index e466c26..ca94c28 100644 --- a/satsearch/cli.py +++ b/satsearch/cli.py @@ -8,7 +8,7 @@ from .version import __version__ from satsearch import Search -from satstac import Items +from satstac import ItemCollection from satstac.utils import dict_merge @@ -120,7 +120,7 @@ def main(items=None, printmd=None, printcal=False, found=False, items = search.items() else: # otherwise, load a search from a file - items = Items.load(items) + items = ItemCollection.load(items) print('%s items found' % len(items)) diff --git a/satsearch/config.py b/satsearch/config.py index f9fea21..a5d9b9b 100644 --- a/satsearch/config.py +++ b/satsearch/config.py @@ -1,7 +1,7 @@ import os # API URL -API_URL = os.getenv('SATUTILS_API_URL', 'https://sat-api.developmentseed.org') +API_URL = os.getenv('SATUTILS_API_URL', 'https://earth-search.aws.element84.com') # data directory to store downloaded imagery DATADIR = os.getenv('SATUTILS_DATADIR', '${collection}/${date}') diff --git a/satsearch/search.py b/satsearch/search.py index 94cfa73..5fdd78b 100644 --- a/satsearch/search.py +++ b/satsearch/search.py @@ -5,7 +5,7 @@ import satsearch.config as config -from satstac import Collection, Item, Items +from satstac import Collection, Item, ItemCollection from satstac.utils import dict_merge from urllib.parse import urljoin @@ -101,7 +101,7 @@ def items_by_id(cls, ids, collection): items.append(Item(cls.query(urljoin(base_url, id)))) except SatSearchError as err: pass - return Items(items, collections=[col]) + return ItemCollection(items, collections=[col]) def items(self, limit=10000): """ Return all of the Items and Collections for this search """ @@ -140,4 +140,4 @@ def items(self, limit=10000): # item = dict_merge(item, collections[item['properties']['collection']]) # _items.append(Item(item)) - return Items(items, collections=collections, search=self.kwargs) + return ItemCollection(items, collections=collections, search=self.kwargs) diff --git a/test/landsat-item1.json b/test/landsat-item1.json index 53ca960..b851aa5 100644 --- a/test/landsat-item1.json +++ b/test/landsat-item1.json @@ -1,63 +1,147 @@ { "type": "Feature", - "id": "LC80080462018268LGN00", + "id": "LC81692212019263", "bbox": [ - -72.07482, - 19.15183, - -69.84647, - 21.29465 + -173.08024, + 52.00372, + -169.43115, + 54.17563 ], "geometry": { "type": "Polygon", "coordinates": [ [ [ - -72.07482, - 21.26876 + -169.43509345268382, + 52.480608048464546 ], [ - -69.85803, - 21.29465 + -172.2580177302994, + 52.00576775847521 ], [ - -69.84647, - 19.17494 + -173.07835274956315, + 53.70820214108535 ], [ - -72.03347, - 19.15183 + -170.24839015990904, + 54.17408690459604 ], [ - -72.07482, - 21.26876 + -169.43509345268382, + 52.480608048464546 ] ] ] }, "properties": { "collection": "landsat-8-l1", - "datetime": "2018-09-25T15:08:03.209908+00:00", - "eo:sun_azimuth": 132.18559343, - "eo:sun_elevation": 59.86078361, - "eo:cloud_cover": 8, - "eo:row": "046", - "eo:column": "008", - "landsat:product_id": "LC08_L1TP_008046_20180925_20181009_01_T1", - "landsat:scene_id": "LC80080462018268LGN00", - "landsat:processing_level": "L1TP", - "landsat:tier": "T1", - "eo:epsg": 32619 + "eo:gsd": 15, + "eo:platform": "landsat-8", + "eo:instrument": "OLI_TIRS", + "eo:off_nadir": 0, + "eo:bands": [ + { + "name": "B1", + "common_name": "coastal", + "gsd": 30, + "center_wavelength": 0.44, + "full_width_half_max": 0.02 + }, + { + "name": "B2", + "common_name": "blue", + "gsd": 30, + "center_wavelength": 0.48, + "full_width_half_max": 0.06 + }, + { + "name": "B3", + "common_name": "green", + "gsd": 30, + "center_wavelength": 0.56, + "full_width_half_max": 0.06 + }, + { + "name": "B4", + "common_name": "red", + "gsd": 30, + "center_wavelength": 0.65, + "full_width_half_max": 0.04 + }, + { + "name": "B5", + "common_name": "nir", + "gsd": 30, + "center_wavelength": 0.86, + "full_width_half_max": 0.03 + }, + { + "name": "B6", + "common_name": "swir16", + "gsd": 30, + "center_wavelength": 1.6, + "full_width_half_max": 0.08 + }, + { + "name": "B7", + "common_name": "swir22", + "gsd": 30, + "center_wavelength": 2.2, + "full_width_half_max": 0.2 + }, + { + "name": "B8", + "common_name": "pan", + "gsd": 15, + "center_wavelength": 0.59, + "full_width_half_max": 0.18 + }, + { + "name": "B9", + "common_name": "cirrus", + "gsd": 30, + "center_wavelength": 1.37, + "full_width_half_max": 0.02 + }, + { + "name": "B10", + "common_name": "lwir11", + "gsd": 100, + "center_wavelength": 10.9, + "full_width_half_max": 0.8 + }, + { + "name": "B11", + "common_name": "lwir12", + "gsd": 100, + "center_wavelength": 12, + "full_width_half_max": 1 + } + ], + "datetime": "2019-09-20T08:53:31.493794+00:00", + "eo:sun_azimuth": -41.99387147, + "eo:sun_elevation": -27.90765031, + "eo:cloud_cover": -1, + "eo:row": "221", + "eo:column": "169", + "landsat:product_id": "LC08_L1GT_169221_20190920_20190920_01_RT", + "landsat:scene_id": "LC81692212019263LGN00", + "landsat:processing_level": "L1GT", + "landsat:tier": "RT", + "landsat:revision": "00", + "eo:epsg": 3262 }, "assets": { "index": { "type": "text/html", "title": "HTML index page", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/046/LC08_L1TP_008046_20180925_20181009_01_T1/index.html" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/221/LC08_L1GT_169221_20190920_20190920_01_RT/LC08_L1GT_169221_20190920_20190920_01_RT_MTL.txt" }, "thumbnail": { "title": "Thumbnail image", "type": "image/jpeg", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/046/LC08_L1TP_008046_20180925_20181009_01_T1/LC08_L1TP_008046_20180925_20181009_01_T1_thumb_large.jpg" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/221/LC08_L1GT_169221_20190920_20190920_01_RT/LC08_L1GT_169221_20190920_20190920_01_RT_thumb_large.jpg" }, "B1": { "type": "image/x.geotiff", @@ -65,7 +149,7 @@ 0 ], "title": "Band 1 (coastal)", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/046/LC08_L1TP_008046_20180925_20181009_01_T1/LC08_L1TP_008046_20180925_20181009_01_T1_B1.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/221/LC08_L1GT_169221_20190920_20190920_01_RT/LC08_L1GT_169221_20190920_20190920_01_RT_B1.TIF" }, "B2": { "type": "image/x.geotiff", @@ -73,7 +157,7 @@ 1 ], "title": "Band 2 (blue)", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/046/LC08_L1TP_008046_20180925_20181009_01_T1/LC08_L1TP_008046_20180925_20181009_01_T1_B2.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/221/LC08_L1GT_169221_20190920_20190920_01_RT/LC08_L1GT_169221_20190920_20190920_01_RT_B2.TIF" }, "B3": { "type": "image/x.geotiff", @@ -81,7 +165,7 @@ 2 ], "title": "Band 3 (green)", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/046/LC08_L1TP_008046_20180925_20181009_01_T1/LC08_L1TP_008046_20180925_20181009_01_T1_B3.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/221/LC08_L1GT_169221_20190920_20190920_01_RT/LC08_L1GT_169221_20190920_20190920_01_RT_B3.TIF" }, "B4": { "type": "image/x.geotiff", @@ -89,7 +173,7 @@ 3 ], "title": "Band 4 (red)", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/046/LC08_L1TP_008046_20180925_20181009_01_T1/LC08_L1TP_008046_20180925_20181009_01_T1_B4.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/221/LC08_L1GT_169221_20190920_20190920_01_RT/LC08_L1GT_169221_20190920_20190920_01_RT_B4.TIF" }, "B5": { "type": "image/x.geotiff", @@ -97,7 +181,7 @@ 4 ], "title": "Band 5 (nir)", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/046/LC08_L1TP_008046_20180925_20181009_01_T1/LC08_L1TP_008046_20180925_20181009_01_T1_B5.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/221/LC08_L1GT_169221_20190920_20190920_01_RT/LC08_L1GT_169221_20190920_20190920_01_RT_B5.TIF" }, "B6": { "type": "image/x.geotiff", @@ -105,7 +189,7 @@ 5 ], "title": "Band 6 (swir16)", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/046/LC08_L1TP_008046_20180925_20181009_01_T1/LC08_L1TP_008046_20180925_20181009_01_T1_B6.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/221/LC08_L1GT_169221_20190920_20190920_01_RT/LC08_L1GT_169221_20190920_20190920_01_RT_B6.TIF" }, "B7": { "type": "image/x.geotiff", @@ -113,7 +197,7 @@ 6 ], "title": "Band 7 (swir22)", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/046/LC08_L1TP_008046_20180925_20181009_01_T1/LC08_L1TP_008046_20180925_20181009_01_T1_B7.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/221/LC08_L1GT_169221_20190920_20190920_01_RT/LC08_L1GT_169221_20190920_20190920_01_RT_B7.TIF" }, "B8": { "type": "image/x.geotiff", @@ -121,7 +205,7 @@ 7 ], "title": "Band 8 (pan)", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/046/LC08_L1TP_008046_20180925_20181009_01_T1/LC08_L1TP_008046_20180925_20181009_01_T1_B8.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/221/LC08_L1GT_169221_20190920_20190920_01_RT/LC08_L1GT_169221_20190920_20190920_01_RT_B8.TIF" }, "B9": { "type": "image/x.geotiff", @@ -129,7 +213,7 @@ 8 ], "title": "Band 9 (cirrus)", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/046/LC08_L1TP_008046_20180925_20181009_01_T1/LC08_L1TP_008046_20180925_20181009_01_T1_B9.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/221/LC08_L1GT_169221_20190920_20190920_01_RT/LC08_L1GT_169221_20190920_20190920_01_RT_B9.TIF" }, "B10": { "type": "image/x.geotiff", @@ -137,7 +221,7 @@ 9 ], "title": "Band 10 (lwir)", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/046/LC08_L1TP_008046_20180925_20181009_01_T1/LC08_L1TP_008046_20180925_20181009_01_T1_B10.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/221/LC08_L1GT_169221_20190920_20190920_01_RT/LC08_L1GT_169221_20190920_20190920_01_RT_B10.TIF" }, "B11": { "type": "image/x.geotiff", @@ -145,40 +229,40 @@ 10 ], "title": "Band 11 (lwir)", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/046/LC08_L1TP_008046_20180925_20181009_01_T1/LC08_L1TP_008046_20180925_20181009_01_T1_B11.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/221/LC08_L1GT_169221_20190920_20190920_01_RT/LC08_L1GT_169221_20190920_20190920_01_RT_B11.TIF" }, "ANG": { "title": "Angle coefficients file", "type": "text/plain", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/046/LC08_L1TP_008046_20180925_20181009_01_T1/LC08_L1TP_008046_20180925_20181009_01_T1_ANG.txt" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/221/LC08_L1GT_169221_20190920_20190920_01_RT/LC08_L1GT_169221_20190920_20190920_01_RT_ANG.txt" }, "MTL": { "title": "original metadata file", "type": "text/plain", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/046/LC08_L1TP_008046_20180925_20181009_01_T1/LC08_L1TP_008046_20180925_20181009_01_T1_MTL.txt" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/221/LC08_L1GT_169221_20190920_20190920_01_RT/LC08_L1GT_169221_20190920_20190920_01_RT_MTL.txt" }, "BQA": { "title": "Band quality data", "type": "image/x.geotiff", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/046/LC08_L1TP_008046_20180925_20181009_01_T1/LC08_L1TP_008046_20180925_20181009_01_T1_BQA.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/221/LC08_L1GT_169221_20190920_20190920_01_RT/LC08_L1GT_169221_20190920_20190920_01_RT_BQA.TIF" } }, "links": [ { "rel": "self", - "href": "https://sat-api-dev.developmentseed.org/collections/landsat-8-l1/item/LC80080462018268LGN00" + "href": "https://earth-search.aws.element84.com/collections/landsat-8-l1/items/LC81692212019263" }, { "rel": "parent", - "href": "https://sat-api-dev.developmentseed.org/collections/landsat-8-l1" + "href": "https://earth-search.aws.element84.com/collections/landsat-8-l1" }, { "rel": "collection", - "href": "https://sat-api-dev.developmentseed.org/collections/landsat-8-l1" + "href": "https://earth-search.aws.element84.com/collections/landsat-8-l1" }, { "rel": "root", - "href": "https://sat-api-dev.developmentseed.org/stac" + "href": "https://earth-search.aws.element84.com/stac" } ] } \ No newline at end of file diff --git a/test/landsat-item2.json b/test/landsat-item2.json index e64cd95..17f8665 100644 --- a/test/landsat-item2.json +++ b/test/landsat-item2.json @@ -1,63 +1,146 @@ { "type": "Feature", - "id": "LC80080302018268LGN00", + "id": "LC81691102019263", "bbox": [ - -66.15395, - 42.07238, - -63.19112, - 44.27107 + 2.49764, + -72.22691, + 10.73227, + -69.54865 ], "geometry": { "type": "Polygon", "coordinates": [ [ [ - -66.15395, - 44.22768 + 5.728700356172139, + -69.55150325883106 ], [ - -63.19797, - 44.27107 + 10.724505278283958, + -70.62787508933098 ], [ - -63.19112, - 42.11264 + 7.495515149535066, + -72.22537395842913 ], [ - -66.04493, - 42.07238 + 2.505902050290957, + -71.16167254656607 ], [ - -66.15395, - 44.22768 + 5.728700356172139, + -69.55150325883106 ] ] ] }, "properties": { "collection": "landsat-8-l1", - "datetime": "2018-09-25T15:01:40.919399+00:00", - "eo:sun_azimuth": 156.16142948, - "eo:sun_elevation": 43.22291973, - "eo:cloud_cover": 41, - "eo:row": "030", - "eo:column": "008", - "landsat:product_id": "LC08_L1TP_008030_20180925_20181009_01_T1", - "landsat:scene_id": "LC80080302018268LGN00", - "landsat:processing_level": "L1TP", - "landsat:tier": "T1", - "eo:epsg": 32620 + "eo:gsd": 15, + "eo:platform": "landsat-8", + "eo:instrument": "OLI_TIRS", + "eo:off_nadir": 0, + "eo:bands": [ + { + "name": "B1", + "common_name": "coastal", + "gsd": 30, + "center_wavelength": 0.44, + "full_width_half_max": 0.02 + }, + { + "name": "B2", + "common_name": "blue", + "gsd": 30, + "center_wavelength": 0.48, + "full_width_half_max": 0.06 + }, + { + "name": "B3", + "common_name": "green", + "gsd": 30, + "center_wavelength": 0.56, + "full_width_half_max": 0.06 + }, + { + "name": "B4", + "common_name": "red", + "gsd": 30, + "center_wavelength": 0.65, + "full_width_half_max": 0.04 + }, + { + "name": "B5", + "common_name": "nir", + "gsd": 30, + "center_wavelength": 0.86, + "full_width_half_max": 0.03 + }, + { + "name": "B6", + "common_name": "swir16", + "gsd": 30, + "center_wavelength": 1.6, + "full_width_half_max": 0.08 + }, + { + "name": "B7", + "common_name": "swir22", + "gsd": 30, + "center_wavelength": 2.2, + "full_width_half_max": 0.2 + }, + { + "name": "B8", + "common_name": "pan", + "gsd": 15, + "center_wavelength": 0.59, + "full_width_half_max": 0.18 + }, + { + "name": "B9", + "common_name": "cirrus", + "gsd": 30, + "center_wavelength": 1.37, + "full_width_half_max": 0.02 + }, + { + "name": "B10", + "common_name": "lwir11", + "gsd": 100, + "center_wavelength": 10.9, + "full_width_half_max": 0.8 + }, + { + "name": "B11", + "common_name": "lwir12", + "gsd": 100, + "center_wavelength": 12, + "full_width_half_max": 1 + } + ], + "datetime": "2019-09-20T08:09:14.090119+00:00", + "eo:sun_azimuth": 50.98693016, + "eo:sun_elevation": 11.08298526, + "eo:cloud_cover": 0, + "eo:row": "110", + "eo:column": "169", + "landsat:product_id": "LC08_L1GT_169110_20190920_20190920_01_RT", + "landsat:scene_id": "LC81691102019263LGN00", + "landsat:processing_level": "L1GT", + "landsat:tier": "RT", + "landsat:revision": "00" }, "assets": { "index": { "type": "text/html", "title": "HTML index page", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/030/LC08_L1TP_008030_20180925_20181009_01_T1/index.html" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/110/LC08_L1GT_169110_20190920_20190920_01_RT/LC08_L1GT_169110_20190920_20190920_01_RT_MTL.txt" }, "thumbnail": { "title": "Thumbnail image", "type": "image/jpeg", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/030/LC08_L1TP_008030_20180925_20181009_01_T1/LC08_L1TP_008030_20180925_20181009_01_T1_thumb_large.jpg" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/110/LC08_L1GT_169110_20190920_20190920_01_RT/LC08_L1GT_169110_20190920_20190920_01_RT_thumb_large.jpg" }, "B1": { "type": "image/x.geotiff", @@ -65,7 +148,7 @@ 0 ], "title": "Band 1 (coastal)", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/030/LC08_L1TP_008030_20180925_20181009_01_T1/LC08_L1TP_008030_20180925_20181009_01_T1_B1.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/110/LC08_L1GT_169110_20190920_20190920_01_RT/LC08_L1GT_169110_20190920_20190920_01_RT_B1.TIF" }, "B2": { "type": "image/x.geotiff", @@ -73,7 +156,7 @@ 1 ], "title": "Band 2 (blue)", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/030/LC08_L1TP_008030_20180925_20181009_01_T1/LC08_L1TP_008030_20180925_20181009_01_T1_B2.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/110/LC08_L1GT_169110_20190920_20190920_01_RT/LC08_L1GT_169110_20190920_20190920_01_RT_B2.TIF" }, "B3": { "type": "image/x.geotiff", @@ -81,7 +164,7 @@ 2 ], "title": "Band 3 (green)", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/030/LC08_L1TP_008030_20180925_20181009_01_T1/LC08_L1TP_008030_20180925_20181009_01_T1_B3.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/110/LC08_L1GT_169110_20190920_20190920_01_RT/LC08_L1GT_169110_20190920_20190920_01_RT_B3.TIF" }, "B4": { "type": "image/x.geotiff", @@ -89,7 +172,7 @@ 3 ], "title": "Band 4 (red)", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/030/LC08_L1TP_008030_20180925_20181009_01_T1/LC08_L1TP_008030_20180925_20181009_01_T1_B4.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/110/LC08_L1GT_169110_20190920_20190920_01_RT/LC08_L1GT_169110_20190920_20190920_01_RT_B4.TIF" }, "B5": { "type": "image/x.geotiff", @@ -97,7 +180,7 @@ 4 ], "title": "Band 5 (nir)", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/030/LC08_L1TP_008030_20180925_20181009_01_T1/LC08_L1TP_008030_20180925_20181009_01_T1_B5.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/110/LC08_L1GT_169110_20190920_20190920_01_RT/LC08_L1GT_169110_20190920_20190920_01_RT_B5.TIF" }, "B6": { "type": "image/x.geotiff", @@ -105,7 +188,7 @@ 5 ], "title": "Band 6 (swir16)", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/030/LC08_L1TP_008030_20180925_20181009_01_T1/LC08_L1TP_008030_20180925_20181009_01_T1_B6.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/110/LC08_L1GT_169110_20190920_20190920_01_RT/LC08_L1GT_169110_20190920_20190920_01_RT_B6.TIF" }, "B7": { "type": "image/x.geotiff", @@ -113,7 +196,7 @@ 6 ], "title": "Band 7 (swir22)", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/030/LC08_L1TP_008030_20180925_20181009_01_T1/LC08_L1TP_008030_20180925_20181009_01_T1_B7.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/110/LC08_L1GT_169110_20190920_20190920_01_RT/LC08_L1GT_169110_20190920_20190920_01_RT_B7.TIF" }, "B8": { "type": "image/x.geotiff", @@ -121,7 +204,7 @@ 7 ], "title": "Band 8 (pan)", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/030/LC08_L1TP_008030_20180925_20181009_01_T1/LC08_L1TP_008030_20180925_20181009_01_T1_B8.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/110/LC08_L1GT_169110_20190920_20190920_01_RT/LC08_L1GT_169110_20190920_20190920_01_RT_B8.TIF" }, "B9": { "type": "image/x.geotiff", @@ -129,7 +212,7 @@ 8 ], "title": "Band 9 (cirrus)", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/030/LC08_L1TP_008030_20180925_20181009_01_T1/LC08_L1TP_008030_20180925_20181009_01_T1_B9.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/110/LC08_L1GT_169110_20190920_20190920_01_RT/LC08_L1GT_169110_20190920_20190920_01_RT_B9.TIF" }, "B10": { "type": "image/x.geotiff", @@ -137,7 +220,7 @@ 9 ], "title": "Band 10 (lwir)", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/030/LC08_L1TP_008030_20180925_20181009_01_T1/LC08_L1TP_008030_20180925_20181009_01_T1_B10.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/110/LC08_L1GT_169110_20190920_20190920_01_RT/LC08_L1GT_169110_20190920_20190920_01_RT_B10.TIF" }, "B11": { "type": "image/x.geotiff", @@ -145,40 +228,40 @@ 10 ], "title": "Band 11 (lwir)", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/030/LC08_L1TP_008030_20180925_20181009_01_T1/LC08_L1TP_008030_20180925_20181009_01_T1_B11.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/110/LC08_L1GT_169110_20190920_20190920_01_RT/LC08_L1GT_169110_20190920_20190920_01_RT_B11.TIF" }, "ANG": { "title": "Angle coefficients file", "type": "text/plain", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/030/LC08_L1TP_008030_20180925_20181009_01_T1/LC08_L1TP_008030_20180925_20181009_01_T1_ANG.txt" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/110/LC08_L1GT_169110_20190920_20190920_01_RT/LC08_L1GT_169110_20190920_20190920_01_RT_ANG.txt" }, "MTL": { "title": "original metadata file", "type": "text/plain", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/030/LC08_L1TP_008030_20180925_20181009_01_T1/LC08_L1TP_008030_20180925_20181009_01_T1_MTL.txt" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/110/LC08_L1GT_169110_20190920_20190920_01_RT/LC08_L1GT_169110_20190920_20190920_01_RT_MTL.txt" }, "BQA": { "title": "Band quality data", "type": "image/x.geotiff", - "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/008/030/LC08_L1TP_008030_20180925_20181009_01_T1/LC08_L1TP_008030_20180925_20181009_01_T1_BQA.TIF" + "href": "https://landsat-pds.s3.amazonaws.com/c1/L8/169/110/LC08_L1GT_169110_20190920_20190920_01_RT/LC08_L1GT_169110_20190920_20190920_01_RT_BQA.TIF" } }, "links": [ { "rel": "self", - "href": "https://sat-api-dev.developmentseed.org/collections/landsat-8-l1/item/LC80080302018268LGN00" + "href": "https://earth-search.aws.element84.com/collections/landsat-8-l1/items/LC81691102019263" }, { "rel": "parent", - "href": "https://sat-api-dev.developmentseed.org/collections/landsat-8-l1" + "href": "https://earth-search.aws.element84.com/collections/landsat-8-l1" }, { "rel": "collection", - "href": "https://sat-api-dev.developmentseed.org/collections/landsat-8-l1" + "href": "https://earth-search.aws.element84.com/collections/landsat-8-l1" }, { "rel": "root", - "href": "https://sat-api-dev.developmentseed.org/stac" + "href": "https://earth-search.aws.element84.com/stac" } ] } \ No newline at end of file diff --git a/test/test_cli.py b/test/test_cli.py index 81cbe94..0ada2c8 100644 --- a/test/test_cli.py +++ b/test/test_cli.py @@ -6,7 +6,7 @@ import shutil import satsearch.config as config -from satsearch.cli import main, SatUtilsParser +from satsearch.cli import main, SatUtilsParser, cli testpath = os.path.dirname(__file__) @@ -16,7 +16,7 @@ class Test(unittest.TestCase): """ Test main module """ - num_scenes = 653 + num_scenes = 740 args = 'search --datetime 2017-01-01 -p eo:cloud_cover=0/20 eo:platform=landsat-8' @@ -60,22 +60,22 @@ def _test_parse_args_badcloud(self): def test_main(self): """ Run main function """ - items = main.main(datetime='2019-01-02', **{'collection': 'landsat-8-l1'}) + items = main(datetime='2019-07-01', **{'collection': 'landsat-8-l1'}) self.assertEqual(len(items), self.num_scenes) def test_main_found(self): """ Run main function """ - found = main.main(datetime='2019-01-02', found=True, **{'collection': 'landsat-8-l1'}) + found = main(datetime='2019-07-01', found=True, **{'collection': 'landsat-8-l1'}) self.assertEqual(found, self.num_scenes) def test_main_load(self): - items = main.main(items=os.path.join(testpath, 'scenes.geojson')) + items = main(items=os.path.join(testpath, 'scenes.geojson')) assert(len(items) == 2) def test_main_options(self): """ Test main program with output options """ fname = os.path.join(testpath, 'test_main-save.json') - items = main.main(datetime='2019-01-02', save=fname, printcal=True, printmd=[], property=['eo:platform=landsat-8']) + items = main(datetime='2019-07-01', save=fname, printcal=True, printmd=[], property=['eo:platform=landsat-8']) self.assertEqual(len(items), self.num_scenes) self.assertTrue(os.path.exists(fname)) os.remove(fname) @@ -84,19 +84,19 @@ def test_main_options(self): def test_cli(self): """ Run CLI program """ with patch.object(sys, 'argv', 'sat-search search --datetime 2017-01-01 --found -p eo:platform=landsat-8'.split(' ')): - main.cli() + cli() def test_cli_intersects(self): cmd = 'sat-search search --intersects %s -p eo:platform=landsat-8 --found' % os.path.join(testpath, 'aoi1.geojson') with patch.object(sys, 'argv', cmd.split(' ')): - main.cli() + cli() def test_main_download(self): """ Test main program with downloading """ with open(os.path.join(testpath, 'aoi1.geojson')) as f: aoi = json.dumps(json.load(f)) config.DATADIR = os.path.join(testpath, "${eo:platform}") - items = main.main(datetime='2017-01-05/2017-01-21', intersects=aoi, download=['thumbnail', 'MTL'], **{'collection': 'landsat-8-l1'}) + items = main(datetime='2019-06-05/2019-06-21', intersects=aoi, download=['thumbnail', 'MTL'], **{'collection': 'landsat-8-l1'}) for item in items: bname = os.path.splitext(item.get_filename(config.DATADIR))[0] assert(os.path.exists(bname + '_thumbnail.jpg')) diff --git a/test/test_search.py b/test/test_search.py index 28b1174..0cc61d8 100644 --- a/test/test_search.py +++ b/test/test_search.py @@ -53,19 +53,19 @@ def test_geo_search(self): """ Perform simple query """ with open(os.path.join(self.path, 'aoi1.geojson')) as f: aoi = json.dumps(json.load(f)) - search = Search(datetime='2018-09-25', intersects=aoi) - assert(search.found() == 2) + search = Search(datetime='2019-07-01', intersects=aoi) + assert(search.found() == 13) items = search.items() - assert(len(items) == 2) + assert(len(items) == 13) assert(isinstance(items[0], Item)) def test_search_sort(self): """ Perform search with sort """ with open(os.path.join(self.path, 'aoi1.geojson')) as f: aoi = json.dumps(json.load(f)) - search = Search.search(datetime='2018-01-01/2018-01-15', intersects=aoi, sort=[' Date: Fri, 20 Sep 2019 13:40:36 -0400 Subject: [PATCH 14/17] update version and changelog --- CHANGELOG.md | 6 ++++++ README.md | 5 ++--- satsearch/version.py | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 433de45..0ed5718 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [v0.2.2] - 2019-09-20 + ### Changed - Parser module now handles reading JSON from file +- sat-stac dependency bumped to 0.3.0 - tests updated +### Fixed +- Fixed issue with some comparison ops not being evaluated ## [v0.2.1] - 2019-02-14 @@ -39,6 +44,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. Initial Release [Unreleased]: https://github.com/sat-utils/sat-search/compare/master...develop +[v0.2.2]: https://github.com/sat-utils/sat-search/compare/0.2.1...v0.2.2 [v0.2.1]: https://github.com/sat-utils/sat-search/compare/0.2.0...v0.2.1 [v0.2.0]: https://github.com/sat-utils/sat-search/compare/0.1.0...v0.2.0 [v0.1.0]: https://github.com/sat-utils/sat-search/tree/0.1.0 diff --git a/README.md b/README.md index 6f46a92..8bb096e 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ $ pip install . ``` #### Versions -The latest version of sat-search is 0.3.0, which uses [STAC v0.7.0](https://github.com/radiantearth/stac-spec/tree/v0.7.0). To install other versions of sat-search, specify the version in the call to pip. +The latest version of sat-search is 0.2.2, which uses [STAC v0.7.0](https://github.com/radiantearth/stac-spec/tree/v0.7.0). To install other versions of sat-search, specify the version in the call to pip. ```bash pip install sat-search==0.2.0 @@ -33,8 +33,7 @@ The table below shows the corresponding versions between sat-search and STAC. Ad | sat-search | STAC | | -------- | ---- | | 0.1.x | 0.5.x - 0.6.x | -| 0.2.x | 0.5.x - 0.6.x | -| 0.3.x | 0.7.x | +| 0.2.x | 0.5.x - 0.7.x | ## Using sat-search diff --git a/satsearch/version.py b/satsearch/version.py index b36052c..020ed73 100644 --- a/satsearch/version.py +++ b/satsearch/version.py @@ -1 +1 @@ -__version__ = '0.3.0b1' +__version__ = '0.2.2' From 04acd6eade4fcd4c9c18c6e944294588f6550a20 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Fri, 20 Sep 2019 16:47:23 -0400 Subject: [PATCH 15/17] fix failing tests --- test/test_search.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_search.py b/test/test_search.py index ac82d16..7e6ac35 100644 --- a/test/test_search.py +++ b/test/test_search.py @@ -69,13 +69,13 @@ def test_search_sort(self): def test_get_items_by_id(self): """ Get Items by ID """ - ids = ['LC80340332018034LGN00', 'LC80340322018034LGN00'] + ids = ['LC81692212019263', 'LC81691102019263'] items = Search.items_by_id(ids, collection='landsat-8-l1') assert(len(items) == 2) def test_get_ids_search(self): """ Get Items by ID through normal search """ - ids = ['LC80340332018034LGN00', 'LC80340322018034LGN00'] + ids = ['LC81692212019263', 'LC81691102019263'] search = Search.search(ids=ids, collection='landsat-8-l1') items = search.items() assert(search.found() == 2) From 63d833d3bd5750b800bf86ca54b3986cd52cdd8a Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Sun, 22 Sep 2019 23:54:48 -0400 Subject: [PATCH 16/17] fix console script location --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c19f66e..9feb1c8 100755 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ ], keywords='', entry_points={ - 'console_scripts': ['sat-search=satsearch.main:cli'], + 'console_scripts': ['sat-search=satsearch.cli:cli'], }, packages=find_packages(exclude=['docs', 'tests*']), include_package_data=True, From 40f8c299397395659a404108b6fd7a8b2822cbc1 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Mon, 23 Sep 2019 00:01:23 -0400 Subject: [PATCH 17/17] pass in proper search dictionary to ItemCollection --- satsearch/search.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/satsearch/search.py b/satsearch/search.py index c2def02..46468ed 100644 --- a/satsearch/search.py +++ b/satsearch/search.py @@ -141,4 +141,8 @@ def items(self, limit=10000): # item = dict_merge(item, collections[item['properties']['collection']]) # _items.append(Item(item)) - return ItemCollection(items, collections=collections, search=self.kwargs) + search = { + 'endpoint': config.API_URL, + 'parameters': self.kwargs + } + return ItemCollection(items, collections=collections, search=search)