Skip to content
Snippets Groups Projects
Commit 2c776864 authored by HENRY Roslyn's avatar HENRY Roslyn
Browse files

changes for summarising UK land use script

parent 72b28e6c
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@ cropIntensitySummary = function (luDt, cropType) {
area = sum(area))]
}
summariseLandUseOutput = function(simDir, writeFile=TRUE) {
summariseLandUseOutput = function(simDir) {
countryCells = data.table(read.table("/exports/csce/eddie/geos/groups/LURG/models/PLUM/plumv2/data/halfdeg/ukCells.txt", header=TRUE))
years = list.files(simDir, pattern="[0-9]+")
......@@ -57,20 +57,16 @@ summariseLandUseOutput = function(simDir, writeFile=TRUE) {
} else {
print(paste("Can't find file, so skipping:", fileName))
}
}
if (writeFile) write.table(resDt, file.path(simDir, "ukLC.csv"), sep=",", row.names=FALSE, quote=FALSE)
write.table(resDt, file.path(simDir, "ukLC.csv"), sep=",", row.names=FALSE, quote=FALSE)
resDt
}
baseOutputDir="/exports/csce/eddie/geos/groups/LURG/models/PLUM/output"
ensemble = commandArgs(trailingOnly = TRUE)[1]
for (directory in list.dirs(path = file.path(baseOutputDir,ensemble), full.names = TRUE, recursive = FALSE)){
for (directory in list.dirs(full.names = TRUE, recursive = FALSE)){
for (scenario in basename(list.dirs(path = directory, full.names = TRUE, recursive = FALSE))){
ensDir=file.path(directory,scenario)
if (dir.exists(ensDir)) {
......
......@@ -8,9 +8,10 @@ if [ "$#" -ne 1 ]; then
exit
fi
cd $1
source /etc/profile
module load R
R < /exports/csce/eddie/geos/groups/LURG/models/PLUM/plumv2/scripts/summariseUKlanduse.R --no-save $1
R < /exports/csce/eddie/geos/groups/LURG/models/PLUM/plumv2/scripts/summariseUKlanduse.R --no-save
concatUKLCFile=ukLC_concat.txt
echo "Scenario,Year,IrrigCrops,FertCrops,Cropland,Pasture,ManForest,UnmanForest,Natural,AbPasture" > $concatUKLCFile
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment