Skip to content

Commit

Permalink
Merge pull request #77 from fabianazioti/0.9.1
Browse files Browse the repository at this point in the history
adding version in changes 📇
  • Loading branch information
raphaelrpl authored Mar 23, 2022
2 parents 7719462 + 5c79ecd commit eac8e91
Show file tree
Hide file tree
Showing 14 changed files with 260 additions and 142 deletions.
9 changes: 9 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
Changes
=======

Version 0.9.1 (2022-03-23)
--------------------------

- Remove OWSLib package (`#71 <https://github.com/brazil-data-cube/wlts/issues/71>`_).
- Bug fix: cannot import name 'soft_unicode' from 'markupsafe' (`#70 <https://github.com/brazil-data-cube/wlts/issues/70>`_).
- Add the title information in collection (`#69 <https://github.com/brazil-data-cube/wlts/issues/69>`_).
- Refactor the organization of datasets (`#72 <https://github.com/brazil-data-cube/wlts/issues/72>`_).
- Remove mandatory BDC Auth access token in operations (`#74 <https://github.com/brazil-data-cube/wlts/issues/74>`_).

Version 0.9.0 (2021-12-08)
--------------------------

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
'shapely>=1.6',
'jsonschema>=3.2',
'pyproj>=2',
'OWSLib==0.21.0',
'MarkupSafe==2.0.1',
'rasterio>=1.1.2,<2',
'bdc-auth-client @ git+https://github.com/brazil-data-cube/bdc-auth-client@v0.2.3',
]
Expand Down
69 changes: 43 additions & 26 deletions wlts/collections/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
class Collection(metaclass=ABCMeta):
"""Abstract class to represent an collection."""

def __init__(self, name, authority_name, description, detail, datasource_id, dataset_type,
def __init__(self, name, title, authority_name, description, detail, datasource_id, dataset_type,
classification_class, temporal, scala, spatial_extent, period, is_public, deprecated):
"""Create Collection."""
self.name = name
self.title = title
self.authority_name = authority_name
self.description = description
self.detail = detail
Expand Down Expand Up @@ -56,11 +57,13 @@ def create_classification_system(classification_class):
args['property_name'] = None
args['class_property_name'] = None
args['class_property_value'] = None
args['workspace'] = None

else:
args['property_name'] = classification_class["property_name"]
args['class_property_name'] = classification_class["class_property_name"]
args['class_property_value'] = classification_class["class_property_value"]
args['workspace'] = classification_class["workspace"]

return ClassificationSystemClass(**args)

Expand Down Expand Up @@ -131,56 +134,70 @@ def __init__(self, **kwargs):
invalid_parameters = set(kwargs) - {"type", "datasource_id", "property_name", "class_property_name",
"class_property_value", 'class_property_id', 'classification_system_name',
'classification_system_id', 'classification_system_version',
'class_property_id'}
'class_property_id', 'workspace'}

if invalid_parameters:
raise AttributeError('invalid parameter(s): {}'.format(invalid_parameters))

self.type = kwargs['type']
self._type = kwargs['type']

self.property_name = kwargs['property_name']
self.class_property_name = kwargs['class_property_name']
self.class_property_value = kwargs['class_property_value']
self.class_property_id = kwargs['class_property_id']
self._property_name = kwargs['property_name']
self._class_property_name = kwargs['class_property_name']
self._class_property_value = kwargs['class_property_value']
self._class_property_id = kwargs['class_property_id']
self._workspace = kwargs['workspace']

self.classification_system_version = kwargs['classification_system_version']
self.classification_system_name = kwargs['classification_system_name']
self.classification_system_id = kwargs['classification_system_id']
self._classification_system_version = kwargs['classification_system_version']
self._classification_system_name = kwargs['classification_system_name']
self._classification_system_id = kwargs['classification_system_id']

self.datasource = datasource_manager.get_datasource(kwargs['datasource_id'])

def get_type(self):
@property
def type(self):
"""Return classification system type based on WLTS model."""
return self.type
return self._type

def get_property_name(self):
@property
def property_name(self):
"""Return classification system property name."""
return self.property_name
return self._property_name

def get_class_property_value(self):
@property
def class_property_value(self):
"""Return classification system property value."""
return self.class_property_value
return self._class_property_value

def get_class_property_name(self):
@property
def class_property_name(self):
"""Return classification system property class name."""
return self.class_property_name
return self._class_property_name

def get_class_property_id(self):
@property
def class_property_id(self):
"""Return classification system property class id."""
return self.class_property_id
return self._class_property_id

def get_class_ds(self):
"""Return classification system datasource."""
return self.datasource

def get_classification_system_version(self):
@property
def classification_system_version(self):
"""Return classification system name."""
return self.classification_system_version
return self._classification_system_version

def get_classification_system_name(self):
@property
def classification_system_name(self):
"""Return classification system name."""
return self.classification_system_name
return self._classification_system_name

def get_classification_system_id(self):
@property
def classification_system_id(self):
"""Return classification system id."""
return self.classification_system_id
return self._classification_system_id

@property
def workspace(self):
"""Return workspace system id."""
return self._workspace
4 changes: 2 additions & 2 deletions wlts/collections/collection_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ def make(cls, collection_type, collections_info):
Returns:
collection: A collection object.
"""
datasource = eval(cls._factories[collection_type])(collections_info)
collection = eval(cls._factories[collection_type])(collections_info)

return datasource
return collection


class CollectionManager:
Expand Down
2 changes: 1 addition & 1 deletion wlts/collections/feature_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def __init__(self, collections_info):
collections_info (dict): The collection information.
"""
super().__init__(collections_info["name"],
collections_info["title"],
collections_info["authority_name"],
collections_info["description"],
collections_info["detail"],
Expand Down Expand Up @@ -58,7 +59,6 @@ def trajectory(self, tj_attr, x, y, start_date, end_date, geometry):
ds = self.datasource

for obs in self.observations_properties:

args = {
"temporal": self.temporal,
"x": x,
Expand Down
13 changes: 13 additions & 0 deletions wlts/collections/image_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def __init__(self, collections_info):
collections_info (dict): The collection information.
"""
super().__init__(collections_info["name"],
collections_info["title"],
collections_info["authority_name"],
collections_info["description"],
collections_info["detail"],
Expand All @@ -37,6 +38,17 @@ def __init__(self, collections_info):
self.observations_properties = collections_info["attributes_properties"]
self.timeline = collections_info["timeline"]

self.validade_collection()

def validade_collection(self) -> None:
"""Verify if collection exist in datasource."""
ds = self.get_datasource()

for att in self.observations_properties:
ds.check_image(workspace=att["workspace"], ft_name=att["image"])

return

def collection_type(self):
"""Return the collection type."""
return "Image"
Expand All @@ -62,6 +74,7 @@ def trajectory(self, tj_attr, x, y, start_date, end_date, geometry):
args = {
"image": att["image"],
"temporal": self.temporal,
"workspace": att["workspace"],
"x": x,
"y": y,
"grid": self.grid,
Expand Down
9 changes: 5 additions & 4 deletions wlts/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,14 @@ def describe_collection(cls, collection_name, roles=None):
describe = dict()

describe["classification_system"] = {
"type": classification_system.get_type(),
"classification_system_name": classification_system.get_classification_system_name(),
"classification_system_id": classification_system.get_classification_system_id(),
"classification_system_version": classification_system.get_classification_system_version()
"type": classification_system.type,
"classification_system_name": classification_system.classification_system_name,
"classification_system_id": classification_system.classification_system_id,
"classification_system_version": classification_system.classification_system_version
}

describe["name"] = collection.name
describe["title"] = collection.title
describe["description"] = collection.description
describe["detail"] = collection.detail
describe["is_public"] = collection.is_public
Expand Down
Loading

0 comments on commit eac8e91

Please sign in to comment.