Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
remind
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jerome Hilaire
remind
Commits
998771da
Unverified
Commit
998771da
authored
4 years ago
by
Lavinia Baumstark
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #143 from dklein-pik/develop
Little fixes to output scripts
parents
40bcec59
d5b2043f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/output/comparison/supplycurves.R
+7
-6
7 additions, 6 deletions
scripts/output/comparison/supplycurves.R
scripts/output/single/rds_report.R
+16
-6
16 additions, 6 deletions
scripts/output/single/rds_report.R
with
23 additions
and
12 deletions
scripts/output/comparison/supplycurves.R
+
7
−
6
View file @
998771da
...
...
@@ -14,22 +14,23 @@ x <- readSupplycurveBio(outputdirs)
years
<-
getYears
(
x
$
supplycurve
)
years
<-
years
[
years
>=
"y2005"
&
years
<=
"y2100"
]
years
<-
"y2080"
#
years <- "y2080"
regions
<-
sort
(
getRegions
(
x
$
supplycurve
))
out
<-
swopen
(
template
=
"david"
)
title
<-
paste0
(
years
)
dat
<-
gginput
(
x
$
supplycurve
[
regions
,
years
,],
scatter
=
"type"
)
for
(
year
in
years
)
{
title
<-
paste0
(
year
)
dat
<-
gginput
(
x
$
supplycurve
[
regions
,
year
,],
scatter
=
"type"
)
dat
$
year
<-
factor
(
dat
$
year
)
p
<-
ggplot
(
dat
,
aes
(
x
=
.value.x
,
y
=
.value.y
))
+
geom_line
(
aes
(
colour
=
scenario
,
linetype
=
curve
))
+
#geom_line(size=0.5) +
geom_point
(
data
=
gginput
(
x
$
rem_point
[
regions
,
year
s
,],
scatter
=
"variable"
),
aes
(
x
=
.value.x
,
y
=
.value.y
,
colour
=
scenario
))
+
geom_point
(
data
=
gginput
(
x
$
mag_point
[
regions
,
year
s
,],
scatter
=
"variable"
),
aes
(
x
=
.value.x
,
y
=
.value.y
,
colour
=
scenario
),
shape
=
5
)
+
geom_point
(
data
=
gginput
(
x
$
rem_point
[
regions
,
year
,],
scatter
=
"variable"
),
aes
(
x
=
.value.x
,
y
=
.value.y
,
colour
=
scenario
))
+
geom_point
(
data
=
gginput
(
x
$
mag_point
[
regions
,
year
,],
scatter
=
"variable"
),
aes
(
x
=
.value.x
,
y
=
.value.y
,
colour
=
scenario
),
shape
=
5
)
+
facet_wrap
(
~
region
)
+
ggtitle
(
title
)
+
ylab
(
"$/GJ"
)
+
xlab
(
"EJ"
)
+
coord_cartesian
(
xlim
=
c
(
0
,
80
),
ylim
=
c
(
0
,
30
))
swfigure
(
out
,
print
,
p
,
sw_option
=
"height=9,width=12"
)
}
swclose
(
out
,
outfile
=
paste0
(
"supplycurves.pdf"
),
clean_output
=
TRUE
,
save_stream
=
FALSE
)
This diff is collapsed.
Click to expand it.
scripts/output/single/rds_report.R
+
16
−
6
View file @
998771da
...
...
@@ -41,11 +41,21 @@ saveRDS(q,file=rds)
if
(
file.exists
(
runstatistics
)
&
dir.exists
(
resultsarchive
))
{
stats
<-
list
()
load
(
runstatistics
)
if
(
!
is.null
(
stats
$
id
))
{
saveRDS
(
q
,
file
=
paste0
(
resultsarchive
,
"/"
,
stats
$
id
,
".rds"
))
cwd
<-
getwd
()
setwd
(
resultsarchive
)
system
(
"ls 1*.rds > files"
)
setwd
(
cwd
)
if
(
is.null
(
stats
$
id
))
{
# create an id if it does not exist (which means that statistics have not
# been saved to the archive before) and save statistics to the archive
message
(
"No id found in runstatistics.rda. Calling lucode::runstatistics() to create one."
)
stats
<-
lucode
::
runstatistics
(
file
=
runstatistics
,
submit
=
cfg
$
runstatistics
)
message
(
"Created the id "
,
stats
$
id
)
# save stats locally (including id) otherwise it would generate a new id (and
# resubmit the results and the statistics) next time rds_report is executed
save
(
stats
,
file
=
runstatistics
,
compress
=
"xz"
)
}
# Save report to results archive
saveRDS
(
q
,
file
=
paste0
(
resultsarchive
,
"/"
,
stats
$
id
,
".rds"
))
cwd
<-
getwd
()
setwd
(
resultsarchive
)
system
(
"ls 1*.rds > files"
)
setwd
(
cwd
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment