Skip to content

Commit c09f971

Browse files
committed
updated file names
Merge branch 'traits_tutorials' of github.com:terraref/tutorials into traits_tutorials # Conflicts: # _bookdown.yml
2 parents 5c58e4a + 45f42be commit c09f971

12 files changed

Lines changed: 89 additions & 31 deletions
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
*Fill out this issue by completing the items below. Not every item may be relevent to you, so feel free to make changes*
2+
3+
#### The tutorial or vignette name
4+
Name:
5+
6+
#### The current behavior or issue
7+
Description:
8+
9+
#### The steps taken to reproduce the behavior or issue, or specify a location where the steps were recorded
10+
To reproduce:
11+
12+
#### Describe the desired behavior or desired outcome
13+
Goal:
14+
15+
#### Add other supporting information that may be useful
16+
Versions, OS information, other:
17+
18+
#### Completion criteria
19+
This is done when:
20+
- [] (replace this text)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#### Describe what you want to do
2+
3+
(be as descriptive as you can)
4+
5+
#### Let us know what your motivation for this new feature is
6+
7+
I want this new feature because ...
8+
9+
#### _(Optional) Please share any thoughts on how you might want this feature implemented_
10+
11+
**Note:** we really appreciate your suggestions
12+
I think the best approach would be to ...

README.md

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,40 @@
11

22
# Tutorials
33

4+
45
## An introduction to the use of TERRA REF data and software
56

6-
Many of these tutorials have complex dependencies. In addition, many datasets are very large. These tutorials use the National Data Service Labs Workbench (NDS Labs Workbench). The NDS Labs Workbench provides the following:
7+
This repository provides a set of tutorials that are divided by data types and use cases.
8+
9+
In the repository, you will find three folders that contain examples of how to access data:
10+
11+
* traits
12+
* sensors
13+
* plantCV
14+
15+
Within each folder there are both R markdown and Jupyter notebooks. These describe different approaches to accessing data. These are intended to cover diverse use cases, and you will find information about accessing data from web interfaces but the primary focus is on accessing data using R, Python, SQL, and REST APIs. These are intended to provide quick-start introductions to access data along with computing environments required for further exploration. They are not intended to teach analyses, although some illustrative visualizations and statistical models are provided.
16+
17+
This is a work in progress, and an open source community that welcomes contributions in many forms. Please feel welcome to ask questions, provide suggestions or share analyses that may be of interest to others.
18+
19+
20+
## Getting Started
21+
22+
### Requirements
723

8-
* Custom configured computing environments
9-
* In principle, it is possible to use any docker container on [Docker Hub](https://hub.docker.com/explore/).
10-
* To get started, see the [workbench/ndslabs_workbench_intro.html](https://htmlpreview.github.io/?https://github.com/terraref/tutorials/blob/master/workbench/ndslabs_workbench_intro.html) tutorial.
11-
* This will set you up to begin tutorials found in the traits, sensors, and plantCV folders.
24+
All of the tutorials have been designed to work in the cloud and can be accessed using a web browser. Therefore, the _only technical requirements_ are:
25+
* Web browser
26+
* Internet connection
1227

13-
### Data Access
28+
In addition, you will need to:
29+
* Sign up as as a TERRA REF [Beta User by filling out this application](http://terraref.org/beta).
30+
* Sign up for an account on the [TERRA REF Workbench](https://www.workbench.terraref.org), and wait for approval.
1431

15-
The first research-grade version of TERRA REF data products will be released in November 2019.
16-
Before that, we will make evaluation releases available: the alpha version was released in November 2016 and the beta version will be released in 2018.
32+
### Using the Workbench
1733

18-
To access data please fill out a quick [Beta User application](http://terraref.org/beta).
34+
The Workbench uses the National Data Service Labs Workbench (NDS Labs Workbench) software. The Workbench is a cloud analysis environment that minimizes and standardizes the software requirements so users can get started quickly. It also provides access to large files and databases that would otherwise be slow and impractical for users to download and store.
1935

20-
### Links
36+
Although we provide a few pre-configured computing environments, Workbench is designed to support any Docker container - that is, anything you can install on a linux computer can be used in the workbench - for an idea of what is possible, see the large number of options on [Docker Hub](https://hub.docker.com/explore/).
2137

22-
TODO: add links to quick-start documentation, README's, code for learning and applied examples
38+
**To get started**, follow the [Workbench Quick Start](https://htmlpreview.github.io/?https://github.com/terraref/tutorials/blob/master/workbench/ndslabs_workbench_intro.html).
2339

24-
* Data portal: [terraref.org/data](https://terraref.org/data)
25-
* Docker Images on Docker Hub: [hub.docker.com/terraref](https://hub.docker.com/terraref)
26-
* NDS Labs Workbench: [www.workbench.terraref.org](https://www.workbench.terraref.org)
40+
This will walk you through the process of getting started with the first tutorials on how to access data.

_bookdown.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ language:
44
ui:
55
chapter_name: "Chapter "
66
rmd_files: ["index.Rmd", "vignettes/00-introduction.Rmd", "vignettes/01-get-trait-data-R.Rmd", "vignettes/02-get-weather-data-R.Rmd",
7-
"vignettes/03-get-images-python.Rmd", "vignettes/04-synthesis-data.Rmd", "traits/03-access-r-traits.Rmd",
8-
"sensors/01-meteorological-data.Rmd", "sensors/06-list-datasets-by-plot.Rmd"]
7+
"vignettes/03-get-images-python.Rmd", "vignettes/04-synthesis-data.Rmd", "traits/03-access-r-traits.Rmd","sensors/01-meteorological-data.Rmd",
8+
"sensors/06-list-datasets-by-plot.Rmd"]
9+

index.Rmd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ At a minimum, you should have:
4242
We have tried to write these tutorials using open access sample data sets. However, access to much of the data will require you to 1) fill out the TERRA REF Beta user questionaire ([terraref.org/beta](terraref.org/beta)) and 2) request access to specific databases.
4343

4444
<!-- Not sure where this goes, either in documentation or perhaps in an appendix. But I don't think this belongs in the introduction. Perhaps after the vignettes chaper
45+
4546
## Ways of Acessing Data
4647
4748
* Web Interfaces
@@ -55,14 +56,13 @@ We have tried to write these tutorials using open access sample data sets. Howev
5556
* API Clients
5657
+ [rOpenSci traits package](https://pecan.gitbook.io/betydb-data-access/ropensci-traits-package)
5758
58-
-->
59-
6059
## Other Resources
6160
6261
The TERRA REF website: [terraref.org](http://terraref.org/)
6362
6463
The TERRA REF Technical Documentation: [docs.terraref.org](docs.terraref.org)
6564
65+
6666
## Finding help
6767
6868
- Slack at terra-ref.slack.com ([signup](https://terraref-slack-invite.herokuapp.com/))
@@ -73,6 +73,7 @@ The TERRA REF Technical Documentation: [docs.terraref.org](docs.terraref.org)
7373
7474
```{r, include = FALSE}
7575
knitr::opts_chunk$set(echo = FALSE)
76+
7677
options(warn = -1)
7778
```
7879

traits/02-betydb-api-access.Rmd

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ The first step toward reproducible pipelines is to automate the process of searc
2626
### Using Your API key to Connect
2727

2828
An API key is like a password. It allows you to access data, and should be kept private.
29+
2930
Therefore, we are not going to put it in code that we share.
3031

3132
A common way of handling private API keys is to place it in a text file in your current directory. Don't put it in a project directory where it might be inadvertently shared.
@@ -39,6 +40,7 @@ Here is how to find and save your API key:
3940
An API key is not needed to access public data. This includes metadata tables and simulated data in the https://terraref.ncsa.illinois.edu/bety-test database.
4041

4142

43+
4244
## Accessing data using a URL query
4345

4446

@@ -48,8 +50,10 @@ An API key is not needed to access public data. This includes metadata tables an
4850
* path to the api: `/api/v1`
4951
* api endpoint: `/search` or `traits` or `sites`. For BETYdb, these are the names of database tables.
5052
* Query parameters: `genus=Sorghum`
53+
5154
* Authentication: `key=api_key` is your assigned API key. This will only be needed when querying trait data. No key is needed to access the public metadata tables.
5255

56+
5357
### Constructing a URL query
5458

5559
First, lets construct a query by putting together a URL.
@@ -72,6 +76,7 @@ First, lets construct a query by putting together a URL.
7276

7377
> What will the URL https://terraref.ncsa.illinois.edu/bety/api/v1/species?genus=Sorghum return?
7478
79+
7580
> Write a URL that will query the database for sites with "Field Scanner" in the name field. Hint: combine two terms with a `+` as in `Field+Scanner`
7681
7782
What do you see? Do you think that this is all of the records? What happens if you add `&limit=none`?
@@ -94,6 +99,7 @@ curl -o sorghum.json \
9499

95100
## Using the R jsonlite package to access the API with a URL query
96101

102+
97103
```{r 02-jsonlite-load, include = FALSE}
98104
99105
library(jsonlite)
@@ -104,7 +110,7 @@ library(jsonlite)
104110
sorghum.json <- readLines(
105111
paste0("https://terraref.ncsa.illinois.edu/bety/api/v1/species?genus=Sorghum&key=",
106112
readLines('.betykey')))
107-
113+
108114
## print(sorghum.json)
109115
## not a particularly useful format
110116
## lets convert to a data frame

traits/03-access-r-traits.Rmd

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ library(ggthemes)
2727
theme_set(theme_bw())
2828
library(dplyr)
2929
```
30-
3130
Create a file that contains your API key. If you have signed up for access to the TERRA REF database, your API key will have been sent to you in an email. You will need this personal key _and_ permissions to access the trait data. If you receive empty (NULL) datasets, it is likely that you do not have permissions.
3231

32+
3333
```{r writing-key, echo = TRUE}
3434
# This should be done once with the key sent to you in your email
3535
@@ -63,7 +63,6 @@ sorghum_info <- betydb_query(table = 'species',
6363

6464
Notice all of the arguments that the `betydb_query` function requires? We can change this by setting the default connection options thus:
6565

66-
6766
```{r 03-set-up, echo = TRUE}
6867
options(betydb_key = readLines('.betykey', warn = FALSE),
6968
betydb_url = "https://terraref.ncsa.illinois.edu/bety/",
@@ -73,6 +72,7 @@ options(betydb_key = readLines('.betykey', warn = FALSE),
7372
Now the same query can be reduced to:
7473

7574
```{r query-species-reduce, message = FALSE, echo = TRUE}
75+
7676
sorghum_info <- betydb_query(table = 'species',
7777
genus = "Sorghum",
7878
limit = 'none')
@@ -81,6 +81,7 @@ sorghum_info <- betydb_query(table = 'species',
8181
### Time series of height
8282

8383
Now let's query some trait data.
84+
8485
```{r canopy_height, echo = TRUE, message = FALSE}
8586
canopy_height <- betydb_query(table = 'search',
8687
trait = "canopy_height",
@@ -89,12 +90,14 @@ canopy_height <- betydb_query(table = 'search',
8990
```
9091

9192
```{r plot_height}
93+
9294
ggplot(data = canopy_height,
9395
aes(x = lubridate::yday(lubridate::ymd_hms(raw_date)), y = mean)) +
9496
geom_point(size = 0.5, position = position_jitter(width = 0.1)) +
9597
# scale_x_datetime(date_breaks = '6 months') +
9698
xlab("Day of Year") + ylab("Plant Height") +
9799
guides(color = guide_legend(title = 'Genotype')) +
98100
theme_bw()
101+
99102
```
100103

traits/04-danforth-indoor-phenotyping-facility.Rmd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Danforth Indoor Phenotype Analysis
22

33
```{r 02-setup, include=FALSE}
4-
knitr::opts_chunk$set(echo = TRUE, cache = FALSE)
4+
5+
knitr::opts_chunk$set(echo = TRUE, cache = TRUE)
56
library(jsonlite)
67
library(dplyr)
78
library(ggplot2)
@@ -21,6 +22,7 @@ library(traits)
2122
Unlike the first two tutorials, now we will be querying real data from the public TERRA REF database. So we will use a new URL, https://terraref.ncsa.illinois.edu/bety/, and we will need to use our own private key.
2223

2324
```{r terraref-connect-options}
25+
2426
options(betydb_key = readLines('.betykey', warn = FALSE),
2527
betydb_url = "https://terraref.ncsa.illinois.edu/bety/",
2628
betydb_api_version = 'v1')

traits/05-maricopa-field-scanner.Rmd

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ sites <- betydb_query(
3131

3232
A more robust (but complicated way) would be to query the experiments and experiments_sites tables. But we will leave that as an exercise for the ambitious user.
3333

34+
3435
### Plot Season 2 plots
3536

3637
```{r traits-05-map-mac-polygons, echo = TRUE}
@@ -39,6 +40,7 @@ site_bounds <- sites %>%
3940
rowwise() %>%
4041
do(boundaries = readWKT(text = .$geometry, id = .$id))
4142
43+
4244
site_bounds <- do.call('rbind', site_bounds$boundaries)
4345
#names(site_bounds) <- sites$sitename
4446
@@ -78,7 +80,9 @@ leaflet() %>%
7880
```{r}
7981
## Time series of canopy cover, height, NDVI
8082
81-
First look up variables by name. Let's look for measurements related to canopy size:
83+
#First look up variables by name. Let's look for measurements related to canopy size:
84+
85+
```
8286

8387
```
8488

traits/06-agronomic-metadata.Rmd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ options(betydb_key = readLines('.betykey', warn = FALSE),
9090

9191

9292
```{r 06_tibble, echo = TRUE, warning = FALSE}
93+
9394
## query and join tables
9495
species <- betydb_query(table = "species") %>%
9596
select(specie_id = id, scientificname, genus)
@@ -133,6 +134,7 @@ Let's do the manual equivalent of a cross-table join. BETY actually does contain
133134
The key idea here is that each treatment is associated with some (possibly many) managements, but the treatments table only reports the number of associated managements. To see the management IDs themselves, we need to query an individual treatment ID. So, we retrieve one table, then iterate over each row extracting the foreign keys for the other table. This requires an API call for every treatment, so beware that it is likely to be slow!
134135

135136
```{r 06_cross_join, echo = TRUE, results = 'hide'}
137+
136138
treatments <- betydb_query(table = 'treatments') %>%
137139
select(treatment_id = id , name, definition, control)
138140

0 commit comments

Comments
 (0)