Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Download plant spectra using ECOSIS API and species list

This jupyter notebook shows how to access ECOSIS API and retrieve data/create visualizations. The API documentation is provided here:http://cstars.github.io/ecosis/.

First, import python modules.

Plant latin names

The latin names of 2 plant species are provided in the CSV file plant_latin.csv.

Loading...

Search ECOSIS

We will search for ECOSIS database for the spectra data by their latin names.

A total of 26 datasets found for 65 species.

Get Statistics

The dataset_id above now contains the list of datasets that has one of the 65 species of interest.

Statistics endpoint /stats of the ECOSIS API gives sum, count, min, max, avg, variance and stddev of the dataset. We will now loop through all datasets and plot the average spectra value as well as its stddev as error bands and see if there are any anomalous datasets. Note that these dataset includes spectra from all species (not only 65 species from the csv file above).

<Figure size 1500x800 with 26 Axes>

In the figures above we see that three datasets (a12286ac-929f-4e3e-9b9c-517e10fe4087, 2408f75d-18a7-4915-8494-69afe50e0611, and b30cf76b-48d5-4953-9d89-8e298db1f985) have somewhat different looking spectra. These dataset likely have issues with them. Let’s remove these datasets from the dataset_id list.

A total of 23 datasets are left after removing poor-quality datasets.

Get dataset/spectra

Now, let’s retrieve all spectra in the first three datasets from the dataset_id list above. This step will probably take long time depending on number of spectra available within the datasets.

24 spectra found in the dataset 87fbbced-0ccb-4b4f-99d7-b3b4c81bc151
59 spectra found in the dataset 5cff97db-1e27-4f42-bf0e-dd787bc00bc9
168 spectra found in the dataset ecd277ba-0b09-4b88-aa2b-5bfbaa482af7

Now, let’s open the first three of the spectra CSV file we downloaded above into a pandas dataframe.

Loading...

Plot Spectra

Below, we plot spectra of the species.

<Figure size 1500x800 with 25 Axes>