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.

Echo top height calculation from NEXRAD PPI volume data:

An echo top is the radar indicated top of an area of precipitation. This notebook demonstrates how to calculate the echo top height (ETH) in a NEXRAD PPI volume scan to determine the maximum elevation angle at which a certain reflectivity threshold is exceeded.

This example uses the echo top height (ETH) calculation code written by Valentin Louf, available at this github repository.


Overview

The notebook applies the modified ETH algorithm proposed by Lakshmanan et al. (2013) to a NEXRAD PPI volume scan.

The modified algorithm comprises these steps:

  1. Find the maximum elevation angle (θb\theta_{b}) where reflectivity (ZbZ_{b}) exceeds the echo-top reflectivity threshold. If θb\theta_{b} is not the highest elevation scan in the virtual volume, obtain the reflectivity value (ZaZ_{a}) at the next higher elevation angle (θa\theta_{a}). Then, the echo-top height is given by the height of the radar beam at an elevation angle:

θT=(ZT−Za)θb−θaZb−Za+θb\theta_T = (Z_T - Z_a) \frac{\theta_b - \theta_a}{Z_b - Z_a} + \theta_b

where ZTZ_T is the threshold value (e.g., 0 dBZ, 18 dBZ) used to compute the echo top.

  1. If θb\theta_{b} is the highest elevation scan available, set θT=θb+β/2\theta_{T} = \theta_{b} + \beta/2, where β\beta is the half-power beamwidth. This condition is met far away from the radar if higher-elevation scans have shorter ranges than a base “surveillance” scan and very close to the radar if the highest-elevation scan does not sample the top of the cloud. Under these circumstances, θT\theta_{T} is set to be the top of the beam containing dBZ ≥ZT\geq Z_T; that is, the traditional echo-top algorithm is followed when there are no data available from a higher-elevation scan.

Prerequisites

ConceptsImportanceNotes
Matplotlib BasicsRequiredBasic plotting
Intro to CartopyRequiredGeospatial plotting
Py-ART BasicsRequiredIO/Visualization
NumbaHelpfulFamiliarity with vectorization/optimization of Python functions
  • Time to learn: 25 minutes

Imports


## You are using the Python ARM Radar Toolkit (Py-ART), an open source
## library for working with weather radar data. Py-ART is partly supported
## by the U.S. Department of Energy Office of Science as part of
## the Atmospheric Radiation Measurement (ARM) User Facility.
##
## If you use this software to prepare a publication, please cite:
##
##     JJ Helmus and SM Collis, JORS 2016, doi: 10.5334/jors.119

/home/runner/micromamba/envs/radar-cookbook-dev/lib/python3.12/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
  from .autonotebook import tqdm as notebook_tqdm

Define our function to compute ETH on a uniform x-y grid

The input file can be a Next Generation Weather Radar (NEXRAD) archive file from Amazon Web Services. We will remotely access this file and use a reflectivity threshold eth_thld to define our echo tops.

Read and plot reflectivity and velocity fields for a sample file

---------------------------------------------------------------------------
ClientError                               Traceback (most recent call last)
File ~/micromamba/envs/radar-cookbook-dev/lib/python3.12/site-packages/s3fs/core.py:169, in _error_wrapper(func, args, kwargs, retries)
    168 try:
--> 169     return await func(*args, **kwargs)
    170 except S3_RETRYABLE_ERRORS as e:

File ~/micromamba/envs/radar-cookbook-dev/lib/python3.12/site-packages/aiobotocore/context.py:36, in with_current_context.<locals>.decorator.<locals>.wrapper(*args, **kwargs)
     35     await resolve_awaitable(hook())
---> 36 return await func(*args, **kwargs)

File ~/micromamba/envs/radar-cookbook-dev/lib/python3.12/site-packages/aiobotocore/client.py:449, in AioBaseClient._make_api_call(self, operation_name, api_params)
    448     error_class = self.exceptions.from_code(error_code)
--> 449     raise error_class(parsed_response, operation_name)
    450 else:

ClientError: An error occurred (403) when calling the HeadObject operation: Forbidden

The above exception was the direct cause of the following exception:

PermissionError                           Traceback (most recent call last)
Cell In[3], line 5
      1 aws_nexrad_level2_file = (
      2     "s3://noaa-nexrad-level2/2022/03/22/KHGX/KHGX20220322_120125_V06"
      3 )
      4 
----> 5 radar = pyart.io.read_nexrad_archive(aws_nexrad_level2_file)
      6 
      7 
      8 fig = plt.figure(figsize=(12, 4))

File ~/micromamba/envs/radar-cookbook-dev/lib/python3.12/site-packages/pyart/io/nexrad_archive.py:126, in read_nexrad_archive(filename, field_names, additional_metadata, file_field_names, exclude_fields, include_fields, delay_field_loading, station, scans, linear_interp, storage_options, **kwargs)
    115 filemetadata = FileMetadata(
    116     "nexrad_archive",
    117     field_names,
   (...)    121     include_fields,
    122 )
    124 # open the file and retrieve scan information
    125 nfile = NEXRADLevel2File(
--> 126     prepare_for_read(filename, storage_options=storage_options)
    127 )
    128 scan_info = nfile.scan_info(scans)
    130 # time

File ~/micromamba/envs/radar-cookbook-dev/lib/python3.12/site-packages/pyart/io/common.py:42, in prepare_for_read(filename, storage_options)
     39     return filename
     41 # look for compressed data by examining the first few bytes
---> 42 fh = fsspec.open(filename, mode="rb", compression="infer", **storage_options).open()
     43 magic = fh.read(3)
     44 fh.close()

File ~/micromamba/envs/radar-cookbook-dev/lib/python3.12/site-packages/fsspec/core.py:147, in OpenFile.open(self)
    140 def open(self):
    141     """Materialise this as a real open file without context
    142 
    143     The OpenFile object should be explicitly closed to avoid enclosed file
    144     instances persisting. You must, therefore, keep a reference to the OpenFile
    145     during the life of the file-like it generates.
    146     """
--> 147     return self.__enter__()

File ~/micromamba/envs/radar-cookbook-dev/lib/python3.12/site-packages/fsspec/core.py:105, in OpenFile.__enter__(self)
    102 mode = self.mode.replace("t", "").replace("b", "") + "b"
    104 try:
--> 105     f = self.fs.open(self.path, mode=mode)
    106 except FileNotFoundError as e:
    107     if has_magic(self.path):

File ~/micromamba/envs/radar-cookbook-dev/lib/python3.12/site-packages/fsspec/spec.py:1417, in AbstractFileSystem.open(self, path, mode, block_size, cache_options, compression, **kwargs)
   1415 else:
   1416     ac = kwargs.pop("autocommit", not self._intrans)
-> 1417     f = self._open(
   1418         path,
   1419         mode=mode,
   1420         block_size=block_size,
   1421         autocommit=ac,
   1422         cache_options=cache_options,
   1423         **kwargs,
   1424     )
   1425     if not ac and "r" not in mode:
   1426         self.transaction.files.append(f)

File ~/micromamba/envs/radar-cookbook-dev/lib/python3.12/site-packages/s3fs/core.py:839, in S3FileSystem._open(self, path, mode, block_size, acl, version_id, fill_cache, cache_type, autocommit, size, requester_pays, cache_options, **kwargs)
    836 if cache_type is None:
    837     cache_type = self.default_cache_type
--> 839 return S3File(
    840     self,
    841     path,
    842     mode,
    843     block_size=block_size,
    844     acl=acl,
    845     version_id=version_id,
    846     fill_cache=fill_cache,
    847     s3_additional_kwargs=kw,
    848     cache_type=cache_type,
    849     autocommit=autocommit,
    850     requester_pays=requester_pays,
    851     cache_options=cache_options,
    852     size=size,
    853 )

File ~/micromamba/envs/radar-cookbook-dev/lib/python3.12/site-packages/s3fs/core.py:2582, in S3File.__init__(self, s3, path, mode, block_size, acl, version_id, fill_cache, s3_additional_kwargs, autocommit, cache_type, requester_pays, cache_options, size)
   2580         self.details = s3.info(path)
   2581         self.version_id = self.details.get("VersionId")
-> 2582 super().__init__(
   2583     s3,
   2584     path,
   2585     mode,
   2586     block_size,
   2587     autocommit=autocommit,
   2588     cache_type=cache_type,
   2589     cache_options=cache_options,
   2590     size=size,
   2591 )
   2592 self.s3 = self.fs  # compatibility
   2594 # when not using autocommit we want to have transactional state to manage

File ~/micromamba/envs/radar-cookbook-dev/lib/python3.12/site-packages/fsspec/spec.py:1990, in AbstractBufferedFile.__init__(self, fs, path, mode, block_size, autocommit, cache_type, cache_options, size, **kwargs)
   1988         self.size = size
   1989     else:
-> 1990         self.size = self.details["size"]
   1991     self.cache = caches[cache_type](
   1992         self.blocksize, self._fetch_range, self.size, **cache_options
   1993     )
   1994 else:

File ~/micromamba/envs/radar-cookbook-dev/lib/python3.12/site-packages/fsspec/spec.py:2003, in AbstractBufferedFile.details(self)
   2000 @property
   2001 def details(self):
   2002     if self._details is None:
-> 2003         self._details = self.fs.info(self.path)
   2004     return self._details

File ~/micromamba/envs/radar-cookbook-dev/lib/python3.12/site-packages/fsspec/asyn.py:217, in sync_wrapper.<locals>.wrapper(*args, **kwargs)
    214 @functools.wraps(func)
    215 def wrapper(*args, **kwargs):
    216     self = obj or args[0]
--> 217     return sync(self.loop, func, *args, **kwargs)

File ~/micromamba/envs/radar-cookbook-dev/lib/python3.12/site-packages/fsspec/asyn.py:106, in sync(loop, func, timeout, *args, **kwargs)
    104     raise FSTimeoutError from return_result
    105 elif isinstance(return_result, BaseException):
--> 106     raise return_result
    107 else:
    108     return return_result

File ~/micromamba/envs/radar-cookbook-dev/lib/python3.12/site-packages/fsspec/asyn.py:59, in _runner(event, coro, result, timeout)
     57     coro = asyncio.wait_for(coro, timeout=timeout)
     58 try:
---> 59     result[0] = await coro
     60 except Exception as ex:
     61     result[0] = ex

File ~/micromamba/envs/radar-cookbook-dev/lib/python3.12/site-packages/s3fs/core.py:1761, in S3FileSystem._info(self, path, bucket, key, refresh, version_id)
   1759 if key:
   1760     try:
-> 1761         out = await self._call_s3(
   1762             "head_object",
   1763             self.kwargs,
   1764             Bucket=bucket,
   1765             Key=key,
   1766             **version_id_kw(version_id),
   1767         )
   1768         return {
   1769             "ETag": out.get("ETag", ""),
   1770             "LastModified": out.get("LastModified", ""),
   (...)   1776             "ContentType": out.get("ContentType"),
   1777         }
   1778     except FileNotFoundError:

File ~/micromamba/envs/radar-cookbook-dev/lib/python3.12/site-packages/s3fs/core.py:466, in S3FileSystem._call_s3(self, method, *akwarglist, **kwargs)
    464 logger.debug("CALL: %s - %s - %s", method.__name__, akwarglist, kw2)
    465 additional_kwargs = self._get_s3_method_kwargs(method, *akwarglist, **kwargs)
--> 466 return await _error_wrapper(
    467     method, kwargs=additional_kwargs, retries=self.retries
    468 )

File ~/micromamba/envs/radar-cookbook-dev/lib/python3.12/site-packages/s3fs/core.py:216, in _error_wrapper(func, args, kwargs, retries)
    214             err = e
    215 err = translate_boto_error(err)
--> 216 raise err

PermissionError: Forbidden

Define some global constants and compute the ETH on a horizontally uniform grid

These constants are required by the compute_eth function to grid the data from polar coordinates to a horizontally uniform grid. These three constants are defined as:

FILLVALUE (Value to replace missing data)
RANGE_STEP (Uniform horizontal grid spacing in x and y dimensions)
MAX_RANGE (Maximum range up to which ETH to be calculated from gridded data)

Plot the gridded echo/cloud top height using matplotlib


Summary

Within this example, we walked through how to access ARM data from a field campaign in Texas, plot a quick look of the RHI scan data, and grid our RHI data from native (polar) coordinates to a uniform range-height Caretsian grid.

Resources and References

  • NOAA NEXRAD on AWS

  • Read NEXRAD on AWS

  • Py-ART:

    • Helmus, J.J. & Collis, S.M., (2016). The Python ARM Radar Toolkit (Py-ART), a Library for Working with Weather Radar Data in the Python Programming Language. Journal of Open Research Software. 4(1), p.e25. DOI: Helmus & Collis (2016)

  • Echo-top height algorithm:

    • Lakshmanan, V., Hondl, K., Potvin, C. K., & Preignitz, D. (2013). An improved method for estimating radar echo-top height. Weather and Forecasting, 28(2), 481-488. DOI: Lakshmanan et al. (2013)

References
  1. Helmus, J. J., & Collis, S. M. (2016). The Python ARM Radar Toolkit (Py-ART), a Library for Working with Weather Radar Data in the Python Programming Language. Journal of Open Research Software, 4(1), 25. 10.5334/jors.119
  2. Lakshmanan, V., Hondl, K., Potvin, C. K., & Preignitz, D. (2013). An Improved Method for Estimating Radar Echo-Top Height. Weather and Forecasting, 28(2), 481–488. 10.1175/waf-d-12-00084.1