/api-examples

Repository of sample scripts with which one consumes data from Agrimetrics' Data Platform

Primary LanguageJupyter NotebookMIT LicenseMIT

Agrimetrics API Examples

This repository contains some examples of how to call Agrimetrics' APIs. Some examples have been developed in Python and others in R.

Pre-requisites:

  • Python 3.6+
  • a valid Field Explorer subscription key must be obtained and set in your environment as API_KEY.
  • Jupyter Lab (R 3.6.3+)

To obtain your subscription key:

Python scripts

To setup your python environment, install the dependencies using the requirements.txt file found in each subdirectory:

$ pip install -r requirements.txt

Alternatively, you can use pipenv:

$ pipenv install

R Notebooks

The notebooks can be run within a Jupyter Notebook server; this can be a server run locally (within a docker container or native) or in the cloud.

Running locally within your native operating system:

$ jupyter notebook

Example directories

This repository has four main directories of examples and tutorials.

Field Explorer Examples

Examples of how to use Python to access Agrimetrics' REST APIs. These provide weather, crop and soil information attributed to individual fields.

Geospatial Workflow Examples

Notebooks demonstrating how to use Agrimetrics' GraphQL API using R. The examples demonstrate how to access static and timeseries geospatial datasets available through the API.

GraphQL Examples

Examples and tutorials of how to use Agrimetrics' GraphQL API. This API provides access to all of our queryable data, including premium data such as field boundaries and satellite observations of fields (Verde data -- see below).

SAR Examples

A notebook demonstrating how to train a crop growth model to SAR data.

Verde Examples

Examples and tutorials of how to use Agrimetrics' GraphQL API to access Verde data. This is our premium data set containing crop measurements derived from satellite observations of the UK.

Further Reading

  • Agrimetrics Developer Portal - full API documentation
  • GeoJSON - GeoJSON specification
  • JSON-LD - JSON-LD specification
  • Pandas - Python Data Analysis Library used by these examples
  • matplotlib - Python 2D plotting library used by these examples
  • GraphQL - GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data.
  • pipenv - Pipenv is a dependency manager for Python projects. If you’re familiar with Node.js’ npm or Ruby’s bundler, it is similar in spirit to those tools.
  • Jupyter lab