Skip to content

Commit bfd6ca1

Browse files
chengzhuzhangclaude
andcommitted
Update documentation for v3.1.0 features and parameters
This commit updates the documentation to reflect new features and parameters added in v3.1.0: 1. Updated available-parameters.rst: - Added time_slices parameter for snapshot analysis - Added lat_lon_native set-specific parameters (test_grid_file, ref_grid_file, antialiased) - Added test_file and ref_file parameters - Updated regrid_tool default from 'esmf' to 'xesmf' - Updated granulate default to include 'time_slices' - Updated sets default list to include all current diagnostic sets - Added notes about mutual exclusivity of time_slices and seasons 2. Updated examples.rst: - Added Example 8: Native Grid Visualization - Added Example 9: Snapshot Analysis for Core Sets - Updated running instructions to include new examples - Updated batch script example with ex8 and ex9 3. Created example files: - examples/ex8-native-grid-visualization/ (ex8.py, diags.cfg, README.md) - examples/ex9-snapshot-analysis/ (ex9.py, diags.cfg, README.md) These changes document the two major features introduced in v3.1.0: - Native grid visualization using UXarray - Snapshot analysis for core diagnostic sets using time_slices 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 5acb1eb commit bfd6ca1

File tree

8 files changed

+535
-5
lines changed

8 files changed

+535
-5
lines changed

docs/source/available-parameters.rst

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,18 @@ functionality of the diagnostics.
7070
- **regrid_method**: What regrid method of the regrid tool to use.
7171
Possible values are ``'linear'`` or ``'conservative'``. Default is ``'conservative'``.
7272
Read the xCDAT documentation on `regridding`_ for more information.
73-
- **regrid_tool**: The regrid tool to use. Default is ``'esmf'``.
73+
- **regrid_tool**: The regrid tool to use. Default is ``'xesmf'``.
7474
Read the xCDAT documentation on `regridding`_ for more information.
75+
**Note:** The ``lat_lon_native`` set does not use regridding, so this parameter is ignored for that set.
7576
- **seasons**: A list of season to use. Default is annual and all seasons: ``['ANN', 'DJF', 'MAM', 'JJA', 'SON']``.
77+
**Note:** This parameter is mutually exclusive with ``time_slices``. When using ``time_slices``, do not set ``seasons``.
78+
- **time_slices**: *(v3.1.0+)* A list of time indices for snapshot analysis. Examples: ``['0']``, ``['5']``, ``['0', '1', '2']``.
79+
Time slices are zero-based indices into the time dimension of the input dataset.
80+
This enables analysis of individual time steps instead of climatological means.
81+
**Note:** This parameter is mutually exclusive with ``seasons``. When using ``time_slices``, do not set ``seasons``.
82+
Supported sets: ``lat_lon``, ``lat_lon_native``, ``polar``, ``zonal_mean_2d``, ``meridional_mean_2d``, ``zonal_mean_2d_stratosphere``.
7683
- **sets**: A list of the sets to be run. Default is all sets:
77-
``['zonal_mean_xy', 'zonal_mean_2d', 'meridional_mean_2d', 'lat_lon', 'polar', 'area_mean_time_series', 'cosp_histogram', 'enso_diags', 'qbo', 'streamflow','diurnal_cycle']``.
84+
``['zonal_mean_xy', 'zonal_mean_2d', 'zonal_mean_2d_stratosphere', 'meridional_mean_2d', 'lat_lon', 'lat_lon_native', 'polar', 'area_mean_time_series', 'cosp_histogram', 'enso_diags', 'qbo', 'streamflow', 'diurnal_cycle', 'arm_diags', 'tc_analysis', 'annual_cycle_zonal_mean', 'lat_lon_land', 'lat_lon_river', 'aerosol_aeronet', 'aerosol_budget']``.
7885
- **variables**: What variable(s) to use for this run. Ex: ``variables=["T", "PRECT"]``.
7986

8087
.. _regridding: https://xcdat.readthedocs.io/en/latest/getting-started-guide/faqs.html#regridding
@@ -262,12 +269,30 @@ You can specify both ``test_end_yr`` and ``ref_end_yr`` or just ``end_yr``.
262269
- **plot_log_plevs**: Log-scale the y-axis. Default ``False``.
263270
- **plot_plevs**: Plot the pressure levels. Default ``False``.
264271

272+
``'lat_lon_native'`` *(v3.1.0+)*:
273+
274+
- **test_grid_file**: *(Required)* Path to the grid file for test data in UGRID format (e.g., ``'/path/to/ne30pg2.nc'``).
275+
The grid file defines the native grid structure used by UXarray for visualization.
276+
- **ref_grid_file**: Path to the grid file for reference data in UGRID format (e.g., ``'/path/to/ne30pg2.nc'``).
277+
Required for model vs model comparisons. Can be omitted for model-only runs.
278+
- **antialiased**: Apply antialiasing to the plot. Default ``False``. Setting to ``True`` may improve visual quality but can impact performance.
279+
- **time_slices**: Time indices for snapshot analysis (same as in core parameters). See ``time_slices`` description above.
280+
281+
**Notes for lat_lon_native:**
282+
283+
- Native grid visualization requires UXarray (included in E3SM Unified environment)
284+
- Grid files must be in UGRID format
285+
- Regridding parameters (``regrid_tool``, ``regrid_method``) are ignored for this set
286+
- Can use either ``seasons`` for climatology or ``time_slices`` for snapshot analysis (mutually exclusive)
265287

266288
Other parameters
267289
~~~~~~~~~~~~~~~~
268290

269291
- **dataset**: Default is ``''``.
270-
- **granulate**: Default is ``['variables', 'seasons', 'plevs', 'regions']``.
292+
- **granulate**: Default is ``['variables', 'seasons', 'plevs', 'regions', 'time_slices']``.
293+
This parameter controls how diagnostics are split into separate runs.
271294
- **selectors**: Default is ``['sets', 'seasons']``. See :ref:`Using the selectors parameter <selector-ex>`.
272295
- **viewer_descr**: Used to specify values in the viewer. Default ``{}``.
273296
- **fail_on_incomplete**: Exit status will reflect failure if any parameter fails to complete. Default is ``False`` (e.g., a failing parameter will not create a failing exit code).
297+
- **test_file**: *(v3.1.0+)* Specify the exact file name for test data. Useful for snapshot analysis with ``time_slices`` or when using specific data files.
298+
- **ref_file**: *(v3.1.0+)* Specify the exact file name for reference data. Useful for snapshot analysis with ``time_slices`` or when using specific data files.

docs/source/examples.rst

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,38 @@ on two different sets: ``zonal_mean_2d`` an ``lat_lon``.
9393
so you can compare different version of the data, or the same variable from different datasets.
9494
We are comparing CERES EBAF TOA version 2.8 and 4.0.
9595

96+
8. Native Grid Visualization (v3.1.0)
97+
--------------------------------------
98+
`This example <https://github.com/E3SM-Project/e3sm_diags/tree/master/examples/ex8-native-grid-visualization>`__ demonstrates how to visualize model data on its native grid
99+
(e.g., cubed-sphere, unstructured grids) without regridding to a regular lat-lon grid.
100+
This feature uses UXarray to preserve native grid features and is particularly useful for high-resolution models with complex grid structures.
101+
The example shows model vs model comparison using snapshot analysis on native grids.
102+
103+
**Key features:**
104+
105+
- Visualize data on native grids without regridding
106+
- Preserve native grid features and characteristics
107+
- Support for cubed-sphere and unstructured grids
108+
- Uses UXarray for grid-aware operations
109+
110+
9. Snapshot Analysis for Core Sets (v3.1.0)
111+
--------------------------------------------
112+
`This example <https://github.com/E3SM-Project/e3sm_diags/tree/master/examples/ex9-snapshot-analysis>`__ demonstrates time slice analysis on core diagnostic sets.
113+
Instead of computing climatological seasonal means, this analyzes individual time steps from model output using index-based time selection.
114+
115+
This is useful for analyzing specific events, comparing model states at particular time points,
116+
or understanding temporal evolution without time averaging. The example shows how to use the ``time_slices`` parameter
117+
on multiple diagnostic sets (lat_lon, zonal_mean_2d, polar, meridional_mean_2d, zonal_mean_2d_stratosphere).
118+
119+
**Key features:**
120+
121+
- Index-based time selection (e.g., time_slices = ["0", "1", "2"])
122+
- Analyze individual time steps without temporal averaging
123+
- Event-based or process-oriented diagnostics
124+
- Works across multiple core diagnostic sets
125+
126+
**Note:** ``time_slices`` and ``seasons`` parameters are mutually exclusive.
127+
96128
Running the Examples
97129
====================
98130

@@ -117,7 +149,7 @@ The parameters file contains information related to the location
117149
of the data, what years to run the diagnostics on, what plots to create, and more.
118150

119151
The configuration file provides information about the diagnostics you are running.
120-
This is used in Ex.4,5,7.
152+
This is used in Ex.4, 5, 7, 8, 9.
121153

122154
Parameters for each example can be found in
123155
`this directory <https://github.com/E3SM-Project/e3sm_diags/tree/master/examples>`__.
@@ -134,7 +166,7 @@ Use the code below to run the diagnostics.
134166
salloc --nodes 1 --qos interactive --time 01:00:00 --constraint cpu --account=e3sm
135167
# Enter the E3SM Unified environment. For Perlmutter CPU, the command to do this is:
136168
source /global/common/software/e3sm/anaconda_envs/load_latest_e3sm_unified_pm-cpu.sh
137-
# Running Ex.1. For examples 4,5,7 append ``-d diags.cfg``.
169+
# Running Ex.1. For examples 4, 5, 7, 8, 9 append ``-d diags.cfg``.
138170
python ex1.py --multiprocessing --num_workers=32
139171
# You may need to change permissions on your web directory to see the example output.
140172
chmod -R 755 <your web directory>
@@ -174,6 +206,8 @@ These were generated with the following script:
174206
# emacs ex5-model-vs-obs/ex5.py
175207
# emacs ex6-model-vs-obs-custom/ex6.py
176208
# emacs ex7-obs-vs-obs/ex7.py
209+
# emacs ex8-native-grid-visualization/ex8.py
210+
# emacs ex9-snapshot-analysis/ex9.py
177211
178212
source /global/common/software/e3sm/anaconda_envs/load_latest_e3sm_unified_pm-cpu.sh
179213
cd ex1-model_ts-vs-model_ts
@@ -190,6 +224,10 @@ These were generated with the following script:
190224
python ex6.py --multiprocessing --num_workers=32
191225
cd ../ex7-obs-vs-obs
192226
python ex7.py --multiprocessing --num_workers=32 -d diags.cfg
227+
cd ../ex8-native-grid-visualization
228+
python ex8.py --multiprocessing --num_workers=32 -d diags.cfg
229+
cd ../ex9-snapshot-analysis
230+
python ex9.py --multiprocessing --num_workers=32 -d diags.cfg
193231
cd ../
194232
195233
chmod -R 755 /global/cfs/cdirs/e3sm/www/forsyth/examples
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Example 8: Native Grid Visualization
2+
3+
This example demonstrates the **native grid visualization** feature introduced in **E3SM Diags v3.1.0**.
4+
5+
## What This Example Does
6+
7+
- Visualizes model data on native grids (e.g., cubed-sphere, unstructured grids)
8+
- Uses UXarray for grid-aware operations
9+
- Compares two models without regridding to a regular lat-lon grid
10+
- Preserves native grid features and characteristics
11+
12+
## Key Features
13+
14+
The native grid visualization capability:
15+
- Supports various native grid formats (cubed-sphere, unstructured, etc.)
16+
- Eliminates artifacts introduced by regridding
17+
- Enables comparison of models with different native grids
18+
- Particularly useful for high-resolution models
19+
20+
## Key Parameters
21+
22+
- `LatLonNativeParameter` - Required parameter class for native grid visualization
23+
- `test_grid_file` - Path to test model's grid file (UGRID format)
24+
- `ref_grid_file` - Path to reference model's grid file (optional for model-only runs)
25+
- `time_slices` - Use snapshot analysis instead of climatology (e.g., ["0"])
26+
- `antialiased` - Whether to apply antialiasing to the plot
27+
28+
## Data Requirements
29+
30+
This example uses test data located at LCRC:
31+
- Data path: `/lcrc/group/e3sm/public_html/e3sm_diags_test_data/native_grid`
32+
- Grid files: `/lcrc/group/e3sm/diagnostics/grids/`
33+
34+
For your own data, ensure you have:
35+
1. Model output files on native grid
36+
2. Corresponding grid files in UGRID format
37+
38+
## Running This Example
39+
40+
### Using the Python Script
41+
42+
```bash
43+
# Edit ex8.py to set your output directory
44+
# Update the `prefix` variable to point to your web directory
45+
46+
# Run with default settings
47+
python ex8.py
48+
49+
# Run with multiprocessing for better performance
50+
python ex8.py --multiprocessing --num_workers=32
51+
52+
# Run with custom configuration file
53+
python ex8.py -d diags.cfg --multiprocessing --num_workers=32
54+
```
55+
56+
### Using Command-Line Interface
57+
58+
```bash
59+
e3sm_diags lat_lon_native \
60+
--test_data_path /lcrc/group/e3sm/public_html/e3sm_diags_test_data/native_grid \
61+
--test_file v3.LR.amip_0101.eam.h0.1989-12.nc \
62+
--test_grid_file /lcrc/group/e3sm/diagnostics/grids/ne30pg2.nc \
63+
--reference_data_path /lcrc/group/e3sm/public_html/e3sm_diags_test_data/native_grid \
64+
--ref_file v3.LR.amip_0101.eam.h0.1989-12.nc \
65+
--ref_grid_file /lcrc/group/e3sm/diagnostics/grids/ne30pg2.nc \
66+
--results_dir /results/ex8_native_grid \
67+
--case_id model_vs_model \
68+
--time_slices 0 \
69+
--run_type model_vs_model
70+
```
71+
72+
## Configuration File
73+
74+
The `diags.cfg` file allows you to customize:
75+
- Variables to plot (e.g., TGCLDLWP)
76+
- Regions of interest
77+
- Colormap settings
78+
- Contour levels for test, reference, and difference plots
79+
80+
## Expected Output
81+
82+
The diagnostic will generate:
83+
- Native grid visualizations for specified variables
84+
- Test model plot
85+
- Reference model plot
86+
- Difference plot (Test - Reference)
87+
- HTML viewer for browsing results
88+
89+
Results will be saved in: `<your_directory>/ex8_native_grid/viewer/`
90+
91+
## Notes
92+
93+
- Native grid visualization requires UXarray library (included in E3SM Unified environment)
94+
- Grid files must be in UGRID format
95+
- This example uses `time_slices` for snapshot analysis; you can also use `seasons` for climatology
96+
- For model-only runs (no reference data), set `model_only = True` and omit ref_grid_file
97+
98+
## Differences from Regular lat_lon Set
99+
100+
Unlike the standard `lat_lon` set which regrids data to a regular lat-lon grid:
101+
- `lat_lon_native` preserves the original grid structure
102+
- No interpolation artifacts
103+
- Better representation of native grid features
104+
- Requires grid files in UGRID format
105+
106+
## More Information
107+
108+
For more details, see:
109+
- [E3SM Diags Documentation](https://e3sm-project.github.io/e3sm_diags)
110+
- [UXarray Documentation](https://uxarray.readthedocs.io/)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[#]
2+
sets = ["lat_lon_native"]
3+
case_id = "model_vs_model"
4+
variables = ["TGCLDLWP"]
5+
regions = ["global"]
6+
diff_colormap = "RdBu"
7+
contour_levels = [10, 25, 50, 75, 100, 125, 150, 175, 200, 225, 250]
8+
diff_levels = [-35, -30, -25, -20, -15, -10, -5, 5, 10, 15, 20, 25, 30, 35]
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Example 8: Native Grid Visualization
4+
5+
This example demonstrates how to visualize model data on its native grid
6+
(e.g., cubed-sphere, unstructured grids) using UXarray, without regridding
7+
to a regular lat-lon grid.
8+
9+
This preserves native grid features and is particularly useful for:
10+
- High-resolution models with complex grid structures
11+
- Comparing models with different native grids
12+
- Analyzing grid-dependent features
13+
14+
This feature was introduced in E3SM Diags v3.1.0.
15+
"""
16+
17+
import os
18+
19+
from e3sm_diags.parameter.lat_lon_native_parameter import LatLonNativeParameter
20+
from e3sm_diags.run import runner
21+
22+
# Create parameter object
23+
param = LatLonNativeParameter()
24+
25+
# Location of the data
26+
param.test_data_path = "/lcrc/group/e3sm/public_html/e3sm_diags_test_data/native_grid"
27+
param.test_file = "v3.LR.amip_0101.eam.h0.1989-12.nc"
28+
29+
param.reference_data_path = "/lcrc/group/e3sm/public_html/e3sm_diags_test_data/native_grid"
30+
param.ref_file = "v3.LR.amip_0101.eam.h0.1989-12.nc"
31+
32+
# Short names for display
33+
param.short_test_name = "v3.LR.amip_0101"
34+
param.short_ref_name = "v3.HR.test4"
35+
36+
# Native grid files
37+
# These specify the grid structure for native visualization
38+
param.test_grid_file = "/lcrc/group/e3sm/diagnostics/grids/ne30pg2.nc"
39+
param.ref_grid_file = "/lcrc/group/e3sm/diagnostics/grids/ne30pg2.nc"
40+
41+
# Time selection: use snapshot instead of climatology
42+
# Use time_slices to analyze a specific time index
43+
param.time_slices = ["0"] # First time step
44+
45+
# Comparison settings
46+
param.case_id = "model_vs_model"
47+
param.run_type = "model_vs_model"
48+
49+
# Antialiasing setting
50+
param.antialiased = False
51+
52+
# Name of the folder where the results are stored.
53+
# Change `prefix` to use your directory.
54+
prefix = "/global/cfs/cdirs/e3sm/www/<your directory>/examples"
55+
param.results_dir = os.path.join(prefix, "ex8_native_grid")
56+
57+
# Below are more optional arguments.
58+
59+
# For running with multiprocessing.
60+
# param.multiprocessing = True
61+
# param.num_workers = 32
62+
63+
# Run the diagnostic
64+
runner.sets_to_run = ["lat_lon_native"]
65+
runner.run_diags([param])

0 commit comments

Comments
 (0)