Metadata-Version: 2.4
Name: cropsar
Version: 2.0.0
Summary: Continuous vegetation monitoring through multi-source satellite data fusion
Author-email: Dieter Wens <dieter.wens@vito.be>, Kris Vanhoof <kris.vanhoof@vito.be>, Kristof Van Tricht <kristof.vantricht@vito.be>
Maintainer-email: Dieter Wens <dieter.wens@vito.be>
Project-URL: Source Code, https://git.vito.be/scm/appl/cropsar.git
Requires-Python: >=3.8
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: numpy>=1.23
Requires-Dist: pandas>=2.0
Requires-Dist: pyproj>=3.0
Requires-Dist: shapely>=2.0
Requires-Dist: xarray>=2023.1
Requires-Dist: geopandas>=0.13
Requires-Dist: requests>=2.32
Provides-Extra: inference-tensorflow
Requires-Dist: tensorflow<=2.20,>=2.12; extra == "inference-tensorflow"
Requires-Dist: keras<=3.14,>=2.12; extra == "inference-tensorflow"
Provides-Extra: inference-onnx
Requires-Dist: onnxruntime<=1.25.0,>=1.20; extra == "inference-onnx"
Provides-Extra: train
Requires-Dist: onnx<=1.21,>=1.17; extra == "train"
Requires-Dist: onnxruntime<=1.25.0,>=1.20; extra == "train"
Requires-Dist: tensorflow<=2.20,>=2.12; extra == "train"
Requires-Dist: keras<=3.14,>=2.12; extra == "train"
Requires-Dist: spark; extra == "train"
Provides-Extra: dev
Requires-Dist: onnx<=1.21,>=1.17; extra == "dev"
Requires-Dist: onnxruntime<=1.25.0,>=1.20; extra == "dev"
Requires-Dist: tensorflow<=2.20,>=2.12; extra == "dev"
Requires-Dist: keras<=3.14,>=2.12; extra == "dev"
Requires-Dist: spark; extra == "dev"
Requires-Dist: matplotlib; extra == "dev"
Dynamic: license-file

CropSAR
=======

.. contents::

Git
---

.. note:: On Windows use Git Bash to enter the following commands.


First make sure that git is properly configured on your system::

    $ git config --global user.name "<User Name>"
    $ git config --global user.email "<user.name@vito.be>"

Then use the following commands to clone the repository and set it as the
current working directory::

    $ git clone https://<username>@git.vito.be/scm/appl/cropsar.git
    $ cd cropsar

To update and show all available local and remote branch definitions::

    $ git fetch
    $ git branch -a

For development, switch to the current ``develop`` branch::

    $ git checkout develop

From now on you can commit any changes to your local repository::

    $ git add some_file.py
    $ git add another_file.py
    $ git commit -m 'some helpful message'

When your code is ready, push it back to the remote repository::

    $ git push -u origin develop

The ``-u`` option sets up tracking between the local and remote branch of the
same name.  It only needs to be specified once and can be ignored in future
push commands for that branch.


Git Flow
--------

For branching it is recommended to use a model like `Git Flow`.  Check the
following links for more information:

    - https://jeffkreeftmeijer.com/git-flow/
    - https://danielkummer.github.io/git-flow-cheatsheet/
    - https://gist.github.com/JamesMGreene/cdd0ac49f90c987e45ac#file-gitflow-breakdown-md

Git Flow is an extension to the standard Git commands, so you may have to
install `Git Flow` separately on your system.  Just check the output of::

    $ git flow

And if this doesn't fail, you're all set!  Otherwise use your system's
package manager to install it.  For example:

    - Redhat/Fedora/CentOS::

        $ sudo yum install gitflow

    - Ubuntu/Debian::

        $ sudo apt-get install git-flow

To enable the `Git Flow` commands for a repository::

    $ git flow init

Just accept the default configuration values.

To start working on a new feature::

    $ git flow feature start <my-feature>

Then ``add`` and ``commit`` your modifications as usual, and to finish up::

    $ git flow feature finish <my-feature>

This merges your feature branch into the ``develop`` branch.

Then simply ``push`` it back to the remote like you normally would.


Virtual Environment
-------------------

For development it is best to set up a virtual environment and install the
cropsar package in `editable` mode:

    - Linux:

        .. tip:: On Linux the ``rtree`` python package expects the 
           ``libspatialindex`` library to be available, so please 
           install it through your system's package manager.  For example:

           $ sudo yum install spatialindex
        
        Use the following commands to setup a virtual environment and install
        dependencies::

            $ cd cropsar
            $ python36 -m venv env
            $ . env/bin/activate
            (env) $ python -m pip install -U pip setuptools
            (env) $ python -m pip install -e .

        Note that in this case the most up to date dependencies are installed
        that are considered compatible with the cropsar package.  If you'd
        rather install a list of dependencies that is known to work and has
        been tested against you can set up the environment like this:

            $ cd cropsar
            $ python36 -m venv env
            $ . env/bin/activate
            (env) $ python -m pip install -U pip setuptools
            (env) $ python -m pip install -r requirements.txt
            (env) $ python -m pip install -e .

        To run the notebooks, you additionally need to install Jupyter:

            (env) $ python -m pip install jupyter

    - Windows:

        .. tip:: On Windows some packages fail to build properly if installed
           from `PyPI`, so it's best to install these using `.whl` files.
           (Download these from https://www.lfd.uci.edu/~gohlke/pythonlibs/
           for example). You can use the `requirements-<platform>.txt` files
           to install a downloaded version of the problematic packages.

        Use the following commands to setup a virtual environment and install
        dependencies (replace cp36-win_amd64 by your python version)::

            > cd cropsar
            > python -m venv env
            > env\Scripts\activate
            (env) > python -m pip install -U pip setuptools
            (env) > python -m pip install -r requirements-cp36m-win_amd64.txt
            (env) > python -m pip install pytest-runner pypandoc
            (env) > python -m pip install -e .

        Note that in this case the most up to date dependencies are installed
        that are considered compatible with the cropsar package.  If you'd
        rather install a list of dependencies that is known to work and has
        been tested against you can set up the environment like this:

            > cd cropsar
            > python -m venv env
            > env\Scripts\activate
            (env) > python -m pip install -U pip setuptools
            (env) > python -m pip install -r requirements-cp36m-win_amd64.txt
            (env) > python -m pip install pytest-runner pypandoc
            (env) > python -m pip install -r requirements.txt
            (env) > python -m pip install -e .

        To run the notebooks, you additionally need to install Jupyter:

            (env) > python -m pip install jupyter

Note that if you don't use a virtual environment and want to install
the ``cropsar`` module you can add the `--user` option:

    (env) $ python -m pip install --user -e .

This will install the package in your home directory.


Running Tests
-------------

The 'pytest' tool is used for running tests:

::

    (env) $ cd cropsar
    (env) $ pytest tests


Running Notebooks
-----------------

::

    (env) $ cd cropsar
    (env) $ jupyter notebook


Building Packages
-----------------

- Source Tarball::

    (env) $ cd cropsar
    (env) $ python setup.py sdist

- Egg::

    (env) $ cd cropsar
    (env) $ python setup.py bdist_egg

- Wheel::

    (env) $ cd cropsar
    (env) $ python setup.py bdist_wheel


Anaconda
--------

To set up an Anaconda environment and install the package in 'editable' mode::

    $ cd cropsar
    $ conda env create -f environment.yml
    $ conda activate cropsar
    $ python -m pip install --no-deps -e .

.. important:: We install the package using pip with option ``--no-deps``
    to prevent mixing conda and pip packages, so it is *crucial* that the
    ``environment.yml`` file lists all runtime dependencies!  The pip
    dependencies are listed in ``requirements.txt`` and ``setup.py``.

To run the unit tests without using ``setup.py``, do::

    $ python -m unittest


PyCharm
-------

- VCS > Checkout from Version Control> Git
- VCS > Git > Branches > origin/develop > Checkout As
- File > Settings > Project: cropsar
    - Project Interpreter: select the virtual env python (or add a new one)
    - Project Structure: mark `tests` as Sources
    - Project Structure: mark `experimental` as Sources
    - Project Structure: mark `notebooks` as Sources
- right-click `tests` and select `Run 'Unittests in tests'`
