Skip to main content

Python library to streamline interaction with the BioMA APIs, providing a pythonic facade to data and service access.

Project description

The BioMA services toolkit for Python Notebooks and beyond

PyPI - DownloadsPepy Total Downloads

You can get BioMA and code your own models in C# or you can use the online ready-made ones hosted by AnaEE and CREA, needless to say, if you are not planning to re-invent the wheel, but you just need some quick simulation, the second option is the most straightpforard, as it removes the need for a local installation, i.e. you don't need to download, install, and configure any additional software.

What does this do?

Why should I use it?

Because it wraps the BioMA web APIs in a pythonic way, sparing you the hassle of writing a lot of network code.

Setup

To use the online services, you will need an API key, which is free, but you'll have to register either here or here to get one.

Then you need to install this package into your local environment with:

pip install bioma-modelling

The BioMAtools package expects a service key to work, each BioMA cloud distribution allows you to register a personal key, currently public accessible instances are hosted by AnaEE and CREA.

By default, the package exptects you to store the key in a environmental varliable named BIOMA_API_KEY, however, you can hard code it into the ModelClient object instantiation and/or tell it to read it from a different environmental variable of your choice.

You can, of course, avoid defining an actual environmental variable by using tools such as dotenv.

Quickstart

The ModelClient client object allows you to communicate with the BioMA Cloud instance, to create it, just pass it the base address of your BioMA instance of choice.

from biomatools.clients import ModelClient

client = ModelClient('https://api.progettoagridigit.it/model/v1/')

The client allows you to interact with the BioMA cloud instance and to interactively build your model run request. See the attached notebooks for working examples.

Run a model

Once you are happy with your model configuration, you can load it into the client like this:

client.add_model_run('test', model_run)

You can load as many as you like, as long as you assign them different labels, then you can run them all with the run_all method or one by one with the run method that expects the label of the model configuration you'd like to run.

result = client.run('test')

The returned object can easily be transformed into a data frame.

result.get_data_table('weather').to_df()

Acknowledgements

This project is funded by the Agro-Serv project. The project received funding from the European Union under grant agreement No 101058020.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bioma_modelling-0.0.4.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bioma_modelling-0.0.4-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file bioma_modelling-0.0.4.tar.gz.

File metadata

  • Download URL: bioma_modelling-0.0.4.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for bioma_modelling-0.0.4.tar.gz
Algorithm Hash digest
SHA256 c8184489b1a0719d4c4efab9c2b5fb55f9ca04b1a5a4cc80c3b5c5f9f17b7494
MD5 3406a2006e8d7f408b9ea4963f3da543
BLAKE2b-256 3b047d07e0ec08015dc79a069bd5c22bbf6ba30bb1be6cbdf0b5b6f76f1bbd72

See more details on using hashes here.

File details

Details for the file bioma_modelling-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for bioma_modelling-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 20116e9671d9cbcef65a8167bdf6ee1c14d40df81e855e7d3e1b11d004be868b
MD5 fd1b9316f60a8d049de7b46f8610a6d8
BLAKE2b-256 b48b54d4aebb1c7562350de44126c860bee82ddc68e298bee7c7e0f5f6b7a214

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page