Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PLUM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Land Use Lab
PLUM
Commits
b3ebcd05
Commit
b3ebcd05
authored
7 years ago
by
Peter Alexander
Browse files
Options
Downloads
Patches
Plain Diff
Cluster scripts updated
parent
cef322ed
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
scripts/concatOutputLc.sh
+9
-0
9 additions, 0 deletions
scripts/concatOutputLc.sh
scripts/runPlum.sh
+11
-1
11 additions, 1 deletion
scripts/runPlum.sh
scripts/summariseLandUseOneSim.R
+71
-0
71 additions, 0 deletions
scripts/summariseLandUseOneSim.R
with
91 additions
and
1 deletion
scripts/concatOutputLc.sh
+
9
−
0
View file @
b3ebcd05
...
...
@@ -7,8 +7,10 @@ fi
cd
$1
concatLcFile
=
lc_concat.txt
concatPriceFile
=
price_concat.txt
concatLUFile
=
LandUseSummary.csv
echo
"Scenario,Year,Cropland,Pasture,ManForest,UnmanForest,Natural,EnergyCrop,FertCrop,IrrigCrop"
>
$concatLcFile
echo
"Scenario,Year,Crop,Imports,Exports,Price,Stocks"
>
$concatPriceFile
echo
"Scenario,cropType,yield,irrig,fert,otherint,area,Year"
>
$concatLUFile
find
.
-name
"*lc.txt"
|while
read
fname
;
do
scenarioDir
=
"
$(
dirname
$fname
)
"
...
...
@@ -29,4 +31,11 @@ find . -name "*lc.txt"|while read fname; do
test
$j
-eq
1
&&
((
j
=
j+1
))
&&
continue
echo
"
${
scenario
}
,
$line
"
>>
$concatPriceFile
done
<
$scenarioDir
/prices.txt
k
=
1
while
read
-r
line
do
test
$k
-eq
1
&&
((
k
=
k+1
))
&&
continue
echo
"
${
scenario
}
,
$line
"
>>
$concatLUFile
done
<
$scenarioDir
/LandUseSummary.csv
done
This diff is collapsed.
Click to expand it.
scripts/runPlum.sh
+
11
−
1
View file @
b3ebcd05
...
...
@@ -4,7 +4,7 @@
#$ -l h_vmem=8G
#$ -R y
if
[
$#
-
ne
1
]
;
then
if
[
$#
-
lt
1
]
;
then
echo
need 1 argument to specify config/output directory
exit
0
fi
...
...
@@ -21,3 +21,13 @@ echo "starting"
java
-Xmx1G
-XX
:+PrintGC
-classpath
/exports/csce/eddie/geos/groups/LURG/models/gams/gams24.7_linux_x64_64_sfx/apifiles/Java/api/GAMSJavaAPI.jar:/exports/csce/eddie/geos/groups/LURG/models/PLUM/classes
-DBUILDVER
=
$buildver
-DCONFIG_FILE
=
/exports/csce/eddie/geos/groups/LURG/models/PLUM/output/
$1
/config.properties ac.ed.lurg.ModelMain
echo
"finished"
module load R
R < /exports/csce/eddie/geos/groups/LURG/models/PLUM/plumv2/scripts/summariseLandUseOneSim.R
--no-save
--args
$1
if
[[
$*
==
*
-NoP
*
]]
;
then
echo
"Not pruning outputs"
else
echo
"Pruning outputs, to save disk space"
/exports/csce/eddie/geos/groups/LURG/models/PLUM/plumv2/scripts/pruneOutputs.sh /exports/csce/eddie/geos/groups/LURG/models/PLUM/output/
$1
fi
This diff is collapsed.
Click to expand it.
scripts/summariseLandUseOneSim.R
0 → 100644
+
71
−
0
View file @
b3ebcd05
require
(
data.table
)
cropIntensitySummary
=
function
(
luDt
,
cropType
)
{
yDt
=
luDt
[
cropland
>
0
,
list
(
irrig
=
get
(
paste0
(
cropType
,
'_IQ'
)),
fert
=
get
(
paste0
(
cropType
,
'_FQ'
)),
otherint
=
get
(
paste0
(
cropType
,
'_OI'
)),
thisCropFact
=
get
(
paste0
(
cropType
,
'_A'
)),
allCropFact
=
cropland
/
area
,
area
=
get
(
paste0
(
cropType
,
'_A'
))
*
cropland
,
yield
=
get
(
paste0
(
cropType
,
'_Y'
)))
]
# yDt[thisCropFact>0.05 & allCropFact > 0.03, list(cropType = cropType, yield=sum(area * yield)/sum(area),
yDt
[
thisCropFact
>
0
,
list
(
cropType
=
cropType
,
yield
=
sum
(
area
*
yield
)
/
sum
(
area
),
irrig
=
sum
(
area
*
irrig
)
/
sum
(
area
),
fert
=
sum
(
area
*
fert
)
/
sum
(
area
),
otherint
=
sum
(
area
*
otherint
)
/
sum
(
area
),
area
=
sum
(
area
))
]
}
summariseLandUseOutput
=
function
(
simDir
,
writeFile
=
TRUE
)
{
years
=
list.files
(
simDir
,
pattern
=
"[0-9]+"
)
cropSumDt
=
NULL
for
(
year
in
years
)
{
fileName
=
file.path
(
simDir
,
year
,
'LandUse.txt'
)
if
(
file.exists
(
fileName
))
{
print
(
paste
(
"Processing"
,
year
,
"from"
,
fileName
))
luDt
=
data.table
(
read.table
(
fileName
,
header
=
TRUE
))
for
(
cropType
in
c
(
'maize'
,
'rice'
,
'wheat'
,
'energycrops'
,
'oilcrops'
,
'pulses'
,
'starchyRoots'
))
{
cropSummary
=
cropIntensitySummary
(
luDt
,
cropType
)
if
(
nrow
(
cropSummary
)
>
0
)
cropSumDt
=
rbind
(
cropSumDt
,
cbind
(
cropSummary
,
year
=
year
))
}
}
else
{
print
(
paste
(
"Can't find file, so skipping:"
,
fileName
))
}
}
resDt
=
rbind
(
cropSumDt
,
cropSumDt
[
cropType
!=
'energycrops'
,
list
(
cropType
=
'avgExcEC'
,
yield
=
sum
(
yield
*
area
)
/
sum
(
area
),
irrig
=
sum
(
irrig
*
area
)
/
sum
(
area
),
fert
=
sum
(
fert
*
area
)
/
sum
(
area
),
otherint
=
sum
(
otherint
*
area
)
/
sum
(
area
),
area
=
sum
(
area
)),
by
=
year
])
resDt
=
rbind
(
resDt
,
cropSumDt
[,
list
(
cropType
=
'avgIncEC'
,
yield
=
sum
(
yield
*
area
)
/
sum
(
area
),
irrig
=
sum
(
irrig
*
area
)
/
sum
(
area
),
fert
=
sum
(
fert
*
area
)
/
sum
(
area
),
otherint
=
sum
(
otherint
*
area
)
/
sum
(
area
),
area
=
sum
(
area
)),
by
=
year
])
if
(
writeFile
)
write.table
(
resDt
,
file.path
(
simDir
,
"LandUseSummary.csv"
),
sep
=
","
,
row.names
=
FALSE
,
quote
=
FALSE
)
resDt
}
baseOutputDir
=
"/exports/csce/eddie/geos/groups/LURG/models/PLUM/output"
# "~/Downloads"
ensemble
=
commandArgs
(
trailingOnly
=
TRUE
)[
1
]
ensDir
=
file.path
(
baseOutputDir
,
ensemble
)
if
(
dir.exists
(
ensDir
))
{
print
(
paste
(
ensDir
,
"exists. Processing"
))
summariseLandUseOutput
(
simDir
=
ensDir
)
}
else
{
print
(
paste
(
ensDir
,
"does not exist. Stopping"
))
}
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