-
Notifications
You must be signed in to change notification settings - Fork 1
/
start_RADM.R
76 lines (60 loc) · 2.07 KB
/
start_RADM.R
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
######################################################################
# Script to be called from bash by RADM.sh
# Starts the Delayed Mode with the adequate options
######################################################################
uf = commandArgs(trailingOnly = TRUE)
### get all arguments
WMO = uf[1]
multi_core = uf[2]
plot_mode = as.logical(uf[3])
zoom_plot = as.logical(uf[4])
### Check conflicting options
if ( WMO=="NA" ) {
print("Please give a WMO number as an argument (-W), or read the help (-h)")
stop()
}
cat("Importing libraries and source code...")
### import pathways
source("~/Documents/radiometry/pathways.R")
### Source the DM functions and subfunctions, and libraries
suppressPackageStartupMessages({
library(ncdf4)
library(stringr)
library(stringi)
library(parallel)
library(ggplot2)
library(latex2exp)
library(plyr)
library(viridis)
library(gridExtra)
library(gtools)
library(nortest)
library(tidyr)
library(dplyr)
})
source(paste0(path_to_source, "helpers.R"))
source(paste0(path_to_source, "possol.R"))
source(paste0(path_to_source, "sensor_temp.R"))
source(paste0(path_to_source, "main_RADM.R"))
source(paste0(path_to_source, "get_matches.R"))
source(paste0(path_to_source, "write_DM.R"))
source(paste0(path_to_source, "increment_N_CALIB.R"))
source(paste0(path_to_source, "RT_QC_radiometry_function_oao_2.R"))
source(paste0(path_to_source, "plots.R"))
cat("DONE\nImporting bio index and greylist...")
### import tables
index_ifremer = read.table(path_to_index_ifremer, sep=",", header = T)
index_greylist = read.csv(path_to_index_greylist, sep = ",")
cat("DONE\n")
### Treat optional arguments
if (multi_core == "NA") {
n_cores = detectCores()
} else {
n_cores = as.numeric(multi_cores)
}
if (plot_mode) {
exit = plot_corr_wrapper(WMO, index_ifremer, path_to_netcdf, n_cores=n_cores, pres_zoom=zoom_plot)
} else {
### Compute and write delayed modes
exit = main_RADM(WMO=WMO, index_ifremer=index_ifremer, index_greylist=index_greylist, path_to_netcdf=path_to_netcdf, n_cores=n_cores)
}