PyScanCf Example 1#
author: @syedhamidali
date: Sep 8, 2023
import pyscancf as pcf
import pyart
import glob
print(pcf.__version__)
Setup the paths for the input and output data, !ls $inp
shows the raw IMD data files, this is how the B-type (short range - high resolution) IMD DWR data looks like.
inp = "/Users/syed44/Downloads/Git_Stuff/imd_temp_radar/B/"
out = "/Users/syed44/Downloads/Git_Stuff/imd_temp_radar/out/"
!ls $inp
help(pcf.cfrad)
Let’s see what we have got into pcf.cfrad()
function.
It aggregates data to cfradial1 data. It takes inputs such as
input_dir
,output_dir
,scan_type
,dualpol
,gridder
,plot
, andnf
.input_dir
specifies the path of single sweep data directory, whileoutput_dir
specifies the path for output data.scan_type
takes two options:B
for short-range PPI, andC
for long-range PPI.The
dualpol
parameter is set to True if the data contains dual-polarization products like ZDR and RHOHV.gridder
is a boolean parameter, which is set to True if the user wants to create a gridded output.The
plot
argument is used to generate a cappi plot. It can be set toREF
,VELH
,WIDTH
, orALL
. The names are not case-sensitive and will be taken care of by theplot_cappi()
function. For example, if the data has areflectivity
field namedDBZ
, you can still writeREF
orreflectivity
, and same is for other radar moments.Lastly,
nf
is an integer parameter that specifies the number of files to group together, it is usually10
for typeB
, and2
or3
for typeC
data.
pcf.cfrad(input_dir=inp, output_dir=out, scan_type="B", gridder=True)
!ls $out
files = glob.glob(out + "grid*")
for file in files:
grid = pyart.io.read_grid(file)
pcf.plot_cappi(
grid,
"REF",
cmap="SyedSpectral", # optional
crosshair=False, # optional
savedir=None, # optional
show_figure=True, # optional
vmin=-10,
vmax=60,
)
for file in files:
grid = pyart.io.read_grid(file)
pcf.plot_cappi(
grid,
"REF",
cmap="pyart_HomeyerRainbow", # optional
crosshair=False, # optional
savedir=out, # optional
show_figure=False, # optional
)