GithubHelp home page GithubHelp logo

space-physics / nexrad Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 1.0 92 KB

Download/Plot NEXRAD compositive reflectivity PNGs by date/time

License: MIT License

Python 100.00%
nexrad reflectivity weather-radar

nexrad's Introduction

NEXRAD quick plots

DOI ci image image PyPi Download stats

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.

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 nexradutils as nq

dat = nq.load('~/data/2015-01-19/nexrad/nexrad2015-01-19T01:15: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:15:00.png
    wldfn:     None
    time:      2015-01-19 01:15: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 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/2018-01-01/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"

nexrad's People

Contributors

scivision avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

aldebaran1

nexrad's Issues

Parallel Download Issue with Saving Files

Hello,
I am on the "Download NEXRAD Data" step and I'm having an issue. When I run the command, there are no errors; it even tells me x number of files are being saved in the folder I inputted. The issue is that there is nothing being saved in my chosen folder. Do you happen to know what is going on?

This is what I'm running for reference:
python3 download_nexrad.py 2018-01-01T00 2018-01-03T00 /Users/gnss_user/Documents/nexradData/data

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.