generated from oceanhackweek/ohwyy_proj_template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestingGettingDataAndList1.qmd
88 lines (66 loc) · 1.74 KB
/
testingGettingDataAndList1.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
---
title: "Obis"
format: html
editor: visual
---
#Important notes! Dataset list is available HERE https://erddap.bio-oracle.org/erddap/search/index.html?page=1&itemsPerPage=1000&searchFor=Bio-OracleS
### Step 1: Import Libraries
```{r}
#For getting species data -- not used here:
library(robis)
#For data manipultaion:
library(tidyverse)
#Not used, but anohter method to get data:
#library(rerddap)
#Get genera API data:
#library(httr)
library(lubridate)
library(sdmpredictors)
```
## To see datasets
```{r}
datasets <- list_datasets(terrestrial = FALSE, marine = TRUE)
#View(datasets[,c("dataset_code", "description")])
layers <- list_layers(datasets)
layers
```
## Future datasets
```{r}
future <- list_layers_future(terrestrial = FALSE)
# available scenarios
future
```
```{r}
dir <- "ohw-tutorials/data"
# download pH and Salinity to the temporary directory
load_layers(layers[layers$name %in% c("Bathymetry (mean)") &
layers$dataset_code == "Bio-ORACLE"], datadir = dir)
# set a default datadir, preferably something different from tempdir()
options(sdmpredictors_datadir= dir)
# (down)load specific layers
specific <- load_layers(c("BO_bathymean"))
vars <- c("BO_ph","BO_bathymean","BO_chlomean","BO_dissox","BO_nitrate","BO_salinity","BO_sstmean")
# equal area data (Behrmann equal area projection)
equalarea <- load_layers(("BO_bathymean"), equalarea = FALSE)
raster::plot(equalarea)
```
```{r}
e <- raster::extent(-71,-64,42,45)
rc <- raster::crop(equalarea, e)
raster::plot(rc)
```
```{r}
```
```{r}
list_layers(marine = TRUE)
```
```{r}
layercodes <- c("BO_nitrate")
env <- load_layers(layercodes, equalarea = FALSE)
```
## Or even simpler:
```{r}
oct <- load_layers("MS_sst10_5m")
```
# Next steps
- Crop rasters