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

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.1.tar.gz (11.5 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.1-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file bioma-modelling-0.0.1.tar.gz.

File metadata

  • Download URL: bioma-modelling-0.0.1.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for bioma-modelling-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c6a4035760a255986ef0f7716ebda9a49a9c9dd1ed5495cc942a3ab66e08fdd3
MD5 425f9d8f9e48d3b38d883ff3eb215498
BLAKE2b-256 a94d0ab7214a7dcc2112613627979536407356d1cfa7d08e353c295e976098d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bioma_modelling-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c652ae00dc9bdff5ce99d70e68f8208946eeb60cddb0685685f7d517e6bccc6c
MD5 4211803661b38ae907338b188b2ff3f1
BLAKE2b-256 cdeae37cdf40bbd3b322333f9cb385266718000c260b8c15550beb97ffcf1d72

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