Skip to content

Commit 9cefe58

Browse files
authored
Format files using DocumentFormat
1 parent 5c67cf5 commit 9cefe58

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/ciamhelper.jl

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,8 @@ function write_ciam(model; outputdir::String=joinpath(@__DIR__, "..", "output"),
480480
ntime = model[:slrcost, :ntsteps]
481481
segID = model[:slrcost, :segID]
482482
colnames = Symbol.(segID_to_seg(Int64.(segID), segmap))
483-
484-
483+
484+
485485
for j in 1:length(vargroup2)
486486

487487
ndim1 = size(model[:slrcost, vargroup2[j]])[3]
@@ -512,9 +512,9 @@ function write_ciam(model; outputdir::String=joinpath(@__DIR__, "..", "output"),
512512
#temp = temp |> @map(merge(_, {ciam_country = segRgnDict[_.segments]})) |> DataFrame
513513
#^-- broken in v1.6 -> v1.10 Julia update
514514
#v-- works in v1.10 need to modify for addition as opposed to missing...?
515-
temp[!,:ciam_country] .= missing
516-
temp.ciam_country .= coalesce.(temp.ciam_country, [segRgnDict[temp.segments[i]] for i in axes(temp,1)])
517-
515+
temp[!, :ciam_country] .= missing
516+
temp.ciam_country .= coalesce.(temp.ciam_country, [segRgnDict[temp.segments[i]] for i in axes(temp, 1)])
517+
518518
temp = temp[!, [:time, :ciam_country, :segments, :level, :variable, :value]]
519519

520520
if j == 1 && k == 1
@@ -564,8 +564,8 @@ function write_optimal_costs(model; outputdir::String=joinpath(@__DIR__, "..", "
564564
# 1. Create aggregate adaptation decision DF
565565
temp1 = getdataframe(model, :slrcost => :OptimalCost)
566566
#temp1 = temp1 |> @map(merge(_, {ciam_country = segRgnDict[_.segments]})) |> DataFrame
567-
temp1[!,:ciam_country] .= missing
568-
temp1.ciam_country .= coalesce.(temp1.ciam_country, [segRgnDict[temp1.segments[i]] for i in axes(temp1,1)])
567+
temp1[!, :ciam_country] .= missing
568+
temp1.ciam_country .= coalesce.(temp1.ciam_country, [segRgnDict[temp1.segments[i]] for i in axes(temp1, 1)])
569569

570570
temp2 = getdataframe(model, :slrcost => :OptimalLevel)
571571
temp3 = getdataframe(model, :slrcost => :OptimalOption)
@@ -579,9 +579,9 @@ function write_optimal_costs(model; outputdir::String=joinpath(@__DIR__, "..", "
579579
# Replace OptimalOption numeric value with string
580580
lookup = Dict{Any,Any}(-2.0 => "RetreatCost", -1.0 => "ProtectCost", -3.0 => "NoAdaptCost")
581581
#out = out |> @map(merge(_, {variable = lookup[_.OptimalOption]})) |> DataFrame
582-
out[!,:variable] .= missing
583-
out.variable .= coalesce.(out.variable, [lookup[out.OptimalOption[i]] for i in axes(out,1)])
584-
582+
out[!, :variable] .= missing
583+
out.variable .= coalesce.(out.variable, [lookup[out.OptimalOption[i]] for i in axes(out, 1)])
584+
585585
rename!(out, Dict(:OptimalLevel => :level))
586586
out = out[!, [:time, :ciam_country, :segments, :variable, :level, :OptimalCost]]
587587

@@ -597,9 +597,9 @@ function write_optimal_costs(model; outputdir::String=joinpath(@__DIR__, "..", "
597597

598598
temp = getdataframe(model, :slrcost => vars[i])
599599
#temp = temp |> @map(merge(_, {ciam_country = segRgnDict[_.segments]})) |> DataFrame
600-
temp[!,:ciam_country] .= missing
601-
temp.ciam_country .= coalesce.(temp.ciam_country, [segRgnDict[temp.segments[i]] for i in axes(temp,1)])
602-
600+
temp[!, :ciam_country] .= missing
601+
temp.ciam_country .= coalesce.(temp.ciam_country, [segRgnDict[temp.segments[i]] for i in axes(temp, 1)])
602+
603603
temp[!, :variable] = fill(String(vars[i]), nrow(temp))
604604

605605
temp2 = getdataframe(model, :slrcost => :OptimalLevel)
@@ -612,8 +612,8 @@ function write_optimal_costs(model; outputdir::String=joinpath(@__DIR__, "..", "
612612
# Replace OptimalOption numeric value with string
613613
lookup = Dict{Any,Any}(-2.0 => "RetreatCost", -1.0 => "ProtectCost", -3.0 => "NoAdaptCost")
614614
#out = out |> @map(merge(_, {AdaptCategory = lookup[_.OptimalOption]})) |> DataFrame
615-
out[!,:AdaptCategory] .= missing
616-
out.AdaptCategory .= coalesce.(out.AdaptCategory, [lookup[out.OptimalOption[i]] for i in axes(out,1)])
615+
out[!, :AdaptCategory] .= missing
616+
out.AdaptCategory .= coalesce.(out.AdaptCategory, [lookup[out.OptimalOption[i]] for i in axes(out, 1)])
617617

618618
rename!(out, Dict(:OptimalLevel => :level))
619619
rename!(out, vars[i] => :value)
@@ -733,12 +733,12 @@ function getTimeSeries(model, ensnum; segIDs=false, rgns=false, sumsegs="global"
733733
temp = MimiCIAM.getdataframe(model, :slrcost => vars[i])
734734
#temp = temp |> @map(merge(_, {ciam_country = segRgnDict[_.segments][1], segID = segRgnDict[_.segments][2]})) |> DataFrame
735735
# ^-- breaking in v1.6->v1.10 switch. Try:
736-
temp[!,:ciam_country] .= missing
737-
temp.ciam_country .= coalesce.(temp.ciam_country, [segRgnDict[temp.segments[i]][1] for i in axes(temp,1)])
736+
temp[!, :ciam_country] .= missing
737+
temp.ciam_country .= coalesce.(temp.ciam_country, [segRgnDict[temp.segments[i]][1] for i in axes(temp, 1)])
738738
#temp[!,:ciam_country] .= coalesce.(temp.ciam_country, [segRgnDict[temp.segments[i]][1] for i in axes(temp, 1)])
739-
temp[!,:segID] .= missing
740-
temp.segID .= coalesce.(temp.segID, [segRgnDict[temp.segments[i]][2] for i in axes(temp,1)])
741-
739+
temp[!, :segID] .= missing
740+
temp.segID .= coalesce.(temp.segID, [segRgnDict[temp.segments[i]][2] for i in axes(temp, 1)])
741+
742742
#temp[!,:costtype]= String(vars[i])
743743

744744
temp2 = MimiCIAM.getdataframe(model, :slrcost => :OptimalLevel)
@@ -756,8 +756,8 @@ function getTimeSeries(model, ensnum; segIDs=false, rgns=false, sumsegs="global"
756756
lookup = Dict{Any,Any}(-2.0 => "Retreat", -1.0 => "Protection", -3.0 => "No Adaptation")
757757
#out = out |> @map(merge(_, {category = lookup[_.OptimalOption]})) |> DataFrame
758758
# ^-- breaking in v1.6->v1.10 swithc. Try:
759-
out[!,:category] .= missing
760-
out.category .= coalesce.(out.category, [lookup[out.OptimalOption[i]] for i in axes(out,1)])
759+
out[!, :category] .= missing
760+
out.category .= coalesce.(out.category, [lookup[out.OptimalOption[i]] for i in axes(out, 1)])
761761

762762
rename!(out, Dict(:OptimalLevel => :level))
763763
rename!(out, vars[i] => :cost)

0 commit comments

Comments
 (0)