Skip to content
Snippets Groups Projects
Commit 230facb6 authored by rhenry2's avatar rhenry2
Browse files

Merge branch 'master' of https://git.ecdf.ed.ac.uk/lul/plumv2

parents a607aceb 2c776864
No related branches found
No related tags found
No related merge requests found
...@@ -23,7 +23,7 @@ cropIntensitySummary = function (luDt, cropType) { ...@@ -23,7 +23,7 @@ cropIntensitySummary = function (luDt, cropType) {
area = sum(area))] 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)) 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]+") years = list.files(simDir, pattern="[0-9]+")
...@@ -57,20 +57,16 @@ summariseLandUseOutput = function(simDir, writeFile=TRUE) { ...@@ -57,20 +57,16 @@ summariseLandUseOutput = function(simDir, writeFile=TRUE) {
} else { } else {
print(paste("Can't find file, so skipping:", fileName)) print(paste("Can't find file, so skipping:", fileName))
} }
} }
write.table(resDt, file.path(simDir, "ukLC.csv"), sep=",", row.names=FALSE, quote=FALSE)
if (writeFile) write.table(resDt, file.path(simDir, "ukLC.csv"), sep=",", row.names=FALSE, quote=FALSE)
resDt resDt
} }
baseOutputDir="/exports/csce/eddie/geos/groups/LURG/models/PLUM/output" baseOutputDir="/exports/csce/eddie/geos/groups/LURG/models/PLUM/output"
ensemble = commandArgs(trailingOnly = TRUE)[1] for (directory in list.dirs(full.names = TRUE, recursive = FALSE)){
for (directory in list.dirs(path = file.path(baseOutputDir,ensemble), full.names = TRUE, recursive = FALSE)){
for (scenario in basename(list.dirs(path = directory, full.names = TRUE, recursive = FALSE))){ for (scenario in basename(list.dirs(path = directory, full.names = TRUE, recursive = FALSE))){
ensDir=file.path(directory,scenario) ensDir=file.path(directory,scenario)
if (dir.exists(ensDir)) { if (dir.exists(ensDir)) {
......
...@@ -8,9 +8,10 @@ if [ "$#" -ne 1 ]; then ...@@ -8,9 +8,10 @@ if [ "$#" -ne 1 ]; then
exit exit
fi fi
cd $1
source /etc/profile source /etc/profile
module load R 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 concatUKLCFile=ukLC_concat.txt
echo "Scenario,Year,IrrigCrops,FertCrops,Cropland,Pasture,ManForest,UnmanForest,Natural,AbPasture" > $concatUKLCFile 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