Skip to content

test_card_file

Functions:

all_datatypes

all_datatypes()
Source code in tests/test_card_file.py
14
15
16
@pytest.fixture
def all_datatypes():
    return _load_file("all_datatypes.card")

config

config()
Source code in tests/test_card_file.py
60
61
62
@pytest.fixture
def config():
    return _load_file("config.card.r7417")

dynamico

dynamico()
Source code in tests/test_card_file.py
130
131
132
@pytest.fixture
def dynamico():
    return _load_file("dynamico.card.r7417")

lmdz

lmdz()
Source code in tests/test_card_file.py
207
208
209
@pytest.fixture
def lmdz():
    return _load_file("lmdz.card.r7417")

orchidee

orchidee()
Source code in tests/test_card_file.py
363
364
365
@pytest.fixture
def orchidee():
    return _load_file("orchidee.card.r7417")

test_card

test_card()
Source code in tests/test_card_file.py
587
588
589
@pytest.fixture
def test_card():
    return _load_file("TestFile.card")

test_dumps_loads_all_datatypes

test_dumps_loads_all_datatypes(all_datatypes)
Source code in tests/test_card_file.py
56
57
def test_dumps_loads_all_datatypes(all_datatypes):
    assert all_datatypes == loads(dumps(all_datatypes))

test_dumps_loads_config

test_dumps_loads_config(config)
Source code in tests/test_card_file.py
126
127
def test_dumps_loads_config(config):
    assert config == loads(dumps(config))

test_dumps_loads_dynamico

test_dumps_loads_dynamico(dynamico)
Source code in tests/test_card_file.py
203
204
def test_dumps_loads_dynamico(dynamico):
    assert dynamico == loads(dumps(dynamico))

test_dumps_loads_lmdz

test_dumps_loads_lmdz(lmdz)
Source code in tests/test_card_file.py
359
360
def test_dumps_loads_lmdz(lmdz):
    assert lmdz == loads(dumps(lmdz))

test_dumps_loads_orchidee

test_dumps_loads_orchidee(orchidee)
Source code in tests/test_card_file.py
583
584
def test_dumps_loads_orchidee(orchidee):
    assert orchidee == loads(dumps(orchidee))

test_dumps_loads_test_card

test_dumps_loads_test_card(test_card)
Source code in tests/test_card_file.py
615
616
def test_dumps_loads_test_card(test_card):
    assert test_card == loads(dumps(test_card))

test_dumps_loads_xios

test_dumps_loads_xios(xios)
Source code in tests/test_card_file.py
640
641
def test_dumps_loads_xios(xios):
    assert xios == loads(dumps(xios))

test_empty_content

test_empty_content()
Source code in tests/test_card_file.py
644
645
646
def test_empty_content():
    assert loads("") == {}
    assert loads(dumps({})) == {}

test_empty_content_with_ws

test_empty_content_with_ws()
Source code in tests/test_card_file.py
649
650
def test_empty_content_with_ws():
    assert loads("\t\n\t   \n  \t") == {}

test_empty_section

test_empty_section()
Source code in tests/test_card_file.py
661
662
663
664
def test_empty_section():
    empty_section = {"section1": {}}
    assert loads("[section1]") == empty_section
    assert loads(dumps(empty_section)) == empty_section

test_empty_with_comment

test_empty_with_comment()
Source code in tests/test_card_file.py
653
654
def test_empty_with_comment():
    assert loads("# This is just a comment") == {}

test_empty_with_comments

test_empty_with_comments()
Source code in tests/test_card_file.py
657
658
def test_empty_with_comments():
    assert loads("# This is just a comment\n# And another one!") == {}

test_invalid_missing_section

test_invalid_missing_section()
Source code in tests/test_card_file.py
672
673
674
def test_invalid_missing_section():
    with pytest.raises(ValueError, match="must contain .* key-value pairs inside a section"):
        loads("k=3")

test_load_all_datatypes

test_load_all_datatypes(all_datatypes)
Source code in tests/test_card_file.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
def test_load_all_datatypes(all_datatypes):
    assert all_datatypes == {
        "empty_section": {},
        "logical": {
            "y1": True,
            "y2": True,
            "y3": True,
            "y4": True,
            "n1": False,
            "n2": False,
            "n3": False,
            "n4": False,
        },
        "list": {
            "l1": [],
            "l2": [[], []],
            "l3": [[], [], []],
            "l4": [1],
            "l5": [[], [1]],
            "l6": [[], [1], []],
            "l7": [1, True, False, "text", '"text2"'],
            "l8": ["${SUBMIT_DIR}/PARAM/XIOS/iodef.xml", "."],
            "l9": ["${SUBMIT_DIR}/PARAM/XIOS/iodef.xml", ".", (1, 10, 100)],
        },
        "date": {"begin": "2024-06-01", "end": "2024-06-30"},
        "path": {
            "file1": "${SUBMIT_DIR}/../${year}/some_file.ext",
            "file2": '"${SUBMIT_DIR}/../${year}/some_file.ext"',
            "file3": ".",
        },
        "empty": {"e1": None, "e2": None, "e3": None},
        "empty_section2": {},
        "string": {"n1": "OFF", "n2": '"(text)"'},
        "special": {"integer_range": (100, 1, 200)},
    }

test_load_config

test_load_config(config)
Source code in tests/test_card_file.py
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
def test_load_config(config):
    assert config == {
        "Compatibility": {"libIGCM": 1.0},
        "UserChoices": {
            "JobName": "CREATE-AMIP.01",
            "LongName": '"create_etat0_limit for interannuel amip run"',
            "TagName": "ICOLMDZOR",
            "SpaceName": "DEVT",
            "ExperimentName": "CE0L",
            "ExpType": "ICOLMDZOR/LAM/CREATE_amip",
            "CalendarType": "leap",
            "DateBegin": "2000-06-01",
            "DateEnd": "2000-06-05",
            "PeriodLength": "5D",
            "CompressionLevel": 2,
            "EnvFile": "${SUBMIT_DIR}/../ARCH/arch.env",
            "OptMode": "prod",
        },
        "ListOfComponents": {
            "ICO": ["dynamico", "DYNAMICO"],
            "ATM": ["lmdz", "LMDZ6"],
            "IOS": ["xios", "XIOS3"],
        },
        "Executable": {
            "ICO": ["icosa_lmdz_orch22_${OptMode}.exe", "icosa_lmdz.exe", "640MPI"],
            "ATM": ['""', '""'],
            "IOS": ["xios_server_${OptMode}.exe", "xios.x", "2MPI"],
        },
        "Restarts": {
            "OverRule": False,
            "RestartDate": None,
            "RestartJobName": None,
            "RestartPath": None,
        },
        "ICO": {
            "Restart": False,
            "RestartDate": None,
            "RestartJobName": None,
            "RestartPath": None,
        },
        "ATM": {
            "Restart": False,
            "RestartDate": None,
            "RestartJobName": None,
            "RestartPath": None,
        },
        "IOS": {
            "Restart": False,
            "RestartDate": None,
            "RestartJobName": None,
            "RestartPath": None,
        },
        "Post": {
            "MetricsPCMDI": False,
            "PackFrequency": None,
            "SeasonalFrequency": None,
            "TimeSeriesFrequency": None,
        },
    }

test_load_dynamico

test_load_dynamico(dynamico)
Source code in tests/test_card_file.py
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
def test_load_dynamico(dynamico):
    assert dynamico == {
        "Compatibility": {"libIGCM": 1.0},
        "UserChoices": {
            "RESOL_NBP": 80,
            "RESOL_ATM_Z": 79,
            "etat0": "database",
            "create_etat0_limit": True,
            "iflag_phys": 1,
        },
        "InitialStateFiles": {"List": []},
        "BoundaryFiles": {"List": [], "ListNonDel": []},
        "SmoothFiles": {"List": []},
        "ParametersFiles": {
            "List": [
                ["${SUBMIT_DIR}/PARAM/DYNAMICO/earth_const.def", "."],
                [
                    "${SUBMIT_DIR}/PARAM/DYNAMICO/LAM/run_dynamico_global_France.def",
                    "run_dynamico.def",
                ],
                [
                    "${MODIPSL}/modeles/DYNAMICO/xml/DYNAMICO_XML/sponge_dynamico.xml",
                    ".",
                ],
                [
                    "${MODIPSL}/modeles/DYNAMICO/xml/DYNAMICO_XML/context_dynamico.xml",
                    ".",
                ],
                [
                    "${MODIPSL}/modeles/DYNAMICO/xml/DYNAMICO_XML/context_input_dynamico.xml",
                    ".",
                ],
                [
                    "${MODIPSL}/modeles/DYNAMICO/xml/DYNAMICO_XML/field_def_dynamico.xml",
                    ".",
                ],
                ["${MODIPSL}/modeles/ICOSA_LMDZ/xml/XML_XIOS3/param_gw.xml", "."],
                [
                    "${MODIPSL}/modeles/DYNAMICO/xml/DYNAMICO_XML/file_def_dynamico.xml",
                    ".",
                ],
            ]
        },
        "RestartFiles": {"List": [None]},
        "OutputText": {
            "List": [
                "run_dynamico.def",
                "earth_const.def",
                "iodef.xml",
                "context_dynamico.xml",
                "context_input_dynamico.xml",
                "field_def_dynamico.xml",
                "file_def_dynamico.xml",
                "out_icosa_lmdz.exe.out*",
                "out_icosa_lmdz.exe.err*",
                "xios_client_*",
            ]
        },
        "OutputFiles": {
            "List": [
                "start0.nc",
                "${R_OUT_ICO_O}/Restart/${config_UserChoices_JobName}_${year}_start.nc",
                None,
            ]
        },
    }

test_load_lmdz

test_load_lmdz(lmdz)
Source code in tests/test_card_file.py
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
def test_load_lmdz(lmdz):
    assert lmdz == {
        "Compatibility": {"libIGCM": 1.0},
        "UserChoices": {
            "LMDZ_Physics": "NPv6.2",
            "flag_aerosol": 0,
            "ok_ade": False,
            "ok_aie": False,
            "aerosol_couple": False,
            "read_climoz": 0,
            "ok_cdnc": False,
            "flag_aerosol_strat": 0,
        },
        "InitialStateFiles": {"List": []},
        "BoundaryFiles": {
            "List": [
                [
                    "${R_IN}/ATM/LIMIT/AMIP.v20180427/original/360x180.v2/BCS/amipbc_sst_360x180_${year}.nc",
                    "amipbc_sst_1x1.nc",
                ],
                [
                    "${R_IN}/ATM/LIMIT/AMIP.v20180427/original/360x180.v2/BCS/amipbc_sic_360x180_${year}.nc",
                    "amipbc_sic_1x1.nc",
                ],
                [
                    "${R_IN}/ATM/OZONE/UReading/historical.v20160711.v2/original/144x96x66/tro3_${year}.nc",
                    "climoz.nc",
                ],
            ],
            "ListNonDel": [
                ["${R_IN}/ATM/INPUT_CE0L/Albedo4_deg.nc", "Albedo.nc"],
                ["${R_IN}/ATM/INPUT_CE0L/ECDYN4.nc", "ECDYN.nc"],
                ["${R_IN}/ATM/INPUT_CE0L/ECDYN4.nc", "ECPHY.nc"],
                [
                    "${R_IN}/ATM/INPUT_CE0L/Relief_GMTED2010_15n015_00625deg_plus_GA.nc",
                    "Relief.nc",
                ],
                ["${R_IN}/ATM/INPUT_CE0L/landiceref_GA_HR.new.nc", "landiceref.nc"],
                ["${R_IN}/ATM/INPUT_CE0L/Rugos4_deg.nc", "Rugos.nc"],
                [
                    "${R_IN}/ATM/INPUT_CE0L/OROGRAPHY/orography_nbp${RESOL_NBP}.nc",
                    "orography.nc",
                ],
                [
                    "${R_IN}/ATM/START/LAND_WATER_FRACTION/land_water_0.25.nc",
                    "land_water.nc",
                ],
                [
                    "${MODIPSL}/modeles/LMDZ/DefLists/context_lmdz_xios3.xml",
                    "context_lmdz.xml",
                ],
                [
                    "${MODIPSL}/modeles/LMDZ/DefLists/context_input_lmdz_xios3.xml",
                    "context_input_lmdz.xml",
                ],
                ["${MODIPSL}/modeles/LMDZ/DefLists/field_def_lmdz.xml", "."],
                ["${MODIPSL}/modeles/LMDZ/DefLists/field_def_cosp1.xml", "."],
                ["${MODIPSL}/modeles/LMDZ/DefLists/file_def_histmth_lmdz.xml", "."],
                ["${MODIPSL}/modeles/LMDZ/DefLists/file_def_histmthCOSP_lmdz.xml", "."],
                ["${MODIPSL}/modeles/LMDZ/DefLists/file_def_histmthNMC_lmdz.xml", "."],
                ["${MODIPSL}/modeles/LMDZ/DefLists/file_def_histday_lmdz.xml", "."],
                ["${MODIPSL}/modeles/LMDZ/DefLists/file_def_histdayCOSP_lmdz.xml", "."],
                ["${MODIPSL}/modeles/LMDZ/DefLists/file_def_histdayNMC_lmdz.xml", "."],
                ["${MODIPSL}/modeles/LMDZ/DefLists/file_def_histhf_lmdz.xml", "."],
                ["${MODIPSL}/modeles/LMDZ/DefLists/file_def_histhfCOSP_lmdz.xml", "."],
                ["${MODIPSL}/modeles/LMDZ/DefLists/file_def_histhfNMC_lmdz.xml", "."],
                ["${MODIPSL}/modeles/LMDZ/DefLists/file_def_histstn_lmdz.xml", "."],
                ["${MODIPSL}/modeles/LMDZ/DefLists/file_def_histins_lmdz.xml", "."],
                [
                    "${MODIPSL}/modeles/LMDZ/DefLists/file_def_histstrataer_lmdz.xml",
                    ".",
                ],
                [
                    "${MODIPSL}/modeles/LMDZ/DefLists/file_def_histdaystrataer_lmdz.xml",
                    ".",
                ],
                ["${MODIPSL}/modeles/LMDZ/DefLists/file_def_histLES_lmdz.xml", "."],
                [
                    "${R_IN}/ATM/AEROSOLS/CMIP6/v1/144x142/L${RESOL_ATM_Z}/aerosols1850_from_inca.nc",
                    "aerosols.nat.nc",
                ],
                [
                    "${R_IN}/ATM/AEROSOLS/CMIP6/v1/144x142/L${RESOL_ATM_Z}/aerosols1995_from_inca.nc",
                    "aerosols1980.nc",
                ],
                [
                    "${R_IN}/ATM/STRATAERO/CMIP6/v3/144x142/L${RESOL_ATM_Z}/taulwstrat.2D.ave.nc",
                    "taulwstrat.2D.nc",
                ],
                [
                    "${R_IN}/ATM/STRATAERO/CMIP6/v3/144x142/L${RESOL_ATM_Z}/tauswstrat.2D.ave.nc",
                    "tauswstrat.2D.nc",
                ],
            ],
        },
        "ParametersFiles": {
            "List": [
                ["${SUBMIT_DIR}/PARAM/LMDZ/physiq.def_${LMDZ_Physics}", "physiq.def"],
                ["${SUBMIT_DIR}/PARAM/LMDZ/vert.def_L${RESOL_ATM_Z}", "vert.def"],
                ["${SUBMIT_DIR}/PARAM/LMDZ/config.def_actuel", "config.def"],
                ["${SUBMIT_DIR}/PARAM/LMDZ/run.def", "."],
                ["${SUBMIT_DIR}/PARAM/LMDZ/tracer.def", "."],
            ]
        },
        "RestartFiles": {"List": [None]},
        "OutputText": {
            "List": [
                "physiq.def",
                "gcm.def",
                "vert.def",
                "run.def",
                "config.def",
                "tracer.def",
                "guide.def",
                "context_lmdz.xml",
                "context_input_lmdz.xml",
                "field_def_lmdz.xml",
                "file_def_*lmdz.xml",
            ]
        },
        "OutputFiles": {
            "List": [
                [
                    "limit.nc",
                    "${R_OUT_ATM_O}/Boundary/${config_UserChoices_JobName}_${year}_limit.nc",
                    None,
                ],
                [
                    "climoz_LMDZ.nc",
                    "${R_OUT_ATM_O}/Boundary/${config_UserChoices_JobName}_${year}_climoz_LMDZ.nc",
                    None,
                ],
                [
                    "startphy.nc",
                    "${R_OUT_ATM_O}/Restart/${config_UserChoices_JobName}_${year}_startphy.nc",
                    None,
                ],
                [
                    "grid_atm.nc",
                    "${R_OUT_ATM_O}/Grid/${config_UserChoices_JobName}_${year}_grid_atm.nc",
                    None,
                ],
            ]
        },
    }

test_load_orchidee

test_load_orchidee(orchidee)
Source code in tests/test_card_file.py
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
def test_load_orchidee(orchidee):
    assert orchidee == {
        "Compatibility": {"libIGCM": 1.0},
        "UserChoices": {
            "AtmCo2": 369.12,
            "DefSuffix": "15pft.1ac",
            "VEGET_UPDATE_at_start": False,
            "VEGET_UPDATE": "0Y",
            "ROUTING": "interp_topo",
            "output_level_sechiba_history": 5,
            "output_level_sechiba_out_2": None,
            "output_level_sechiba_history_4dim": None,
            "output_level_diag_routing": 1,
            "output_level_diag_routing_r": 1,
            "output_level_forcing_by_ORCHIDEE": None,
            "output_freq_sechiba_history": "1mo",
            "output_freq_sechiba_out_2": "1d",
            "output_freq_sechiba_history_4dim": "1mo",
        },
        "InitialStateFiles": {
            "List": [
                ["${R_IN}/SRF/SOIL/soil_bulk_and_ph.nc", "."],
                [
                    "${R_IN}/SRF/SOIL/soils_param_usda_with_clay_oxisol_coord.nc",
                    "soils_param.nc",
                ],
                ["${R_IN}/SRF/SOIL/soils_param_zobler_coord.nc", "soilcolor.nc"],
                ["${R_IN}/SRF/cartepente2d_15min4.nc", "cartepente2d_15min.nc"],
                ["${R_IN}/SRF/reftemp4.nc", "reftemp.nc"],
                ["${R_IN}/SRF/albedo/alb_bg_optv4c_nonsmoothedvis.nc", "alb_bg.nc"],
                [
                    "${R_IN}/SRF/PFTMAPS/CMIP6/ESA-LUH2v2/historical/15PFT.v2023.1/PFTmap_2000.nc",
                    "PFTmap.nc",
                ],
            ]
        },
        "BoundaryFiles": {
            "List": [],
            "ListNonDel": ["${R_IN}/SRF/ROUTING/routing_simple.nc", "routing.nc"],
        },
        "SmoothFiles": {"List": []},
        "ParametersFiles": {
            "List": [
                ["${SUBMIT_DIR}/PARAM/ORCHIDEE/orchidee.def_v4", "orchidee.def"],
                [
                    "${SUBMIT_DIR}/PARAM/ORCHIDEE/orchidee_pft.def_${DefSuffix}_v4",
                    "orchidee_pft.def",
                ],
                ["${MODIPSL}/modeles/ORCHIDEE_4/src_xml/file_def_orchidee.xml", "."],
                [
                    "${MODIPSL}/modeles/ORCHIDEE_4/src_xml/context_input_orchidee.xml",
                    ".",
                ],
                ["${MODIPSL}/modeles/ORCHIDEE_4/src_xml/context_orchidee.xml", "."],
                [
                    "${MODIPSL}/modeles/ORCHIDEE_4/src_xml/context_routing_interp_topo_v0_orchidee_xios3.xml",
                    "context_routing_interp_topo_v0_orchidee.xml",
                ],
                [
                    "${MODIPSL}/modeles/ORCHIDEE_4/src_xml/context_routing_interp_topo_orchidee_xios3.xml",
                    "context_routing_interp_topo_orchidee.xml",
                ],
                [
                    "${MODIPSL}/modeles/ORCHIDEE_4/src_xml/context_init_routing_interp_topo_orchidee.xml",
                    ".",
                ],
                ["${MODIPSL}/modeles/ORCHIDEE_4/src_xml/field_def_orchidee.xml", "."],
            ]
        },
        "RestartFiles": {
            "List": [
                ["sechiba_rest_out.nc", "sechiba_rest.nc", "sechiba_rest_in.nc"],
                ["routing_restart.nc", "routing_restart.nc", "routing_start.nc"],
            ]
        },
        "OutputText": {
            "List": [
                "out_orchidee*",
                "orchidee.def",
                "orchidee_pft.def",
                "used_orchidee.def",
                "used_orchidee_pft.def",
                "iodef.xml",
                "context_orchidee.xml",
                "context_input_orchidee.xml",
                "context_routing_interp_topo_v0_orchidee.xml",
                "context_routing_interp_topo_orchidee.xml",
                "context_init_routing_interp_topo_orchidee.xml",
                "field_def_orchidee.xml",
                "file_def_orchidee.xml",
                "river_desc.nc",
            ]
        },
        "OutputFiles": {
            "List": [
                [
                    "sechiba_history.nc",
                    "${R_OUT_SRF_O_M}/${PREFIX}_1M_sechiba_history.nc",
                    "Post_1M_sechiba_history",
                ],
                [
                    "sechiba_history_4dim.nc",
                    "${R_OUT_SRF_O_M}/${PREFIX}_1M_sechiba_history_4dim.nc",
                    None,
                ],
                [
                    "sechiba_out_2.nc",
                    "${R_OUT_SRF_O_H}/${PREFIX}_HF_sechiba_out_2.nc",
                    None,
                ],
                [
                    "ORCHIDEE_interp_diag.nc",
                    "${R_OUT_SRF_O_D}/${PREFIX}_ORCHIDEE_interp_diag.nc",
                    None,
                ],
                [
                    "forcing_by_ORCHIDEE.nc",
                    "${R_OUT_SRF_O_H}/${PREFIX}_forcing_by_ORCHIDEE.nc",
                    None,
                ],
                [
                    "diag_routing.nc",
                    "${R_OUT_SRF_O_D}/${PREFIX}_1D_sechiba_routing.nc",
                    None,
                ],
                [
                    "diag_routing_r.nc",
                    "${R_OUT_SRF_O_D}/${PREFIX}_1D_sechiba_routing_r.nc",
                    None,
                ],
            ]
        },
        "Post_1M_sechiba_history": {
            "Patches": [],
            "GatherWithInternal": [
                "lon",
                "lat",
                "time_counter",
                "Areas",
                "Contfrac",
                "time_centered",
                "time_centered_bounds",
            ],
            "TimeSeriesVars2D": [
                "nobiofrac",
                "alb_nir",
                "alb_vis",
                "evap",
                "fluxlat",
                "fluxsens",
                "rain",
                "runoff",
                "snow",
                "snowf",
                "frac_snow",
                "subli",
                "tair",
                "temp_sol",
                "drainage",
                "humtot_top",
                "mrso",
                "TWBR",
                "riverflow",
                "coastalflow",
                "DelSoilMoist_daily",
                "DelIntercept_daily",
                "DelSWE_daily",
                "delstock_routing_daily",
                "LAImean",
                "transpir",
                "evapnu",
                "lwdown",
                "swdown",
                "gppCrop",
                "rhCrop",
                "Ca",
            ],
            "ChunckJob2D": None,
            "TimeSeriesVars3D": [
                "lai",
                "maxvegetfrac",
                "vegetfrac",
                "nee",
                "gpp",
                "growth_resp",
                "hetero_resp",
                "humrel",
                "inter",
                "maint_resp",
                "npp",
                "precisol",
            ],
            "ChunckJob3D": None,
            "Seasonal": "ON",
        },
        "Post_HF_sechiba_out_2": {
            "Patches": [],
            "GatherWithInternal": [
                "lon",
                "lat",
                "time_counter",
                "Areas",
                "Contfrac",
                "time_centered",
                "time_centered_bounds",
            ],
            "TimeSeriesVars2D": [],
            "ChunckJob2D": None,
            "TimeSeriesVars3D": ["snowdz", "snowtemp", "snowrho"],
            "ChunckJob3D": None,
            "Seasonal": "OFF",
        },
    }

test_load_test_card

test_load_test_card(test_card)
Source code in tests/test_card_file.py
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
def test_load_test_card(test_card):
    assert test_card == {
        "Messages": {
            "Option1": '"Hello Earth"',
            "Option2": '"Hello Mars"',
            "ListVal1": [],
            "ListVal2": [],
            "ListVal3": [],
        },
        "Recipes": {"Cake": '"file1.doc"', "Starter": '"file2.doc"'},
        "ColorValues": {"Red": 120, "Blue": 230, "Green": 178, "AnotherRed": 234},
        "Couples": {
            "List1": [
                ["up", "down"],
                ["humid", "dry"],
                ["hot", "cold"],
                ["far", "close"],
            ],
            "List2": ["ice", "fire", "air", "water"],
        },
    }

test_load_xios

test_load_xios(xios)
Source code in tests/test_card_file.py
624
625
626
627
628
629
630
631
632
633
634
635
636
637
def test_load_xios(xios):
    assert xios == {
        "Compatibility": {"libIGCM": 1.0},
        "UserChoices": {},
        "InitialStateFiles": {"List": []},
        "BoundaryFiles": {"List": [], "ListNonDel": []},
        "SmoothFiles": {"List": []},
        "ParametersFiles": {"List": ["${SUBMIT_DIR}/PARAM/XIOS/iodef.xml", "."]},
        "RestartFiles": {"List": [None]},
        "OutputText": {
            "List": ["xios_client_*", "out_xios.x.err.*", "out_xios.x.out.*"]
        },
        "OutputFiles": {"List": []},
    }

test_two_empty_sections

test_two_empty_sections()
Source code in tests/test_card_file.py
667
668
669
670
def test_two_empty_sections():
    empty_sections = {"section1": {}, "section2": {}}
    assert loads("[section2]\n[section1]") == empty_sections
    assert loads(dumps(empty_sections)) == empty_sections

xios

xios()
Source code in tests/test_card_file.py
619
620
621
@pytest.fixture
def xios():
    return _load_file("xios.card.r7417")