<jupyter_start><jupyter_text>Process GridRad Data for Deep Learning Author: <NAME> Here I will show you how to process 1 gridrad file. Steps to preparing data:  1) Remove ground clutter/non-meteorological echoes. 2) Classify echoes as Convective or Stratiform. 3) Identify "Storms". 4) Track Stroms. 5) Label Storms (did the storm produce a tornado).<jupyter_code>#dopplerchase(this will be removed when python package is created and installed)
import sys
sys.path.insert(1, '../deeptor/')
from gridrad_tools import gridrad
filename = '../example_data/nexrad_3d_v4_2_20180502T010000Z.nc'

#the gridrad object will open the netcdf
gr = gridrad(filename=filename,filter=True)
#and store it in a data dict. 
list(gr.data.keys())
#if you are familiar with xarray you can convert this data dict. to a dataset 
gr.to_xarray()
gr.ds
%pylab inline
plt.figure(figsize=(20,20))
plt.pcolormesh(gr.ds.lons,gr.ds.lats,gr.ds.Z_H[5,:,:],cmap='Greys')
comp_Z = np.nanmax(gr.ds.Z_H,axis=0)
plt.figure(figsize=(20,20))
plt.pcolormesh(gr.ds.lons,gr.ds.lats,comp_Z,cmap='Greys')<jupyter_output><ipython-input-32-a0cbb8276b54>:1: RuntimeWarning: All-NaN axis encountered
  comp_Z = np.nanmax(gr.ds.Z_H,axis=0)
<ipython-input-32-a0cbb8276b54>:3: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3.  Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading'].  This will become an error two minor releases later.
  plt.pcolormesh(gr.ds.lons,gr.ds.lats,comp_Z,cmap='Greys')
{'fraction_non_alphanumeric': 0.11842105263157894, 'fraction_numerical': 0.03571428571428571, 'mean_word_length': 5.626556016597511, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '387603', 'license': 'CC0-1.0', 'n_tokens_mistral': 626, 'n_tokens_neox': 585, 'n_words': 165, 'path': 'notebooks/Process_GridRad.ipynb', 'repo_name': 'dopplerchase/DeepTor', 'size': '1601'}