Mercurial > repos > ecology > obis_data
annotate obisindicators.r @ 0:1fcd81d65467 draft
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
author | ecology |
---|---|
date | Thu, 18 Jan 2024 09:33:52 +0000 |
parents | |
children |
rev | line source |
---|---|
0
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
1 #Rscript |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
2 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
3 ########################################### |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
4 ## Mapping alpha and beta diversity ## |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
5 ########################################### |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
6 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
7 #####Packages : obisindicators |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
8 # dplyr |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
9 # sf |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
10 # ggplot2 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
11 # rnaturalearth |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
12 # rnaturalearthdata |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
13 # viridis |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
14 # dggridr |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
15 library(magrittr) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
16 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
17 ## remotes::install_github("r-barnes/dggridR") |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
18 #####Load arguments |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
19 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
20 args <- commandArgs(trailingOnly = TRUE) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
21 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
22 # url for the S2 subset |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
23 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
24 if (length(args) < 4) { |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
25 stop("This tool needs at least 4 argument : longitude, latitude, species and number of records") |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
26 }else { |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
27 raster <- args[1] |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
28 hr <- args[2] |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
29 sep <- as.character(args[3]) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
30 longitude <- as.numeric(args[4]) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
31 latitude <- as.numeric(args[5]) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
32 spe <- as.numeric(args[6]) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
33 rec <- as.numeric(args[7]) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
34 crs <- as.numeric(args[8]) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
35 reso <- as.numeric(args[9]) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
36 source(args[10]) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
37 source(args[11]) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
38 source(args[12]) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
39 } |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
40 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
41 if (hr == "false") { |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
42 hr <- FALSE |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
43 }else { |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
44 hr <- TRUE |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
45 } |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
46 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
47 if (sep == "t") { |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
48 sep <- "\t" |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
49 } |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
50 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
51 if (crs == "0") { |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
52 crs <- "+proj=robin +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs" |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
53 } |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
54 #####Import data |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
55 occ <- read.table(raster, sep = sep, dec = ".", header = hr, fill = TRUE, encoding = "UTF-8") # occ_1M OR occ_SAtlantic |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
56 occ <- na.omit(occ) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
57 #Get biological occurrences |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
58 #Use the 1 million records subsampled from the full OBIS dataset |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
59 colnames(occ)[longitude] <- c("decimalLongitude") |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
60 colnames(occ)[latitude] <- c("decimalLatitude") |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
61 colnames(occ)[spe] <- c("species") |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
62 colnames(occ)[rec] <- c("records") |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
63 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
64 #Create a discrete global grid |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
65 #Create an ISEA discrete global grid of resolution 9 using the dggridR package: |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
66 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
67 dggs <- dggridR::dgconstruct(projection = "ISEA", topology = "HEXAGON", res = reso) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
68 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
69 #Then assign cell numbers to the occurrence data |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
70 occ$cell <- dggridR::dgGEO_to_SEQNUM(dggs, occ$decimalLongitude, occ$decimalLatitude)[["seqnum"]] |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
71 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
72 #Calculate indicators |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
73 #The following function calculates the number of records, species richness, Simpson index, Shannon index, Hurlbert index (n = 50), and Hill numbers for each cell. |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
74 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
75 #Perform the calculation on species level data |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
76 idx <- calc_indicators(occ) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
77 write.table(idx, file = "Index.csv", sep = ",", dec = ".", na = " ", col.names = TRUE, row.names = FALSE, quote = FALSE) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
78 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
79 #add cell geometries to the indicators table (idx) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
80 grid_idx <- sf::st_wrap_dateline(dggridR::dgcellstogrid(dggs, idx$cell)) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
81 colnames(grid_idx) <- c("cell", "geometry") |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
82 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
83 grid <- dplyr::left_join(grid_idx, |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
84 idx, |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
85 by = "cell") |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
86 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
87 #Plot maps of indicators |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
88 #Let’s look at the resulting indicators in map form. |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
89 #Indice ES(50) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
90 es_50_map <- gmap_indicator(grid, "es", label = "ES(50)", crs = crs) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
91 es_50 <- ggplot2::ggsave("ES_50.png", es_50_map, scale = 0.38, width = 12, height = 7, units = "in", dpi = 300, limitsize = TRUE) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
92 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
93 # Shannon index |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
94 shannon_map <- gmap_indicator(grid, "shannon", label = "Shannon index", crs = crs) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
95 shannon <- ggplot2::ggsave("Shannon_index.png", shannon_map, scale = 0.38, width = 12, height = 7, units = "in", dpi = 300, limitsize = TRUE) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
96 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
97 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
98 # Number of records, log10 scale, Geographic projection |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
99 records_map <- gmap_indicator(grid, "n", label = "# of records", trans = "log10", crs = crs) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
100 records <- ggplot2::ggsave("Records.png", records_map, scale = 0.38, width = 12, height = 7, units = "in", dpi = 300, limitsize = TRUE) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
101 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
102 # Simpson index |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
103 simpson_map <- gmap_indicator(grid, "simpson", label = "Simpson index", crs = crs) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
104 simpson <- ggplot2::ggsave("Simpson_index.png", simpson_map, scale = 0.38, width = 12, height = 7, units = "in", dpi = 300, limitsize = TRUE) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
105 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
106 # maxp |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
107 maxp_map <- gmap_indicator(grid, "maxp", label = "maxp index", crs = crs) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
108 maxp <- ggplot2::ggsave("Maxp.png", maxp_map, scale = 0.38, width = 12, height = 7, units = "in", dpi = 300, limitsize = TRUE) |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
109 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
110 #Mapping |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
111 es_50 |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
112 shannon |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
113 simpson |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
114 maxp |
1fcd81d65467
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
ecology
parents:
diff
changeset
|
115 records |