-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.R
162 lines (121 loc) · 5.19 KB
/
settings.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
###
#Rhine snow - General settings
#Erwin Rottler, University of Potsdam
#Spring, 2019
###
#packages----
# remove.packages("meltimr")
# devtools::install_github('ERottler/meltimr')
# devtools::install_github('ERottler/rfs')
# devtools::install_github("laubblatt/phaselag")
# #ECHSE snow functions in package
# Rcpp::sourceCpp(paste0(base_dir, "R/meltim/echse_snow.cpp"))
# Rcpp::Rcpp.package.skeleton(name = "rEchseSnow", cpp_files = paste0(base_dir, "R/meltim/echse_snow.cpp"))
# install.packages(paste0(base_dir, "R/meltim/rEchseSnow"), repos=NULL, type="source")
# library(rEchseSnow)
pacman::p_load(ncdf4, ncdf4.helpers, PCICt, dplyr, readr, tidyr, rgeos, ggplot2,
sp, viridis, rgdal, leaflet, ggmap, zoo, zyp, alptempr, lmomco,
raster, foreach, rfs, dismo, XML, parallel, doParallel, Lmoments,
shape, devtools, pbapply, profvis, RColorBrewer, viridis, Rcpp, rEchseSnow,
Rlibeemd, xts, emdbook, rfs, meltimr, readr, tmap, sf, hydroGOF)
# library(phaselag)
source(paste0(getwd(), "/fcts.R"))
#directories----
#set base direcoty
base_dir <- "U:/rhine_snow/"
#gridded climate data
# file_dir <- "e:/mhm_data/04_Daten/lobith_6435060/input/"
file_dir <- "d:/nrc_user/rottler/toErwin1/6435060/"
#snow cover data from EURAC
scf_eurac_dir <- "D:/nrc_user/rottler/SCF_data/snow_eurac/zenodo_02_cloudremoval.tar/zenodo_02_cloudremoval/05_temporal_complete_max10d/"
#snow cover data from DLR
scf_dlr_dir <- "D:/nrc_user/rottler/SCF_data/snow_dlr/SnowPack_DLR.tar/SnowPack_DLR/"
#catchments
ezg_dir <- "D:/nrc_user/rottler/basin_data/EZG_Schweiz_BAFU/"
#cluster----
#Cluster for parallel computing
# stopCluster(my_clust)
n_cores <- 25#number of cores used for parallel computing
#Make cluster for parallel computing
my_clust <- makeCluster(n_cores)
clusterEvalQ(my_clust, pacman::p_load(zoo, zyp, alptempr, lmomco, ncdf4, rEchseSnow, sp, raster, betareg, viridis, rfs, meltimr))
registerDoParallel(my_clust)
#save_files----
save(my_elev_bands, smea_band, sslo_band, vmea_band, vslo_band, vdif_band, vdis_band,
date_snow, sno_vol_basin, prec_basin, svolu_d_band,
sc_doy_simu, basin_base, grid_points_d_in, scd_eurac, date_vali,
# scf_simu_vali, scf_eurac,
tslo_band, tslo_band_mea, pslo_band, pslo_band_mea,
snows_cal, snows_stat_cal, meteo_date_cal,
# vdia_band, vdim_band, vdias_band, vdims_band,
prec_basin_sol, prec_basin_liq, liq_area,
# cmea_band, cslo_band, cdif_band, cdis_band,
file = "U:/rhine_snow/R/figs_exp/sim_scf_exp.RData")
load(file = "U:/rhine_snow/R/figs_exp/sim_scf_exp.RData")
save(tmea_band, tslo_band, pmea_band, pslo_band, temps_d_band, meteo_date,
temps_d_band_ma14,
file = "U:/rhine_snow/R/figs_exp/temp_prec_exp.RData")
load(file = "U:/rhine_snow/R/figs_exp/temp_prec_exp.RData")
#
# load(file = "U:/rhine_snow/R/draft_snow.RData")
#
# save(snows_d_band, my_elev_bands, date_snow, svolu_d_band,
# smea_band, vmea_band, sslo_band, vslo_band, vdif_band, vdis_band,
# tmea_band, tmea_band_mea, tslo_band, tslo_band_mea,
# pmea_band, pmea_band_mea, pslo_band, pslo_band_mea,
# meta_grid_bands, sno_vol_basin, prec_basin,
#
# file = "U:/rhine_snow/R/draft_snow_17_12.RData")
# # file = "U:/rhine_snow/R/draft_snow_100.RData")
# smea_band_diep <- smea_band
# sslo_band_diep <- sslo_band
# vmea_band_diep <- vmea_band
# vslo_band_diep <- vslo_band
# vdif_band_diep <- vdif_band
# vdis_band_diep <- vdis_band
# my_elev_bands_diep <- my_elev_bands
# basin_84_diep <- basin_84
# snows_d_band_diep <- snows_d_band
#
# smea_band_reus <- smea_band
# sslo_band_reus <- sslo_band
# vmea_band_reus <- vmea_band
# vslo_band_reus <- vslo_band
# vdif_band_reus <- vdif_band
# vdis_band_reus <- vdis_band
# my_elev_bands_reus <- my_elev_bands
# basin_84_reus <- basin_84
# snows_d_band_reus <- snows_d_band
#
# smea_band_aare <- smea_band
# sslo_band_aare <- sslo_band
# vmea_band_aare <- vmea_band
# vslo_band_aare <- vslo_band
# vdif_band_aare <- vdif_band
# vdis_band_aare <- vdis_band
# my_elev_bands_aare <- my_elev_bands
# basin_84_aare <- basin_84
# snows_d_band_aare <- snows_d_band
#
# smea_band_base <- smea_band
# sslo_band_base <- sslo_band
# vmea_band_base <- vmea_band
# vslo_band_base <- vslo_band
# vdif_band_base <- vdif_band
# vdis_band_base <- vdis_band
# my_elev_bands_base <- my_elev_bands
# basin_84_base <- basin_84
# snows_d_band_base <- snows_d_band
# load("U:/rhine_snow/R/meltim_snow.Rdata")
#
# save(smea_band_diep, sslo_band_diep, vmea_band_diep, vslo_band_diep, vdif_band_diep, vdis_band_diep,
# snows_d_band_diep, my_elev_bands_diep, basin_84_diep,
# smea_band_reus, sslo_band_reus, vmea_band_reus, vslo_band_reus, vdif_band_reus, vdis_band_reus,
# snows_d_band_reus, my_elev_bands_reus, basin_84_reus,
# smea_band_aare, sslo_band_aare, vmea_band_aare, vslo_band_aare, vdif_band_aare, vdis_band_aare,
# snows_d_band_aare, my_elev_bands_aare, basin_84_aare,
# smea_band_base, sslo_band_base, vmea_band_base, vslo_band_base, vdif_band_base, vdis_band_base,
# snows_d_band_base, my_elev_bands_base, basin_84_base,
# date_snow,
#
# file = "U:/rhine_snow/R/meltim_snow.RData", version = 2)