4
4
the input/output schema used by the unified modelling UI. *)
5
5
6
6
(* Exit whenever an error message is raised. *)
7
- messageHandler = If [Last [# ], Abort [ ]] & ;
7
+ messageHandler = If [Last [# ], Exit [ 1 ]] & ;
8
8
Internal ` AddHandler ["Message" , messageHandler ];
9
9
10
10
(* Command-line arguments: <inputFile> <outputFile> *)
@@ -116,7 +116,7 @@ translateInput[modelInput_]:=Module[{
116
116
117
117
(* TODO: These are copied from modules in data.wl,
118
118
and should be shared instead. *)
119
- smoothing = 3 ;
119
+ smoothing = 7 ;
120
120
SlowJoin := Fold [Module [{smoother },
121
121
smoother = 1 - Exp [- Range [Length [#2 ]]/ smoothing ];
122
122
Join [#1 , Last [#1 ](1 - smoother )+ #2 smoother ]]& ];
@@ -128,6 +128,14 @@ translateInput[modelInput_]:=Module[{
128
128
Assert [Length [fullDistancing ] == Length [fullDays ]];
129
129
Off [Assert ];
130
130
131
+ distancingDelay = 5 ;
132
+ Which [
133
+ distancingDelay > 0 ,
134
+ smoothedFullDistancing = Join [ConstantArray [1 ,distancingDelay ], smoothedFullDistancing [[;; - distancingDelay - 1 ]]]; ,
135
+ distancingDelay < 0 ,
136
+ smoothedFullDistancing = Join [smoothedFullDistancing [[distancingDelay + 1 ;; ]], ConstantArray [1 ,Abs [distancingDelay ]]];
137
+ ];
138
+
131
139
distancingFunction = Interpolation [
132
140
Transpose [{
133
141
fullDays ,
@@ -241,11 +249,12 @@ Print["Running model"];
241
249
CreateDirectory ["public/json/" <> stateCode <> "/" <> scenario1 ["id" ]];
242
250
CreateDirectory ["public/json/" <> stateCode <> "/" <> customScenario ["id" ]];
243
251
CreateDirectory ["tests" ];
244
- data = GenerateModelExport [10 , {stateCode }];
252
+ data = GenerateModelExport [1 , {stateCode }];
245
253
246
254
Print ["Translating output for unified UI" ];
247
255
timeSeriesData = data [stateCode ]["scenarios" ][customScenario ["id" ]]["timeSeriesData" ];
248
256
modelOutput = translateOutput [modelInput , stateCode , timeSeriesData ];
249
257
250
258
Print ["Writing output for unified UI to " , outputFile ];
251
- Export [outputFile , modelOutput ];
259
+ Export [DirectoryName [outputFile ] <> "/rawTimeSeries.json" , timeSeriesData ];
260
+ Export [outputFile , modelOutput ];
0 commit comments