diff --git a/CHANGELOG.md b/CHANGELOG.md index 29f1f0a..147c6c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [v0.1.3] - 2019-05-04 + +### Added +- Items.search_geometry() function added to return search geometry +- Extension of `Item` files can now be specified in `Item.get_filename()`. Defaults to `item.json`. +- Specify STAC version by setting SATUTILS_STAC_VERSION environment variable. Currently defaults to '0.6.2'. + +### Changed +- Items objects no longer require a Collection for every Item + ## [v0.1.2] - 2019-02-14 ### Added @@ -30,6 +40,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. Initial Release [Unreleased]: https://github.com/sat-utils/sat-stac/compare/master...develop +[v0.1.3]: https://github.com/sat-utils/sat-stac/compare/0.1.2...v0.1.3 [v0.1.2]: https://github.com/sat-utils/sat-stac/compare/0.1.1...v0.1.2 [v0.1.1]: https://github.com/sat-utils/sat-stac/compare/0.1.0...v0.1.1 [v0.1.0]: https://github.com/sat-utils/sat-stac/tree/0.1.0 diff --git a/README.md b/README.md index 1a899e6..2da4ccb 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ $ pip install . #### Versions -The latest version of sat-stac is 0.1.1, which uses the STAC spec v0.6.0. To install other versions of sat-stac, install the matching version of sat-stac. +To install a specific versions of sat-stac, install the matching version of sat-stac. ```bash pip install sat-stac==0.1.0 @@ -40,7 +40,7 @@ The table below shows the corresponding versions between sat-stac and STAC: | sat-stac | STAC | | -------- | ---- | -| 0.1.x | 0.6.0 | +| 0.1.x | 0.6.x | ## Tutorials diff --git a/satstac/catalog.py b/satstac/catalog.py index b9fd6b2..011c474 100644 --- a/satstac/catalog.py +++ b/satstac/catalog.py @@ -3,9 +3,7 @@ from .version import __version__ from .thing import Thing, STACError - - -STAC_VERSION='0.6.0' +from .config import STAC_VERSION class Catalog(Thing): diff --git a/satstac/config.py b/satstac/config.py new file mode 100644 index 0000000..8bac768 --- /dev/null +++ b/satstac/config.py @@ -0,0 +1,4 @@ +import os + +STAC_VERSION = os.getenv('SATUTILS_STAC_VERSION', '0.6.2') + diff --git a/satstac/item.py b/satstac/item.py index 672d806..96753dd 100644 --- a/satstac/item.py +++ b/satstac/item.py @@ -102,11 +102,11 @@ def asset(self, key): logging.warning('No such asset (%s)' % key) return None - def get_filename(self, path='', filename='${id}'): + def get_filename(self, path='', filename='${id}', extension='.json'): """ Get complete path with filename to this item """ return os.path.join( self.substitute(path), - self.substitute(filename) + '.json' + self.substitute(filename) + extension ) def substitute(self, string): diff --git a/satstac/items.py b/satstac/items.py index 79e60ad..b0d4c1e 100644 --- a/satstac/items.py +++ b/satstac/items.py @@ -16,7 +16,9 @@ def __init__(self, items, collections=[], search={}): # link Items to their Collections cols = {c.id: c for c in self._collections} for i in self._items: - i._collection = cols[i['collection']] + if 'collection' in i.properties: + if i['collection'] in cols: + i._collection = cols[i['collection']] @classmethod def load(cls, filename): @@ -65,6 +67,12 @@ def center(self): else: return None + def search_geometry(self): + if 'intersects' in self._search: + return self._search['intersects'] + else: + return None + def properties(self, key, date=None): """ Set of values for 'key' property in Items, for specific date if provided """ if date is None: diff --git a/satstac/version.py b/satstac/version.py index 10939f0..8ce9b36 100644 --- a/satstac/version.py +++ b/satstac/version.py @@ -1 +1 @@ -__version__ = '0.1.2' +__version__ = '0.1.3'