|
| 1 | +#!/usr/bin/env python3 |
| 2 | +""" |
| 3 | +This script runs e3sm_diags with the lat_lon_native set to visualize native grid data. |
| 4 | +""" |
| 5 | + |
| 6 | +import os |
| 7 | +import sys |
| 8 | + |
| 9 | +from e3sm_diags.parameter.lat_lon_native_parameter import LatLonNativeParameter |
| 10 | +from e3sm_diags.run import runner |
| 11 | + |
| 12 | +# Auto-detect username |
| 13 | +username = os.environ.get('USER', 'unknown_user') |
| 14 | + |
| 15 | +# Create parameter objects for 3 different runs |
| 16 | +params = [] |
| 17 | + |
| 18 | +## (1) First test configuration |
| 19 | +#param1 = LatLonNativeParameter() |
| 20 | +#param1.results_dir = f"/lcrc/group/e3sm/public_html/diagnostic_output/{username}/tests/lat_lon_native_test_1" |
| 21 | +#param1.test_data_path = "/lcrc/group/e3sm/public_html/e3sm_diags_test_data/native_grid" |
| 22 | +#param1.test_name = "v3.LR.amip_0101" |
| 23 | +#param1.short_test_name = "v3.LR.amip_0101" |
| 24 | +#param1.reference_data_path = "/lcrc/group/e3sm/public_html/e3sm_diags_test_data/native_grid" |
| 25 | +#param1.ref_name = "v3.HR.test4" |
| 26 | +#param1.short_ref_name = "v3.HR.test4" |
| 27 | +#param1.seasons = ["DJF"] |
| 28 | +#param1.test_grid_file = "/lcrc/group/e3sm/diagnostics/grids/ne30pg2.nc" |
| 29 | +#param1.ref_grid_file = "/lcrc/group/e3sm/diagnostics/grids/ne120pg2.nc" |
| 30 | +#param1.case_id = "model_vs_model" |
| 31 | +#param1.run_type = "model_vs_model" |
| 32 | +#params.append(param1) |
| 33 | +# |
| 34 | +## (2) Second test configuration |
| 35 | +#param2 = LatLonNativeParameter() |
| 36 | +#param2.results_dir = f"/lcrc/group/e3sm/public_html/diagnostic_output/{username}/tests/lat_lon_native_test_2" |
| 37 | +#param2.test_data_path = "/lcrc/group/e3sm/public_html/e3sm_diags_test_data/native_grid" |
| 38 | +#param2.test_file = "v3.LR.amip_0101_DJF_climo.nc" |
| 39 | +#param2.short_test_name = "v3.LR.amip_0101" |
| 40 | +#param2.reference_data_path = "/lcrc/group/e3sm/public_html/e3sm_diags_test_data/native_grid" |
| 41 | +#param2.ref_file = "v3.HR.test4_DJF_climo.nc" |
| 42 | +#param2.short_ref_name = "v3.HR.test4" |
| 43 | +#param2.seasons = ["DJF"] |
| 44 | +#param2.test_grid_file = "/lcrc/group/e3sm/diagnostics/grids/ne30pg2.nc" |
| 45 | +#param2.ref_grid_file = "/lcrc/group/e3sm/diagnostics/grids/ne120pg2.nc" |
| 46 | +#param2.case_id = "model_vs_model" |
| 47 | +#param2.run_type = "model_vs_model" |
| 48 | +#params.append(param2) |
| 49 | + |
| 50 | +# (3) Third test configuration |
| 51 | +param3 = LatLonNativeParameter() |
| 52 | +param3.results_dir = f"/lcrc/group/e3sm/public_html/diagnostic_output/{username}/tests/lat_lon_native_test_3" |
| 53 | +param3.test_data_path = "/lcrc/group/e3sm/public_html/e3sm_diags_test_data/native_grid" |
| 54 | +param3.test_file = "v3.LR.amip_0101.eam.h0.1989-12.nc" |
| 55 | +param3.reference_data_path = "/lcrc/group/e3sm/public_html/e3sm_diags_test_data/native_grid" |
| 56 | +param3.ref_file = "v3.LR.amip_0101.eam.h0.1989-12.nc" |
| 57 | +param3.short_ref_name = "v3.HR.test4" |
| 58 | +param3.time_slices = ["0"] |
| 59 | +param3.test_grid_file = "/lcrc/group/e3sm/diagnostics/grids/ne30pg2.nc" |
| 60 | +param3.ref_grid_file = "/lcrc/group/e3sm/diagnostics/grids/ne30pg2.nc" |
| 61 | +param3.case_id = "model_vs_model" |
| 62 | +param3.run_type = "model_vs_model" |
| 63 | +params.append(param3) |
| 64 | + |
| 65 | +# Run the single diagnostic, comment out for complete diagnostics. |
| 66 | +cfg_path = "auxiliary_tools/debug/968-native-grid-vis/TGCLDLWP.cfg" |
| 67 | +sys.argv.extend(["--diags", cfg_path]) |
| 68 | + |
| 69 | +runner.sets_to_run = ["lat_lon_native"] |
| 70 | + |
| 71 | +# Run each test sequentially |
| 72 | +for i, param in enumerate(params, 1): |
| 73 | + print(f"\n{'='*60}") |
| 74 | + print(f"Running Test {i}: {param.results_dir}") |
| 75 | + print(f"{'='*60}") |
| 76 | + |
| 77 | + # Create results directory |
| 78 | + if not os.path.exists(param.results_dir): |
| 79 | + os.makedirs(param.results_dir) |
| 80 | + |
| 81 | + # Run the diagnostic |
| 82 | + runner.run_diags([param]) |
| 83 | + print(f"Test {i} completed!") |
| 84 | + |
| 85 | +print(f"\n{'='*60}") |
| 86 | +print("All tests completed!") |
| 87 | +print(f"{'='*60}") |
| 88 | + |
| 89 | + |
0 commit comments