1
1
module LandSimulationVisualizationExt
2
+
3
+ import ClimaLand. LandSimVis as LandSimVis
2
4
import ClimaDiagnostics
3
5
import ClimaAnalysis
4
6
import ClimaAnalysis. Visualize as viz
@@ -22,13 +24,13 @@ include("land_sim_vis/leaderboard/leaderboard.jl")
22
24
Uses the diagnostic output of the `sim` to create leaderboard plots, comparing the output of the simulation to the ``observations"
23
25
from ERA5 or ILAMB.
24
26
"""
25
- function make_leaderboard_plots (
27
+ function LandSimVis . make_leaderboard_plots (
26
28
sim:: ClimaLand.Simulations.LandSimulation ;
27
29
savedir = " ." ,
28
30
leaderboard_data_sources = [" ERA5" , " ILAMB" ],
29
31
)
30
32
model = sim. model
31
- make_leaderboard_plots (
33
+ LandSimVis . make_leaderboard_plots (
32
34
model,
33
35
ClimaLand. get_domain (model),
34
36
sim. diagnostics;
42
44
43
45
A default method for `make_leaderboard_plots` notifying the user that these plots have not been enable for their domain/model combination.
44
46
"""
45
- function make_leaderboard_plots (m, d, diag)
47
+ function LandSimVis . make_leaderboard_plots (m, d, diag)
46
48
@info " Leaderboard plots not configured for your model type and/or your model domain. Model type must be LandModel, and the domain must be global."
47
49
end
48
50
@@ -61,7 +63,7 @@ saves the output to files in `savedir`.
61
63
62
64
The first two arguments are used for dispatch only.
63
65
"""
64
- function make_leaderboard_plots (
66
+ function LandSimVis . make_leaderboard_plots (
65
67
model:: ClimaLand.LandModel ,
66
68
domain:: ClimaLand.Domains.SphericalShell ,
67
69
diagnostics;
@@ -113,7 +115,7 @@ be plotted at each level specified. Note that level = 1 corresponds to the top l
113
115
and that the function will error if you provide a level not included in the output.
114
116
Passing levels = nothing defaults to plotting surface values of 3D fields.
115
117
"""
116
- function make_heatmaps (
118
+ function LandSimVis . make_heatmaps (
117
119
sim:: ClimaLand.Simulations.LandSimulation ;
118
120
savedir = " ." ,
119
121
short_names = nothing ,
@@ -122,7 +124,7 @@ function make_heatmaps(
122
124
plot_name = " figures.pdf" ,
123
125
)
124
126
model = sim. model
125
- make_heatmaps (
127
+ LandSimVis . make_heatmaps (
126
128
model,
127
129
ClimaLand. get_domain (model),
128
130
sim. diagnostics;
@@ -134,7 +136,7 @@ function make_heatmaps(
134
136
)
135
137
end
136
138
137
- function make_heatmaps (
139
+ function LandSimVis . make_heatmaps (
138
140
model:: ClimaLand.AbstractModel ,
139
141
domain:: Union {
140
142
ClimaLand. Domains. SphericalShell,
@@ -155,10 +157,17 @@ function make_heatmaps(
155
157
elseif short_names isa Nothing
156
158
short_names = avail_short_names
157
159
end
158
- make_heatmaps (savedir, diagdir, short_names, date; plot_name, levels)
160
+ LandSimVis. make_heatmaps (
161
+ savedir,
162
+ diagdir,
163
+ short_names,
164
+ date;
165
+ plot_name,
166
+ levels,
167
+ )
159
168
end
160
169
161
- function make_heatmaps (
170
+ function LandSimVis . make_heatmaps (
162
171
model:: ClimaLand.AbstractModel ,
163
172
domain:: Union{ClimaLand.Domains.HybridBox, ClimaLand.Domains.Plane} ,
164
173
diagnostics;
@@ -176,7 +185,7 @@ function make_heatmaps(
176
185
elseif short_names isa Nothing
177
186
short_names = avail_short_names
178
187
end
179
- make_heatmaps (
188
+ LandSimVis . make_heatmaps (
180
189
savedir,
181
190
diagdir,
182
191
short_names,
@@ -192,7 +201,7 @@ function make_heatmaps(
192
201
end
193
202
194
203
195
- function make_heatmaps (
204
+ function LandSimVis . make_heatmaps (
196
205
model:: ClimaLand.AbstractModel ,
197
206
domain:: Union{ClimaLand.Domains.Point, ClimaLand.Domains.Column} ,
198
207
diagnostics;
@@ -223,14 +232,14 @@ Please note that
223
232
case all possible variables will be plotted
224
233
- The top layer of 3D variables is used for plotting.
225
234
"""
226
- function make_annual_timeseries (
235
+ function LandSimVis . make_annual_timeseries (
227
236
sim:: ClimaLand.Simulations.LandSimulation ;
228
237
savedir = " ." ,
229
238
short_names = nothing ,
230
239
plot_name = " annual_timeseries.pdf" ,
231
240
)
232
241
model = sim. model
233
- make_annual_timeseries (
242
+ LandSimVis . make_annual_timeseries (
234
243
ClimaLand. get_domain (model),
235
244
sim. diagnostics;
236
245
plot_name,
@@ -239,7 +248,7 @@ function make_annual_timeseries(
239
248
)
240
249
end
241
250
242
- function make_annual_timeseries (
251
+ function LandSimVis . make_annual_timeseries (
243
252
domain:: ClimaLand.Domains.AbstractDomain ,
244
253
diagnostics;
245
254
plot_name = " annual_timeseries.pdf" ,
@@ -249,7 +258,7 @@ function make_annual_timeseries(
249
258
@info " No method matching make_annual_timeseries for $domain ."
250
259
end
251
260
252
- function make_annual_timeseries (
261
+ function LandSimVis . make_annual_timeseries (
253
262
domain:: Union {
254
263
ClimaLand. Domains. SphericalShell,
255
264
ClimaLand. Domains. SphericalSurface,
@@ -302,7 +311,7 @@ Please note that
302
311
case all possible variables will be plotted
303
312
- The top layer of 3D variables is used for plotting.
304
313
"""
305
- function make_diurnal_timeseries (
314
+ function LandSimVis . make_diurnal_timeseries (
306
315
sim:: ClimaLand.Simulations.LandSimulation ;
307
316
savedir = " ." ,
308
317
short_names = nothing ,
@@ -311,7 +320,7 @@ function make_diurnal_timeseries(
311
320
spinup_date = sim. start_date,
312
321
)
313
322
model = sim. model
314
- make_diurnal_timeseries (
323
+ LandSimVis . make_diurnal_timeseries (
315
324
ClimaLand. get_domain (model),
316
325
sim. diagnostics,
317
326
sim. start_date;
@@ -323,7 +332,7 @@ function make_diurnal_timeseries(
323
332
)
324
333
end
325
334
326
- function make_diurnal_timeseries (
335
+ function LandSimVis . make_diurnal_timeseries (
327
336
domain:: ClimaLand.Domains.AbstractDomain ,
328
337
diagnostics,
329
338
start_date;
@@ -336,7 +345,7 @@ function make_diurnal_timeseries(
336
345
@info " No method matching make_diurnal_timeseries for $domain ."
337
346
end
338
347
339
- function make_diurnal_timeseries (
348
+ function LandSimVis . make_diurnal_timeseries (
340
349
domain:: Union{ClimaLand.Domains.Column, ClimaLand.Domains.Point} ,
341
350
diagnostics,
342
351
start_date;
@@ -354,7 +363,7 @@ function make_diurnal_timeseries(
354
363
short_names = avail_short_names
355
364
end
356
365
diag_ids = [findfirst (sn .== avail_short_names) for sn in short_names]
357
- make_diurnal_timeseries (
366
+ LandSimVis . make_diurnal_timeseries (
358
367
savedir,
359
368
diagnostics[diag_ids], # To be consistent with global/regional runs, this should be a directory with the saved diagnostics.
360
369
start_date;
@@ -391,7 +400,7 @@ Please note that
391
400
case all possible variables will be plotted
392
401
- The top layer of 3D variables is used for plotting.
393
402
"""
394
- function make_timeseries (
403
+ function LandSimVis . make_timeseries (
395
404
sim:: ClimaLand.Simulations.LandSimulation ;
396
405
savedir = " ." ,
397
406
short_names = nothing ,
@@ -400,7 +409,7 @@ function make_timeseries(
400
409
spinup_date = sim. start_date,
401
410
)
402
411
model = sim. model
403
- make_timeseries (
412
+ LandSimVis . make_timeseries (
404
413
ClimaLand. get_domain (model),
405
414
sim. diagnostics,
406
415
sim. start_date;
@@ -412,7 +421,7 @@ function make_timeseries(
412
421
)
413
422
end
414
423
415
- function make_timeseries (
424
+ function LandSimVis . make_timeseries (
416
425
domain:: ClimaLand.Domains.AbstractDomain ,
417
426
diagnostics,
418
427
start_date;
@@ -425,7 +434,7 @@ function make_timeseries(
425
434
@info " No method matching make_timeseries for $domain ."
426
435
end
427
436
428
- function make_timeseries (
437
+ function LandSimVis . make_timeseries (
429
438
domain:: Union{ClimaLand.Domains.Column, ClimaLand.Domains.Point} ,
430
439
diagnostics,
431
440
start_date;
@@ -443,7 +452,7 @@ function make_timeseries(
443
452
short_names = avail_short_names
444
453
end
445
454
diag_ids = [findfirst (sn .== avail_short_names) for sn in short_names]
446
- make_timeseries (
455
+ LandSimVis . make_timeseries (
447
456
savedir,
448
457
diagnostics[diag_ids],# To be consistent with global/regional runs, this should be a directory with the saved diagnostics.
449
458
start_date;
@@ -459,13 +468,13 @@ end
459
468
Creates a plot which assess conservation of energy and water by the simulation;
460
469
the outut is saved in `savedir`.
461
470
"""
462
- function check_conservation (
471
+ function LandSimVis . check_conservation (
463
472
sim:: ClimaLand.Simulations.LandSimulation ;
464
473
savedir = " ." ,
465
474
plot_name = " conservation_figures.pdf" ,
466
475
)
467
476
model = sim. model
468
- check_conservation (
477
+ LandSimVis . check_conservation (
469
478
model,
470
479
ClimaLand. get_domain (model),
471
480
sim. diagnostics,
@@ -474,19 +483,19 @@ function check_conservation(
474
483
)
475
484
end
476
485
477
- function check_conservation (m, d, diags, o, pn)
486
+ function LandSimVis . check_conservation (m, d, diags, o, pn)
478
487
@info " Conservation checks not configured for your model type and/or your model domain yet. Model type must be EnergyHydrology, and the domain must be global."
479
488
end
480
489
481
- function check_conservation (
490
+ function LandSimVis . check_conservation (
482
491
model:: ClimaLand.Soil.EnergyHydrology ,
483
492
domain:: ClimaLand.Domains.SphericalShell ,
484
493
diagnostics,
485
494
savedir,
486
495
plot_name,
487
496
)
488
497
diagdir = first (diagnostics). output_writer. output_dir
489
- check_conservation (savedir, diagdir; plot_name)
498
+ LandSimVis . check_conservation (savedir, diagdir; plot_name)
490
499
491
500
end
492
501
0 commit comments