Giter Club home page Giter Club logo

geoengine-python's Introduction

Geo Engine Python Package

CI

This package allows easy access to Geo Engine functionality from Python environments.

Test

Create a virtual environment

Create a virtual environment (e.g., python3 -m venv env).

# create new venv
python3 -m venv env
# activate new venv
source env/bin/activate

Re-create virtual environment

# go out of old venv
deactivate
# delete oldv env
rm -r env
# create new venv
python3 -m venv env
# activate new venv
source env/bin/activate

Install dependencies

Then, install the dependencies with:

python3 -m pip install -e .
python3 -m pip install -e .[test]

Run tests

Run tests with:

pytest

Dependencies

Since we use cartopy, you need to have the following system dependencies installed.

  • GEOS
  • PROJ

For Ubuntu, you can use this command:

sudo apt-get install libgeos-dev libproj-dev

Build

You can build the package with:

python3 -m pip install -e .[dev]
python3 -m build

Formatting

This package is formatted according to pycodestyle. You can check it by calling:

python3 -m pycodestyle

Our tip is to install autopep8 and use it to format the code.

Lints

Our CI automatically checks for lint errors. We use pylint to check the code. You can check it by calling:

python3 -m pylint geoengine
python3 -m pylint tests

Our tip is to activate linting with pylint in your IDE.

Type Checking

Our CI automatically checks for typing errors. We use mypy to check the code. You can check it by calling:

python3 -m mypy geoengine
python3 -m mypy tests

Using the config file mypy.ini, you can suppress missing stub errors for external libraries. You can ignore a library by adding two lines to the config file. For example, suppressing matplotlib would look like this:

[mypy-matplotlib.*]
ignore_missing_imports = True

If there are typing-stubs packages you can install using pip, you can use these packages instead of ignoring the reported errors. To find out, which packages could be installed you can use the following command:

python3 -m mypy geoengine --install-types
python3 -m mypy tests --install-types

Keep in mind, that you need to add the missing stubs by extending the dependencies in setup.cfg or ignoring them with mypy.ini.

Our tip is to activate type checking with mypy in your IDE.

Documentation

Generate documentation HTML with:

pdoc3 --html --output-dir docs geoengine

Examples

There are several examples in the examples folder. It is necessary to install the dependencies with:

python3 -m pip install -e .[examples]

XGBoost

If you wish to run the XGBoost notebook, you need the XGBoost library dmlc/xgboost available on your system. Using the geo engine backend with xgboost feature will provide the library. See XGBoost: Installation for installation instructions otherwise.

Distribute to PyPI

Test-PyPI

python3 -m build
python3 -m twine upload --repository testpypi dist/*

PyPI

python3 -m build
python3 -m twine upload --repository pypi dist/*

Try it out

Start a python terminal and try it out:

import geoengine as ge
from datetime import datetime

ge.initialize("https://nightly.peter.geoengine.io/api")

time = datetime.strptime('2014-04-01T12:00:00.000Z', "%Y-%m-%dT%H:%M:%S.%f%z")

workflow = ge.workflow_by_id('4cdf1ffe-cb67-5de2-a1f3-3357ae0112bd')

print(workflow.get_result_descriptor())

workflow.get_dataframe(ge.Bbox([-60.0, 5.0, 61.0, 6.0], [time, time]))

Authentication

If the Geo Engine server requires authentication, you can set your credentials in the following ways:

  1. in the initialize method: ge.initialize("https://nightly.peter.geoengine.io/api", ("email", "password"))
  2. as environment variables export GEOENGINE_EMAIL="email" and export GEOENGINE_PASSWORD="password"
  3. in a .env file in the current working directory with the content:
GEOENGINE_EMAIL="email"
GEOENGINE_PASSWORD="password"

geoengine-python's People

Contributors

1lutz avatar bors[bot] avatar christianbeilschmidt avatar dbrandenstein avatar dependabot[bot] avatar glombiewski avatar jdroenner avatar marweumr avatar michaelmattig avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.