Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Apply EMC² to an E3SM Hindcast Output

This notebook shows how to apply EMC² to Energy Exascale Earth System Model (E3SM) outputs over the DOE Atmospheric Radiation Measurement (ARM) Facility’s North Slope of Alaska (NSA) site.

This notebook looks at generating simulated High Spectral Resolution Lidar (HSRL) and Ka ARM Zenith Radar (KAZR) moments from the model outputs from E3SM for comparison against observations.

Imports

Initializing Instrument Class Objects

EMC² provides instrument classes for both the KAZR and HSRL that are used as inputs for the simulator. These instrument classes are generated by the cell below.

We begin by initalizing an instrument object for the KAZR and one for the HSRL. EMC^2 contains templates for these instruments in emc2.core.instruments.KAZR for KAZR and emc2.core.instruments.HSRL for the HSRL.

Instrument class generation done!

Select One E3SM NSA Case

Here, we will look at the E3SM hindcast from 2016-08-17 over the ARM North Slope of Alaska (NSA) site. Let’s first specify the location of our run.

Generate an emc2.core.model.E3SM object

Instead of explicitly using the xarray package to load the data, EMC² can automatically load the data file when generating an emc2.core.model.E3SM object. By using EMC² to load a large-scale model’s output, we are able to handle 2 potential issues exemplified in the examined E3SM output file:

  1. Because E3SM operates a cube-sphere grid, data is not provided in a strict lat-lon grid (two spatial dimensions) but rather on a column basis (one spatial dimension). We need to inform EMC² about that by setting all_appended_in_lat=True.

  2. The regional output file has appended strings at the end of every field name, the result of post-processing machinery. By setting appended_str=True, EMC² can remove these strings by using one of EMC²’s internal methods invoked during initialization.

Let’s generate an emc2.core.model.E3SM object and examine how the loaded data file is shown after initialization as an xr.Dataset object.

./NSA_hindcast3days_v1_test_0929_20160817.cam.h1.2016-08-17-00000.nc is a regional output dataset; Stacking the time, lat, and lon dims for processing with EMC^2.
Loading...
['cl', 'ci', 'pl', 'pi']

What time periods do we have available?

Loading...

Running the Subcolumn Generator and Instrument Simulator

Now, we use the emc2.simulator.main.make_simulated_data method to have EMC² perform a set of (optional) tasks:

  1. Generate user-specified number of subcolumns per model grid cell.

  2. Run the instrument simualtor.

  3. Classify hydrometeor phase using the simulated observables.

We first call the emc2.simulator.main.make_simulated_data method to calculate the HSRL observables and then call it again to calcualte the KAZR observables (without invoking the subcolumn generator methods again).

Note that because the model output contains the spatial dimension stacked onto the time dimension, we wish to unstack these dimensions once all simualtor operations are done by setting unstack_dims=True.

## Creating subcolumns...
No convective processing for E3SM
Now performing parallel stratiform hydrometeor allocation in subcolumns
Fully overcast cl & ci in 386 voxels
Done! total processing time = 10.12s
Now performing parallel strat precipitation allocation in subcolumns
Fully overcast pl & pi in 227 voxels
Done! total processing time = 8.82s
Generating lidar moments...
Generating stratiform lidar variables using radiation logic
2-D interpolation of bulk liq lidar backscattering using mu-lambda values
2-D interpolation of bulk liq lidar extinction using mu-lambda values
2-D interpolation of bulk liq lidar backscattering using mu-lambda values
2-D interpolation of bulk liq lidar extinction using mu-lambda values
Done! total processing time = 0.24s
lidar processing done!
## Creating subcolumns...
No convective processing for E3SM
Now performing parallel stratiform hydrometeor allocation in subcolumns
Fully overcast cl & ci in 386 voxels
Done! total processing time = 9.32s
Now performing parallel strat precipitation allocation in subcolumns
Fully overcast pl & pi in 227 voxels
Done! total processing time = 9.84s
Generating radar moments...
Generating stratiform radar variables using radiation logic
2-D interpolation of bulk liq radar backscattering using mu-lambda values
2-D interpolation of bulk liq radar extinction using mu-lambda values
2-D interpolation of bulk liq radar backscattering using mu-lambda values
2-D interpolation of bulk liq radar extinction using mu-lambda values
Done! total processing time = 0.19s
Unstacking the time dimension (time, lat, and lon dimensions)
radar processing done!

Visualization

We can plot EMC² output using matplotlib, xarray’s internal methods, or EMC²’s emc2.plotting.SubcolumnDisplay object, which is based on the ACT package. Here, using the SubcolumnDisplay’s plot_subcolumn_timeseries method, we show the height x time curtain of the first subcolumn (out of the 50 specified) in the grid cell closest to the coordinates of the Utqiagvik specified using the lat_sel and lon_sel keywords. The hatch patterns invoked by setting hatched_mask=True, designate subcolumn bins not detected by the simulated instrument.

cropping lat dim (lat requested = 71.32)
<Figure size 1500x500 with 8 Axes>

For a given subcolumn, we can also plot the output from one of the phase classification algorithms (HSRL-based classification in this case) by using the plot_subcolumn_timeseries method followed by calling the change_plot_to_class_mask.

Another option is to use the phase classification output and the emc2.simulator.classification.calculate_phase_ratio method to calcualte the hydrometeor phase partitioning based on all subcolumns, which we can then plot. Here, we also use the SubcolumnDisplay’s fig.savefig method to save the figure as a PNG file.

New in 2023 - Lawrence Livermore National Laboratory’s added statistics module

Jingjing Tian of Lawrence Livermore National National Laboratory created several new features for EMC^2 to have it support calculating and plotting CFADS, Lidar Scattering Ratio, and cloud fraction in each column. In addition, she improved EMC^2’s capability to plot subcolumn timeseries for viewing the time evolution of the cloud microphysics and simulated radar and lidar parameters.

Input mixing ratios

This code will display the input mixing ratio timeseries that is used to generate the subcolumns. This is useful to validate your inputs for the radar simulations as well as to determine the mass of the different water and ice hydrometeor species in E3SM. This first block of code sets the input parameters for the mixing ratio plots, including the fields to plot, the location of NSA, and the plot properties.

The bottom two lines of code will use EMC^2’s SubcolumnDisplay object to show the mixing ratios in each subcolumn.

cropping lat dim (lat requested = 71.32)
<Figure size 3000x500 with 8 Axes>

Let’s plot all of the subcolumns as a timeseries.

To plot subcolumn mixing ratio from E3SM in a time series, we use: emc2.statistics_LLNL.statistical_plots.plot_every_subcolumn_timeseries_mixingratio

<Figure size 1200x2400 with 8 Axes>

CFAD Calculation

Generate the needed radar and lidar variables for calculating the lidar scatter ratio and cloud fraction. Here, we calculate molecular attenuation atb_total_4D, the height of half/full beam attenuation z_full_km_3D/z_half_km_3D, and the attenuation corrected reflectivity Ze_att_total_4D.

Calculate lidar scatter ratio (SR)

This code will generate the lidar scatter ratio based off of the E3SM-generated microphysics values. It calls emc2.statistics_LLNL.statistical_aggregation.calculate_SR.

Here we generate the parameters needed for inputs for the SR calculator, including the number of subcolumns, time periods, and vertical levels.

Plot time series of SR

We can plot the timeseries of SR in every subcolumn with emc2.statistics_LLNL.statistical_plots.plot_every_subcolumn_timeseries_SR.

<Figure size 1200x600 with 2 Axes>

Plot CFAD

Generate CFADs (contour frequency by altitude diagrams) of lidar scatter ratio. First we specify the histogram bins.

Then, calculate the CFADs from the E3SM data.

(40, 15)

Plot our CFADS! We can see that the distribution is highly

<Figure size 500x800 with 2 Axes>

Plotting the radar reflectivity and lidar backscatter side by side!

Finally, another useful plotting function is to plot the simulated radar and lidar moments side by side. For this, we have emc2.statistics_LLNL.statistical_plots.plot_every_subcolumn_timeseries_radarlidarsignal, which will plot the radar reflectivity and lidar backscatter side by side.

Here, we can see that liquid at the cloud base is attenuating the lidar signal. However, the reflectivity gives us a better picture of the ice and liquid precipitation above cloud base.

<Figure size 1200x1200 with 4 Axes>

Resources and References

References
  1. Silber, I., Jackson, R. C., Fridlind, A. M., Ackerman, A. S., Collis, S., Verlinde, J., & Ding, J. (2022). The Earth Model Column Collaboratory (EMC 2 ) v1.1: an open-source ground-based lidar and radar instrument simulator and subcolumn generator for large-scale models. Geoscientific Model Development, 15(2), 901–927. 10.5194/gmd-15-901-2022