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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bioma_modelling-0.0.5.tar.gz.
File metadata
- Download URL: bioma_modelling-0.0.5.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fec1d03e3fece8d3555be439a1bf8f552bb7244c46712ed4ff7b41f0a0719b4
|
|
| MD5 |
d354d6880616f4d92f75d38b7e889d4e
|
|
| BLAKE2b-256 |
267f1dcefd5eebd372181ef39674aa50af0ebdef3fc9e3bfbe57a451122008cc
|
File details
Details for the file bioma_modelling-0.0.5-py3-none-any.whl.
File metadata
- Download URL: bioma_modelling-0.0.5-py3-none-any.whl
- Upload date:
- Size: 15.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab21a2ef7af04f408323e8ca78733d33bc3fa3aa9b02e41170d38c3685b02e77
|
|
| MD5 |
cf055a6c5daf3e1aa9f1cd773064dcf6
|
|
| BLAKE2b-256 |
557664a4c3ff1067a1f97615e4883f273c96e51af137189d3bfd84978d369faa
|