Skip to content

Commit c8cfd0c

Browse files
authored
Format files using DocumentFormat
1 parent fe9ea5f commit c8cfd0c

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/ciamhelper.jl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ function write_ciam(model; outputdir::String=joinpath(@__DIR__, "..", "output"),
463463
#^-- broken in v1.6 -> v1.10 Julia update
464464
#v-- works in v1.10 for `missing` cases...?
465465
temp[!, :ciam_country] .= missing
466-
temp[!, :ciam_country] .= coalesce.(temp[!, :ciam_country], [get(segRgnDict, temp.segments[i], missing) for i in axes(temp, 1)])
466+
temp[!, :ciam_country] .= coalesce.(temp[!, :ciam_country], [get(segRgnDict, temp.segments[i], missing) for i in axes(temp, 1)])
467467
#temp.ciam_country .= coalesce.(temp.ciam_country, [segRgnDict[temp.segments[i]] for i in axes(temp, 1)])
468468
end
469469

@@ -482,8 +482,8 @@ function write_ciam(model; outputdir::String=joinpath(@__DIR__, "..", "output"),
482482
ntime = model[:slrcost, :ntsteps]
483483
segID = model[:slrcost, :segID]
484484
colnames = Symbol.(segID_to_seg(Int64.(segID), segmap))
485-
486-
485+
486+
487487
for j in 1:length(vargroup2)
488488

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

523523
if j == 1 && k == 1
@@ -567,10 +567,10 @@ function write_optimal_costs(model; outputdir::String=joinpath(@__DIR__, "..", "
567567
# 1. Create aggregate adaptation decision DF
568568
temp1 = getdataframe(model, :slrcost => :OptimalCost)
569569
#temp1 = temp1 |> @map(merge(_, {ciam_country = segRgnDict[_.segments]})) |> DataFrame
570-
temp1[!,:ciam_country] .= missing
570+
temp1[!, :ciam_country] .= missing
571571
temp1[!, :ciam_country] .= coalesce.(temp1[!, :ciam_country], [get(segRgnDict, temp1.segments[i], missing) for i in axes(temp1, 1)])
572572
#temp1.ciam_country .= coalesce.(temp1.ciam_country, [segRgnDict[temp1.segments[i]] for i in axes(temp1,1)])
573-
573+
574574
temp2 = getdataframe(model, :slrcost => :OptimalLevel)
575575
temp3 = getdataframe(model, :slrcost => :OptimalOption)
576576

@@ -583,7 +583,7 @@ function write_optimal_costs(model; outputdir::String=joinpath(@__DIR__, "..", "
583583
# Replace OptimalOption numeric value with string
584584
lookup = Dict{Any,Any}(-2.0 => "RetreatCost", -1.0 => "ProtectCost", -3.0 => "NoAdaptCost")
585585
#out = out |> @map(merge(_, {variable = lookup[_.OptimalOption]})) |> DataFrame
586-
out[!,:variable] .= missing
586+
out[!, :variable] .= missing
587587
out[!, :variable] .= coalesce.(out[!, :variable], [get(lookup, out.OptimalOption[i], missing) for i in axes(out, 1)])
588588

589589
rename!(out, Dict(:OptimalLevel => :level))
@@ -601,7 +601,7 @@ function write_optimal_costs(model; outputdir::String=joinpath(@__DIR__, "..", "
601601

602602
temp = getdataframe(model, :slrcost => vars[i])
603603
#temp = temp |> @map(merge(_, {ciam_country = segRgnDict[_.segments]})) |> DataFrame
604-
temp[!,:ciam_country] .= missing
604+
temp[!, :ciam_country] .= missing
605605
temp[!, :ciam_country] .= coalesce.(temp[!, :ciam_country], [get(segRgnDict, temp.segments[i], missing) for i in axes(temp, 1)])
606606

607607
temp[!, :variable] = fill(String(vars[i]), nrow(temp))
@@ -616,7 +616,7 @@ function write_optimal_costs(model; outputdir::String=joinpath(@__DIR__, "..", "
616616
# Replace OptimalOption numeric value with string
617617
lookup = Dict{Any,Any}(-2.0 => "RetreatCost", -1.0 => "ProtectCost", -3.0 => "NoAdaptCost")
618618
#out = out |> @map(merge(_, {AdaptCategory = lookup[_.OptimalOption]})) |> DataFrame
619-
out[!,:AdaptCategory] .= missing
619+
out[!, :AdaptCategory] .= missing
620620
out[!, :AdaptCategory] .= coalesce.(out[!, :AdaptCategory], [get(lookup, out.OptimalOption[i], missing) for i in axes(out, 1)])
621621

622622
rename!(out, Dict(:OptimalLevel => :level))
@@ -737,12 +737,12 @@ function getTimeSeries(model, ensnum; segIDs=false, rgns=false, sumsegs="global"
737737
temp = MimiCIAM.getdataframe(model, :slrcost => vars[i])
738738
#temp = temp |> @map(merge(_, {ciam_country = segRgnDict[_.segments][1], segID = segRgnDict[_.segments][2]})) |> DataFrame
739739
# ^-- breaking in v1.6->v1.10 switch. Try:
740-
temp[!,:ciam_country] .= missing
741-
temp.ciam_country .= coalesce.(temp.ciam_country, [segRgnDict[temp.segments[i]][1] for i in axes(temp,1)])
740+
temp[!, :ciam_country] .= missing
741+
temp.ciam_country .= coalesce.(temp.ciam_country, [segRgnDict[temp.segments[i]][1] for i in axes(temp, 1)])
742742
#temp[!,:ciam_country] .= coalesce.(temp.ciam_country, [segRgnDict[temp.segments[i]][1] for i in axes(temp, 1)])
743-
temp[!,:segID] .= missing
744-
temp.segID .= coalesce.(temp.segID, [segRgnDict[temp.segments[i]][2] for i in axes(temp,1)])
745-
743+
temp[!, :segID] .= missing
744+
temp.segID .= coalesce.(temp.segID, [segRgnDict[temp.segments[i]][2] for i in axes(temp, 1)])
745+
746746
#temp[!,:costtype]= String(vars[i])
747747

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

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

0 commit comments

Comments
 (0)