Skip to main content

easily download and plot NEXRAD weather radar reflectivity data

Project description

Travis-CI Coveralls.io AppVeyor Build Station image image Maintainability PyPi Download stats

Nexrad Quick-plot

Easy Python download and plot NEXRAD N0Q compositive reflectivity. Uses RGB high resolution PNG images of North America.

Tested with pytest, flake8 and mypy type checking.

Install

python -m pip install -e .

Usage

RGB data scaling: NEXRAD N0Q base reflectivity maps.

  • Black: No Data
  • -32 dBZ .. 90 dBZ
  • 0.5 dBZ increment

NEXRAD N0Q RGB scaling

These data are reduced fidelity RGB images. We use xarray.DataArray and plot image by image. For high-fidelity science data, the lower level data are needed--contact us if interested.

import nexrad_quickplot as nq

dat = nq.load('~/data/2017-08-21/nexrad/nexrad2017-08-19T00:00:00.png')

>>> dat
<xarray.DataArray (lat: 540, lon: 1220, color: 3)>
array([[[255, 255, 255],
        [255, 255, 255],
        ...,
        [255, 255, 255],
        [255, 255, 255]]], dtype=uint8)
Coordinates:
  * lat      (lat) float64 23.0 23.05 23.1 23.15 23.2 23.25 23.3 23.35 23.4 ...
  * lon      (lon) float64 -126.0 -125.9 -125.9 -125.8 -125.8 -125.7 -125.7 ...
  * color    (color)  'R' 'G' 'B'
Attributes:
    filename:  ~/data/nexrad2015-01-19T01:23:00.png
    wldfn:     None
    time:      2017-08-19 00:00:00

.lat and .lon are vectors of geodetic latitude and longitude respectively, computed based on the .wld file corresponding to the images.

Download NEXRAD data

Get NEXRAD reflectivity data with parallel download:

download-nexrad start stop outdir

example: download from 2018-01-01 to 2018-01-02 to ~/data/nexrad:

download-nexrad 2018-01-01T00 2018-01-03T00 ~/data/nexrad

Plot NEXRAD reflectivity data

NEXRAD QuickPlot plots are georegistered via Cartopy, which is the replacement for deprecated Basemap

  • Plot all data in directory:
    plot-nexrad ~/data/nexrad/
    
  • Plot a specific file (subplots if multiple files specified):
    plot-nexrad ~/data/nexrad/2018-01-01T12:35:00.png
    
  • Plot via file glob match:
    plot-nexrad ~/data/nexrad/ -pat 2018-01-01T12*.png
    
  • Keogram (specify lat or lon and value):
    plot-nexrad ~/data/2017-08-21/nexrad/ -keo lat 40
    

Notes

Coordinates

EPSG:4326 coordinates (WGS84) are in .wld files, which are generally the same for wide time spans of data. The .wld format is like:

0.005 (size of pixel in x direction)
0.0 (rotation of row) (Typically zero)
0.0 (rotation of column) (Typically zero)
-0.005 (size of pixel in y direction)
-126.0 (x coordinate of centre of upper left pixel in map units--here it's WGS84 longitude)
50.0 (y coordinate of centre of upper left pixel in map units--here it's WGS84 latitude)

Mass image downscaling

For initial analysis, the original Nexrad image size of 12200 x 5400 pixels may be too high to complete in a reasonable time. I choose to downsize by a factor of 10, which takes a long time, but is a one-time process.

mkdir orig
cp *.png orig

nice mogrify -scale 10% "*.png"

If you have trouble with this being very slow, try:

MAGICK_TEMPORARY_PATH=/run/shm nice mogrify -scale 10% "*.png"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

NEXRAD_quickplot-0.6.6.tar.gz (1.4 MB view details)

Uploaded Source

File details

Details for the file NEXRAD_quickplot-0.6.6.tar.gz.

File metadata

  • Download URL: NEXRAD_quickplot-0.6.6.tar.gz
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.3 CPython/3.7.0

File hashes

Hashes for NEXRAD_quickplot-0.6.6.tar.gz
Algorithm Hash digest
SHA256 ff38b65cb293075dea7100d542a1949485bb8a6c09d58500483f287f550b90fb
MD5 4854aeefabffc045d12aabab98ef251c
BLAKE2b-256 f42716217543a87fdc05d8266165eab872bf005d3b2e7631c63a6387d32faad4

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page