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.3.tar.gz (11.8 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.3-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bioma_modelling-0.0.3.tar.gz
  • Upload date:
  • Size: 11.8 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.3.tar.gz
Algorithm Hash digest
SHA256 4b200408131f250ff479f120b4365f62185e1b8814e2be1a8ca39dbf2f0057d9
MD5 47a299d3dbd50d5879cae3433eb5981a
BLAKE2b-256 5ad32f8f8e2b137cbd57afc39702a7c02edb417ee9f60c1011e278a04e7c894e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bioma_modelling-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 08234f0652e0a8b0c9efe71b21c7a72960eaf87b7ef5fd53dd0a8a66a82f7535
MD5 8789e3eae03c52944a2a0477d45a23a3
BLAKE2b-256 c1f19c9ab6d867d8562c1f0c67c3e01b124a9b4d686ea2417708981b7b1a6fa5

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