Skip to content

Commit

Permalink
Merge pull request #32 from fabianazioti/r040
Browse files Browse the repository at this point in the history
moving cli.rst to docs and close #7
  • Loading branch information
gqueiroz committed Jan 7, 2021
2 parents 5f4ac17 + 675790e commit 9c95b79
Show file tree
Hide file tree
Showing 20 changed files with 691 additions and 162 deletions.
23 changes: 22 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,25 @@
Changes
=======

**Under Development!**
Version 0.4.0-0 (2021-01-07)
----------------------------

- Command Line Interface (CLI).

- Support for the `LCCS-WS specification version 0.4.0-0 <https://github.com/brazil-data-cube/lccs-ws-spec>`_.

- Documentation system based on Sphinx.

- Documentation integrated to ``Read the Docs``.

- Installation and build instructions.

- Package support through Setuptools.

- Installation and usage instructions.

- Travis CI support.

- Source code versioning based on `Semantic Versioning 2.0.0 <https://semver.org/>`_.

- License: `MIT <https://github.com/gqueiroz/wtss.py/blob/master/LICENSE>`_.
140 changes: 0 additions & 140 deletions CLI.rst

This file was deleted.

28 changes: 27 additions & 1 deletion INSTALL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,18 @@ Production installation
Development Installation - GitHub
---------------------------------

Clone the Software Repository
+++++++++++++++++++++++++++++

Clone the software repository:
Use ``git`` to clone the software repository:

.. code-block:: shell
$ git clone https://github.com/brazil-data-cube/lccs.py.git
Install lccs.py in Development Mode
+++++++++++++++++++++++++++++++++++

Go to the source code folder:

.. code-block:: shell
Expand All @@ -38,6 +43,27 @@ Install in development mode:
$ pip3 install -e .[all]
.. note::

If you want to create a new *Python Virtual Environment*, please, follow this instruction:

*1.* Create a new virtual environment linked to Python 3.7::

python3.7 -m venv venv


**2.** Activate the new environment::

source venv/bin/activate


**3.** Update pip and setuptools::

pip3 install --upgrade pip

pip3 install --upgrade setuptools


Run the Tests
+++++++++++++

Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ recursive-include docs *.py
recursive-include docs *.rst
recursive-include docs *.ico
recursive-include docs *.png
recursive-include docs *.json
recursive-include docs *.qml
recursive-include docs Makefile
recursive-include tests *.py
recursive-include tests *.json
Expand Down
5 changes: 0 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ Installation
See `INSTALL.rst <./INSTALL.rst>`_.


Using LCCS in the Command Line
==============================

See `CLI.rst <./CLI.rst>`_.

Developer Documentation
=======================

Expand Down
95 changes: 94 additions & 1 deletion docs/sphinx/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,97 @@
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.

.. include:: ../../CLI.rst
Running LCCS Client in the Command Line
=======================================

If you want to know the LCCS version, use the option ``--version`` as in::

lccs --version


Output::

lccs, version 0.4.0.post0


To list the available classification systems in a service, use the ``classification-systems`` command and provides a URL to the ``--url`` option::

lccs --url 'http://brazildatacube.dpi.inpe.br/dev/lccs/' classification-systems


The above command will return a list of classification system names as::

BDC
IBGE
PRODES
MapBiomas5

To get more information about a specific classification system, use the ``classification-systems-describe`` command::

lccs --url 'http://brazildatacube.dpi.inpe.br/dev/lccs/' classification-systems-describe --system_id 'PRODES'

Output::

- authority_name: Projeto de Mapeamento Anual da Cobertura e Uso do Solo no Brasil (MapBiomas)
- description: O Projeto de Mapeamento Anual da Cobertura e Uso do Solo do Brasil é uma iniciativa que envolve uma rede colaborativa com especialistas nos biomas, usos da terra, sensoriamento remoto, SIG e ciência da computação que utiliza processamento em nuvem e classificadores automatizados desenvolvidos e operados a partir da plataforma Google Earth Engine para gerar uma série histórica de mapas anuais de cobertura e uso da terra do Brasil.
- id: 32
- links: [{'href': 'http://brazildatacube.dpi.inpe.br/dev/lccs/classification_system', 'rel': 'parent', 'title': 'Link to this document', 'type': 'application/json'}, ..]
- name: Mapbiomas5
- version: 5


List the available classes of a classification system, use the ``classes`` command::

lccs --url 'http://brazildatacube.dpi.inpe.br/dev/lccs/' classes --system_id 'PRODES'

The above command will return a list of classes of PRODES as::

Desmatamento
Floresta
Hidrografia
Não Floresta
Nuvem
Resíduo

To get more information about a specific class, use the ``class-describe`` command::

lccs --url 'http://brazildatacube.dpi.inpe.br/dev/lccs/' class-describe --system_id 'PRODES' --class_id 'Desmatamento'

The above command will return a::

- class_parent: None
- classification_system_id: 4
- classification_system_name: PRODES
- code: DESMATAMENTO
- description:
- id: 1
- links: [[{'href': 'http://brazildatacube.dpi.inpe.br/dev/lccs/classification_system/PRODES/classes/Desmatamento', 'rel': 'self', 'title': 'Link to this document', 'type': 'application/json'},...]
- name: Desmatamento


Retrieve all available classification system mappings, use the ``available-mappings`` command::

lccs --url 'http://brazildatacube.dpi.inpe.br/dev/lccs/' available-mappings --system_id_source 'TerraClass_AMZ'

The above command will return a list of classification systems as::

PRODES


To get a mapping between classification systems, use the ``mappings`` command::

lccs --url 'http://brazildatacube.dpi.inpe.br/dev/lccs/' mappings --system_id_source 'TerraClass_AMZ' --system_id_target 'PRODES'


Output::

Classification Source: TerraClass_AMZ
Classification Target: PRODES
{'degree_of_similarity': 1.0, 'description': '', 'links': [{'href': 'http://brazildatacube.dpi.inpe.br/dev/lccs/classification_system/TerraClass_AMZ/classes/Agricultura Anual', 'rel': 'item', 'title': 'Link to the source class', 'type': 'application/json'}, {'href': 'http://brazildatacube.dpi.inpe.br/dev/lccs/classification_system/TerraClass_AMZ/classes/Desmatamento', 'rel': 'item', 'title': 'Link to target class', 'type': 'application/json'}], 'source': 'Agricultura Anual', 'source_id': 85, 'target': 'Desmatamento', 'target_id': 175}
{'degree_of_similarity': 1.0, 'description': '', 'links': [{'href': 'http://brazildatacube.dpi.inpe.br/dev/lccs/classification_system/TerraClass_AMZ/classes/Área Não Observada', 'rel': 'item', 'title': 'Link to the source class', 'type': 'application/json'}, {'href': 'http://brazildatacube.dpi.inpe.br/dev/lccs/classification_system/TerraClass_AMZ/classes/Nuvem', 'rel': 'item', 'title': 'Link to target class', 'type': 'application/json'}], 'source': 'Área Não Observada', 'source_id': 86, 'target': 'Nuvem', 'target_id': 179}

.. note::

For more information, type in the command line::

lccs --help
2 changes: 1 addition & 1 deletion examples/class_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from lccs import LCCS

# Change to the LCCS-WS URL you want to use.
service = LCCS("http://0.0.0.0:5000/")
service = LCCS("http://brazildatacube.dpi.inpe.br/dev/lccs/")

# Get a specific classification system
# Make sure the classification system is available in service
Expand Down
2 changes: 1 addition & 1 deletion examples/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from lccs import LCCS

# Change to the LCCS-WS URL you want to use.
service = LCCS("http://0.0.0.0:5000/")
service = LCCS("http://brazildatacube.dpi.inpe.br/dev/lccs/")

# Get a specific classification system
# Make sure the classification system is available in service
Expand Down
2 changes: 1 addition & 1 deletion examples/classification_system_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from lccs import LCCS

# Change to the LCCS-WS URL you want to use.
service = LCCS("http://0.0.0.0:5000/")
service = LCCS("http://brazildatacube.dpi.inpe.br/dev/lccs/")

# Return the metadata of a specific classification system
# Make sure the classification system is available in service
Expand Down
2 changes: 1 addition & 1 deletion examples/classification_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from lccs import LCCS

# Change to the LCCS-WS URL you want to use.
service = LCCS("http://0.0.0.0:5000/")
service = LCCS("http://brazildatacube.dpi.inpe.br/dev/lccs/")

# Returns the list of classification system available on the service
print(service.classification_systems)
Loading

0 comments on commit 9c95b79

Please sign in to comment.