def test_lccs(self, requests_mock): requests_mock.get(match_url, json=dict(lccs_version='0.6.0', links=list()), status_code=200, headers={'content-type': 'application/json'}) self._setup_lccs(requests_mock, list(), list()) service = lccs.LCCS(url) assert service.url == url assert repr(service) == 'lccs("{}")'.format(url) assert str(service) == '<LCCS [{}]>'.format(url)
def test_classification_systems(self, lccs_object, requests_mock): for k in lccs_object: self._setup_lccs( requests_mock, json_systems=lccs_object[k]['classification_systems.json'], json_class=lccs_object[k]['classes.json']) service = lccs.LCCS(url, True) response = service.classification_systems assert response == ['PRODES-1.0']
def teste_mappings(self, lccs_object, requests_mock): for k in lccs_object: service = lccs.LCCS(url, True) requests_mock.get(match_url, json=lccs_object[k]['mappings.json'], status_code=200, headers={'content-type': 'application/json'}) available_mappings = service.available_mappings( system_id_source='TerraClass_AMZ') assert list(available_mappings) == ['PRODES']
def test_classification_systems(self, lccs_object, requests_mock): for k in lccs_object: service = lccs.LCCS(url, True) requests_mock.get( match_url, json=lccs_object[k]['classification_systems.json'], status_code=200, headers={'content-type': 'application/json'}) response = service.classification_systems assert list(response) == ['PRODES']
def test_classification_system(self, lccs_object, requests_mock): for k in lccs_object: self._setup_lccs( requests_mock, json_systems=lccs_object[k]['classification_systems.json'], json_class=lccs_object[k]['classes.json'], json_system=lccs_object[k]['classification_system.json']) service = lccs.LCCS(url, True) class_system = service.classification_system('PRODES-1.0') assert class_system.id assert class_system.name assert class_system.description assert class_system.version assert class_system.links[0].href assert class_system.links[0].rel
def test_classification_system(self, lccs_object, requests_mock): for k in lccs_object: service = lccs.LCCS(url, True) requests_mock.get( match_url, json=lccs_object[k]['classification_system.json'], status_code=200, headers={'content-type': 'application/json'}) class_system = service.classification_system(system_id='PRODES') assert class_system == lccs_object[k]['classification_system.json'] assert class_system.id assert class_system.name assert class_system.description assert class_system.version assert class_system.links[0].href assert class_system.links[0].rel
def teste_mapping(self, lccs_object, requests_mock): for k in lccs_object: service = lccs.LCCS(url, True) requests_mock.get(match_url, json=lccs_object[k]['mapping.json'], status_code=200, headers={'content-type': 'application/json'}) mp = service.mappings(system_id_source='TerraClass_AMZ', system_id_target='PRODES') assert 'TerraClass_AMZ' == mp.source_classification_system assert 'PRODES' == mp.target_classification_system assert 'degree_of_similarity' in mp.mapping[0] assert 'description' in mp.mapping[0] assert 'links' in mp.mapping[0] assert 'source' in mp.mapping[0] assert 'source_id' in mp.mapping[0] assert 'target' in mp.mapping[0] assert 'target_id' in mp.mapping[0]
# Copyright (C) 2020 INPE. # # Python Client Library for the LCCS Web Service is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. # """LCCS Python Client examples.""" import os import lccs print(lccs.__version__) url = os.environ.get('LCCS_SERVER_URL', 'https://brazildatacube.dpi.inpe.br/dev/lccs/') service = lccs.LCCS('http://127.0.0.1:5000/') print("Return all classificaton systems available in service") print(service.classification_systems) # The examples presented in this code vary depending on the database used. Check the parameters informed. # Return a specific classification system class_system = service.classification_system('PRODES-1.0') print(class_system.description) print(class_system.name) # Return a classes of a classification system classes = class_system.classes for i in classes: print(i.name)
def test_lccs(self): service = lccs.LCCS(url) assert service.url == url assert repr(service) == 'lccs("{}")'.format(url) assert str(service) == '<LCCS [{}]>'.format(url)
# This file is part of Python Client Library for the LCCS Web Service. # Copyright (C) 2020 INPE. # # Python Client Library for the LCCS Web Service is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. # """LCCS Python Client examples.""" import os import lccs print(lccs.__version__) server_url = os.environ.get('LCCS_SERVER_URL', 'https://brazildatacube.dpi.inpe.br/lccs/') service = lccs.LCCS(server_url) print("Return all classification systems available in service") print(service.classification_systems) # The examples presented in this code vary depending on the database used. Check the parameters informed. # Return a specific classification system class_system = service.classification_system('PRODES-1.0') print(class_system.description) print(class_system.name) # Return a classes of a classification system classes = class_system.classes for i in classes: print(i.name)