diff --git a/.binder/environment-python_and_r.yml b/.binder/environment-python_and_r.yml index 7f5f2080..f34727b7 100644 --- a/.binder/environment-python_and_r.yml +++ b/.binder/environment-python_and_r.yml @@ -87,5 +87,6 @@ dependencies: - r-reshape2 - r-robis>=2.3.9 - r-sp + - r-tidyverse - r-xtractomatic - r-xts diff --git a/jupyterbook/content/code_gallery/data_access_notebooks/2023-05-03-SCCOOS-HABs.ipynb b/jupyterbook/content/code_gallery/data_access_notebooks/2023-05-03-SCCOOS-HABs.ipynb new file mode 100644 index 00000000..99767d47 --- /dev/null +++ b/jupyterbook/content/code_gallery/data_access_notebooks/2023-05-03-SCCOOS-HABs.ipynb @@ -0,0 +1,1085 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "how this data contribution expands the OBIS holdings\n", + "\n", + "- picking a species from SCCOOS, then pulling all the data for that species from OBIS\n", + "- plotting it all together with SCCOOS on a timeslider." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Load library's" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "-- \u001b[1mAttaching packages\u001b[22m ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- tidyverse 1.3.2 --\n", + "\u001b[32mv\u001b[39m \u001b[34mggplot2\u001b[39m 3.4.0 \u001b[32mv\u001b[39m \u001b[34mpurrr \u001b[39m 1.0.1\n", + "\u001b[32mv\u001b[39m \u001b[34mtibble \u001b[39m 3.2.1 \u001b[32mv\u001b[39m \u001b[34mdplyr \u001b[39m 1.1.1\n", + "\u001b[32mv\u001b[39m \u001b[34mtidyr \u001b[39m 1.3.0 \u001b[32mv\u001b[39m \u001b[34mstringr\u001b[39m 1.5.0\n", + "\u001b[32mv\u001b[39m \u001b[34mreadr \u001b[39m 2.1.4 \u001b[32mv\u001b[39m \u001b[34mforcats\u001b[39m 1.0.0\n", + "-- \u001b[1mConflicts\u001b[22m -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- tidyverse_conflicts() --\n", + "\u001b[31mx\u001b[39m \u001b[34mdplyr\u001b[39m::\u001b[32mfilter()\u001b[39m masks \u001b[34mstats\u001b[39m::filter()\n", + "\u001b[31mx\u001b[39m \u001b[34mdplyr\u001b[39m::\u001b[32mlag()\u001b[39m masks \u001b[34mstats\u001b[39m::lag()\n" + ] + } + ], + "source": [ + "library(robis)\n", + "library(leaflet)\n", + "library(tidyverse)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Get the SCCOOS data from OBIS" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Retrieved 5000 records of approximately 11724 (42%)\n", + "Retrieved 10000 records of approximately 11724 (85%)\n", + "Retrieved 11724 records of approximately 11724 (100%)\n" + ] + } + ], + "source": [ + "# get SCCOOS occurrence and measurement or fact data\n", + "sccoos_dataset_id = \"c9aaa0e9-8f6c-4553-a014-a857baba0680\"\n", + "\n", + "species = \"Lingulodinium polyedra\"\n", + "\n", + "sccoos_occur <- occurrence(\n", + " datasetid = sccoos_dataset_id, mof=TRUE\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Take a look at response data" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
| infraphylum | date_year | scientificNameID | scientificName | superdomainid | dropped | hab | aphiaID | decimalLatitude | infraphylumid | phylumid | familyid | occurrenceStatus | basisOfRecord | subkingdom | organismName | maximumDepthInMeters | id | order | organismQuantity | dataset_id | decimalLongitude | date_end | occurrenceID | infrakingdom | subkingdomid | date_start | organismQuantityType | genus | eventDate | eventID | brackish | infrakingdomid | coordinateUncertaintyInMeters | absence | eventRemarks | genusid | taxonID | originalScientificName | marine | minimumDepthInMeters | subphylumid | countryCode | date_mid | class | orderid | geodeticDatum | kingdom | superdomain | classid | depth | phylum | locationID | subphylum | family | kingdomid | node_id | flags | sss | shoredistance | sst | bathymetry | mof | subclassid | terrestrial | speciesid | superorder | superorderid | wrims | species | subclass |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <chr> | <int> | <chr> | <chr> | <int> | <lgl> | <lgl> | <int> | <dbl> | <int> | <int> | <int> | <chr> | <chr> | <chr> | <chr> | <int> | <chr> | <chr> | <chr> | <chr> | <dbl> | <dbl> | <chr> | <chr> | <int> | <dbl> | <chr> | <chr> | <chr> | <chr> | <lgl> | <int> | <chr> | <lgl> | <chr> | <int> | <chr> | <chr> | <lgl> | <int> | <int> | <chr> | <dbl> | <chr> | <int> | <chr> | <chr> | <chr> | <int> | <dbl> | <chr> | <chr> | <chr> | <chr> | <int> | <chr> | <chr> | <dbl> | <int> | <dbl> | <int> | <list> | <int> | <lgl> | <int> | <chr> | <int> | <lgl> | <chr> | <chr> |
| Dinoflagellata | 2009 | (urn:lsid:marinespecies.org:taxname:109462) | Dinophysis | 1 | FALSE | TRUE | 109462 | 34.408 | 146203 | 450030 | 231772 | present | HumanObservation | Harosa | Dinophysis_spp | 1 | 00056f10-de45-4217-b8f8-92f3d2a906b5 | Dinophysiales | 100 | c9aaa0e9-8f6c-4553-a014-a857baba0680 | -119.685 | 1.248653e+12 | HABs-StearnsWharf_2009-07-27T13:53:00Z_Dinophysis_spp | Alveolata | 582419 | 1.248653e+12 | cells/L | Dinophysis | 2009-07-27T13:53:00Z | HABs-StearnsWharf_2009-07-27T13:53:00Z | TRUE | 536209 | 12 | FALSE | 20090727 | 109462 | urn:lsid:algaebase.org:taxname:6356 | Dinophysis | TRUE | 1 | 562620 | US | 1.248653e+12 | Dinophyceae | 109390 | EPSG:4326 WGS84 | Chromista | Biota | 19542 | 1 | Myzozoa | HABs-StearnsWharf | Dinozoa | Dinophysaceae | 7 | b7c47783-a020-4173-b390-7b57c4fa1426 | NA | 33.44 | 202 | 15.4 | 7 | NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , 3.234 , 5.64 , 1.221 , 5.64 , 0.892 , 0.245 , 1.136 , 0 , 1.221 , 0.875 , 9.938 , 17 , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , uM , mg/m3 , mg/m3 , mg/m3 , uM , uM , uM , ng/mL , mg/m3 , uM , uM , Celsius , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , Ammonium , Avg_Chloro , Avg_Phaeo , Chl1 , Nitrate , Nitrite , Nitrite_Nitrate , pDA , Phaeo1 , Phosphate , Silicate , Temp , NA , http://vocab.nerc.ac.uk/collection/P06/current/UMMC/ , http://vocab.nerc.ac.uk/collection/P06/current/UMMC/ , http://vocab.nerc.ac.uk/collection/P06/current/UMMC/ , NA , NA , NA , NA , http://vocab.nerc.ac.uk/collection/P06/current/UMMC/ , NA , NA , http://vocab.nerc.ac.uk/collection/P06/current/UPAA/ , http://vocab.nerc.ac.uk/collection/S27/current/CS026908/ , http://vocab.nerc.ac.uk/collection/P25/current/CHLA/ , http://vocab.nerc.ac.uk/collection/P25/current/PHAEO/; https://www.bco-dmo.org/parameter/925; http://vocab.nerc.ac.uk/collection/P01/current/PHAEFMP1/, http://vocab.nerc.ac.uk/collection/P25/current/CHLA/ , http://vocab.nerc.ac.uk/collection/S27/current/CS002879/; https://www.bco-dmo.org/parameter/1194 , http://vocab.nerc.ac.uk/collection/S27/current/CS002877/; https://www.bco-dmo.org/parameter/1192; http://vocab.nerc.ac.uk/collection/P02/current/NTRI/, http://vocab.nerc.ac.uk/collection/S27/current/CS026905/ , https://pubchem.ncbi.nlm.nih.gov/compound/Domoic-acid , http://vocab.nerc.ac.uk/collection/P25/current/PHAEO/; https://www.bco-dmo.org/parameter/925; http://vocab.nerc.ac.uk/collection/P01/current/PHAEFMP1/, http://vocab.nerc.ac.uk/collection/S27/current/CS026904/ , http://vocab.nerc.ac.uk/collection/P25/current/SLCA/; https://www.bco-dmo.org/parameter/1209 , http://vocab.nerc.ac.uk/collection/P25/current/WTEMP/ , HABs-StearnsWharf_2009-07-27T13:53:00Z_Ammonium , HABs-StearnsWharf_2009-07-27T13:53:00Z_Avg_Chloro , HABs-StearnsWharf_2009-07-27T13:53:00Z_Avg_Phaeo , HABs-StearnsWharf_2009-07-27T13:53:00Z_Chl1 , HABs-StearnsWharf_2009-07-27T13:53:00Z_Nitrate , HABs-StearnsWharf_2009-07-27T13:53:00Z_Nitrite , HABs-StearnsWharf_2009-07-27T13:53:00Z_Nitrite_Nitrate , HABs-StearnsWharf_2009-07-27T13:53:00Z_pDA , HABs-StearnsWharf_2009-07-27T13:53:00Z_Phaeo1 , HABs-StearnsWharf_2009-07-27T13:53:00Z_Phosphate , HABs-StearnsWharf_2009-07-27T13:53:00Z_Silicate , HABs-StearnsWharf_2009-07-27T13:53:00Z_Temp , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA , NA | NA | NA | NA | NA | NA | NA | NA | NA |
| measurementDeterminedBy | measurementAccuracy | measurementValue | measurementRemarks | measurementValueID | level | occurrenceID | measurementUnit | measurementDeterminedDate | measurementType | measurementUnitID | measurementTypeID | measurementID | measurementMethod | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <lgl> | <lgl> | <chr> | <lgl> | <lgl> | <int> | <lgl> | <chr> | <lgl> | <chr> | <chr> | <chr> | <chr> | <lgl> | |
| 1 | NA | NA | 3.234 | NA | NA | 1 | NA | uM | NA | Ammonium | NA | http://vocab.nerc.ac.uk/collection/S27/current/CS026908/ | HABs-StearnsWharf_2009-07-27T13:53:00Z_Ammonium | NA |
| 2 | NA | NA | 5.64 | NA | NA | 1 | NA | mg/m3 | NA | Avg_Chloro | http://vocab.nerc.ac.uk/collection/P06/current/UMMC/ | http://vocab.nerc.ac.uk/collection/P25/current/CHLA/ | HABs-StearnsWharf_2009-07-27T13:53:00Z_Avg_Chloro | NA |
| 3 | NA | NA | 1.221 | NA | NA | 1 | NA | mg/m3 | NA | Avg_Phaeo | http://vocab.nerc.ac.uk/collection/P06/current/UMMC/ | http://vocab.nerc.ac.uk/collection/P25/current/PHAEO/; https://www.bco-dmo.org/parameter/925; http://vocab.nerc.ac.uk/collection/P01/current/PHAEFMP1/ | HABs-StearnsWharf_2009-07-27T13:53:00Z_Avg_Phaeo | NA |
| 4 | NA | NA | 5.64 | NA | NA | 1 | NA | mg/m3 | NA | Chl1 | http://vocab.nerc.ac.uk/collection/P06/current/UMMC/ | http://vocab.nerc.ac.uk/collection/P25/current/CHLA/ | HABs-StearnsWharf_2009-07-27T13:53:00Z_Chl1 | NA |
| 5 | NA | NA | 0.892 | NA | NA | 1 | NA | uM | NA | Nitrate | NA | http://vocab.nerc.ac.uk/collection/S27/current/CS002879/; https://www.bco-dmo.org/parameter/1194 | HABs-StearnsWharf_2009-07-27T13:53:00Z_Nitrate | NA |
| 6 | NA | NA | 0.245 | NA | NA | 1 | NA | uM | NA | Nitrite | NA | http://vocab.nerc.ac.uk/collection/S27/current/CS002877/; https://www.bco-dmo.org/parameter/1192; http://vocab.nerc.ac.uk/collection/P02/current/NTRI/ | HABs-StearnsWharf_2009-07-27T13:53:00Z_Nitrite | NA |
| 7 | NA | NA | 1.136 | NA | NA | 1 | NA | uM | NA | Nitrite_Nitrate | NA | http://vocab.nerc.ac.uk/collection/S27/current/CS026905/ | HABs-StearnsWharf_2009-07-27T13:53:00Z_Nitrite_Nitrate | NA |
| 8 | NA | NA | 0 | NA | NA | 1 | NA | ng/mL | NA | pDA | NA | https://pubchem.ncbi.nlm.nih.gov/compound/Domoic-acid | HABs-StearnsWharf_2009-07-27T13:53:00Z_pDA | NA |
| 9 | NA | NA | 1.221 | NA | NA | 1 | NA | mg/m3 | NA | Phaeo1 | http://vocab.nerc.ac.uk/collection/P06/current/UMMC/ | http://vocab.nerc.ac.uk/collection/P25/current/PHAEO/; https://www.bco-dmo.org/parameter/925; http://vocab.nerc.ac.uk/collection/P01/current/PHAEFMP1/ | HABs-StearnsWharf_2009-07-27T13:53:00Z_Phaeo1 | NA |
| 10 | NA | NA | 0.875 | NA | NA | 1 | NA | uM | NA | Phosphate | NA | http://vocab.nerc.ac.uk/collection/S27/current/CS026904/ | HABs-StearnsWharf_2009-07-27T13:53:00Z_Phosphate | NA |
| 11 | NA | NA | 9.938 | NA | NA | 1 | NA | uM | NA | Silicate | NA | http://vocab.nerc.ac.uk/collection/P25/current/SLCA/; https://www.bco-dmo.org/parameter/1209 | HABs-StearnsWharf_2009-07-27T13:53:00Z_Silicate | NA |
| 12 | NA | NA | 17 | NA | NA | 1 | NA | Celsius | NA | Temp | http://vocab.nerc.ac.uk/collection/P06/current/UPAA/ | http://vocab.nerc.ac.uk/collection/P25/current/WTEMP/ | HABs-StearnsWharf_2009-07-27T13:53:00Z_Temp | NA |
| locationID | n | Temp | Salinity | organismQuantity | startDate | endDate |
|---|---|---|---|---|---|---|
| <chr> | <int> | <dbl> | <dbl> | <dbl> | <date> | <date> |
| HABs-CalPoly | 119 | 15.09161 | NaN | 464842.9 | 2008-08-19 | 2021-09-07 |
| HABs-MontereyWharf | 62 | 14.41680 | NaN | 39570.0 | 2012-06-27 | 2020-02-26 |
| HABs-NewportPier | 179 | 17.78444 | NaN | 852749.0 | 2008-07-14 | 2021-08-30 |
| HABs-SantaMonicaPier | 311 | 17.78664 | NaN | 16788384.0 | 2008-06-30 | 2021-08-23 |
| HABs-ScrippsPier | 177 | 17.58588 | NaN | 1528597.0 | 2011-01-10 | 2020-03-02 |
| HABs-StearnsWharf | 288 | 16.39645 | NaN | 389358.0 | 2008-06-30 | 2021-07-12 |