Mercurial > repos > ecology > interpolation_run_idw_interpolation
annotate run_idw_interpolation.R @ 1:b4b9edf9ea27 draft default tip
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit d85a00bfd9f603fd25ad0fc93736d0b1e395fe25
author | ecology |
---|---|
date | Tue, 12 Mar 2024 12:39:40 +0000 |
parents | d07fcc660f3c |
children |
rev | line source |
---|---|
0
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
1 library("getopt") |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
2 library("sf") |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
3 library("tmap") |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
4 library("RColorBrewer") |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
5 library("raster") |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
6 library("gstat") |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
7 |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
8 args = commandArgs(trailingOnly=TRUE) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
9 option_specification = matrix(c( |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
10 'observationsCsv', 'i1', 1, 'character', |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
11 'latitudeColumn', 'i2', 1, 'double', |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
12 'longitudeColumn', 'i3', 1, 'double', |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
13 'observationsColumn', 'i4', 1, 'double', |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
14 'studyArea', 'i5', 1, 'character', |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
15 'idwPower', 'i6', 1, 'double', |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
16 'samplePoints', 'i7', 1, 'double', |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
17 'sampleType', 'i8', 1, 'character', |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
18 'legendLabel', 'i9', 1, 'character', |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
19 'legendPosition', 'i10', 1, 'character', |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
20 'numberClasses', 'i11', 1, 'double', |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
21 'dotSize', 'i12', 1, 'double', |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
22 'colorType', 'i13', 1, 'character', |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
23 'testCase', 'i14', 1, 'character', |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
24 'outputData', 'o', 2, 'character' |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
25 ), byrow=TRUE, ncol=4); |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
26 options = getopt(option_specification); |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
27 |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
28 obsData <- read.csv(file=options$observationsCsv, sep = ',', header = TRUE) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
29 latitudeColumn <- options$latitudeColumn |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
30 longitudeColumn <- options$longitudeColumn |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
31 observationsColumn <- options$observationsColumn |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
32 studyArea <- options$studyArea |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
33 idwPower <- options$idwPower |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
34 samplePoints <- options$samplePoints |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
35 sampleType <- options$sampleType |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
36 legendLabel <- options$legendLabel |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
37 legendPosition <- options$legendPosition |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
38 numberClasses <- options$numberClasses |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
39 dotSize <- options$dotSize |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
40 colorType <- options$colorType |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
41 testCase <- options$testCase |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
42 |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
43 #cat("\n observationsCsv", options$observationsCsv) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
44 cat("\n latitudeColumn", latitudeColumn) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
45 cat("\n longitudeColumn", longitudeColumn) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
46 cat("\n observationsColumn", observationsColumn) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
47 #cat("\n studyArea", studyArea) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
48 cat("\n idwPower", idwPower) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
49 cat("\n samplePoints", samplePoints) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
50 cat("\n sampleType", sampleType) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
51 cat("\n legendLabel", legendLabel) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
52 cat("\n legendposition", legendPosition) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
53 cat("\n numberClasses", numberClasses) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
54 cat("\n dotSize", dotSize) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
55 cat("\n colorType", colorType) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
56 cat("\n testCase", testCase) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
57 #cat("\n outputData: ", options$outputData) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
58 |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
59 coordinates(obsData) <- c(colnames(obsData)[longitudeColumn], colnames(obsData)[latitudeColumn]) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
60 sf_obsData <- as_Spatial(st_as_sf(obsData)) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
61 |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
62 polygon <- as_Spatial(st_read(studyArea)) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
63 sf_obsData@bbox<-polygon@bbox |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
64 |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
65 runInterpolation <- function(points, values, interpolation_power, sample_points, sample_type){ |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
66 if (testCase == "true") { |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
67 cat("\n set seed!") |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
68 set.seed(123) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
69 } |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
70 grd <- as.data.frame(spsample(points, sample_type, n=sample_points)) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
71 names(grd) <- c("X", "Y") |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
72 coordinates(grd) <- c("X", "Y") |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
73 gridded(grd) <- TRUE |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
74 fullgrid(grd) <- TRUE |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
75 |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
76 proj4string(points) <- proj4string(points) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
77 proj4string(grd) <- proj4string(points) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
78 return(gstat::idw(values ~ 1, points, newdata=grd, idp=interpolation_power)) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
79 } |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
80 |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
81 plotInterpolationMap <- function(raster, points, legend_label){ |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
82 plot <- tm_shape(raster) + |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
83 tm_raster(n=numberClasses,palette = rev(brewer.pal(7, colorType)), auto.palette.mapping = FALSE, |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
84 title=legend_label) + |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
85 tm_shape(points) + tm_dots(size=dotSize) + |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
86 tm_legend(legend.outside=legendPosition) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
87 return(plot) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
88 } |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
89 |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
90 sf_obsData.idw <- runInterpolation(sf_obsData, obsData$measurement, idwPower, samplePoints, sampleType) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
91 |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
92 raster_object <- raster(sf_obsData.idw) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
93 raster_object.mask <- mask(raster_object, polygon) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
94 |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
95 idw <- plotInterpolationMap(raster_object.mask, sf_obsData, legendLabel) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
96 idw |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
97 |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
98 png(options$outputData) |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
99 idw |
d07fcc660f3c
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/interpolation commit 450e4496f243d6e94d5238358873bbc014fe2f08
ecology
parents:
diff
changeset
|
100 dev.off() |