Setup¶
Virga-Sniffer¶
The Virga-Sniffer can be installed via pip and the GitHub repository:
python -m pip install git+https://github.com/remsens-lim/virga_sniffer.git#egg=virga_sniffer
The following packages will be installed:
virga_sniffer
numpy
scipy
pandas
xarray
netcdf4
bottleneck
matplotlib
After installing, the Virga-Sniffer module can be accessed as demonstrated below:
1import xarray as xr
2import numpy as np
3from virga_sniffer import virga_mask as mvirga
4from virga_sniffer.utils import calc_lcl
5# Prepare the configuration
6# The default configuration will be used if not set manually
7config = {"ze_thres": -10}
8
9# The lifting condensation level can be calculated using virga_sniffer.utils:
10lcl = calc_lcl(p = surface_air_pressure.data, # [Pa]
11 T = surface_air_temperature.data, # [K]
12 rh = surfave_relative_humidity.data # [0-1]
13 )
14
15# Preparing the Input
16input_ds = xr.Dataset({
17 "Ze": (('time', 'range'), radar_reflectivity.data),
18 # cloud_base data needs two dimensions, even if its only one layer
19 "cloud_base_height": (('time', 'layer'), np.array(cloud_base.data)[:,np.newaxis]),
20 "flag_surface_rain": (('time'), flag_rain_ground.data),
21 "vel": (('time', 'range'), mean_doppler_velocity.data),
22 "lcl": (('time'), lcl)
23 },
24 coords={
25 "time": ('time', time.data),
26 "range":('range', height.data),
27 "layer":('layer',np.arange(cloud_base.data.shape[1]))
28 })
29dsout = mvirga(input_ds)
30# store to netCDF
31dsout.to_netcdf("<path>.nc")
32
33# Quicklooks
34date = dsout.time.values[0]
35for dtime in range(0,24,3):
36 # Restrict plots to 3 hours
37 ssdate = pd.to_datetime(np.datetime64(date)+np.timedelta64(dtime,'h'))
38 eedate = pd.to_datetime(np.datetime64(date)+np.timedelta64(dtime+3,'h'))
39 intime = dsout.time < np.datetime64(date)+np.timedelta64(dtime+3,'h')
40 intime *= dsout.time >= np.datetime64(date)+np.timedelta64(dtime,'h')
41 dsp = dsout.sel(time = slice(np.datetime64(date)+np.timedelta64(dtime,'h'),
42 np.datetime64(date)+np.timedelta64(dtime+3,'h')))
43 # use virga_sniffer plotting method
44 fig,axs = dsp.vsplot.quicklook_full(radar='LIMRAD94')
45 fig.savefig("<path>",dpi=100)

Example quicklook from virga_sniffer.vsplot.quicklook_flag_virga¶
Configuration Demonstration¶
To view the interactive demonstration of the Virga-Sniffer configuration, the example notebook can be run in binder.
To run the example jupyter notebook yourself, additional dependencies can be installed via:
python -m pip install git+https://github.com/remsens-lim/virga_sniffer.git#egg=virga_sniffer[example]
This will install additionally:
jupyter
jupyterlab
ipywidgets
ipympl
To run the demonstration of the Virga-Sniffer configuration, these files have to be downloaded from the repository:
Or, the zipped data can be downloaded:
Once installed and downloaded, the jupyter notebook can be run. The configuration of the Virga-Sniffer can be tested with the interactive widgets:

The result will be shown as a full quicklook.
Building the docs¶
To build the docs, additional dependencies can be installed via:
python -m pip install git+https://github.com/remsens-lim/virga_sniffer.git#egg=virga_sniffer[docs]
Then, the docs can be build with (see sphinx documentation):
cd <path-to-virga_sniffer>/docs/
make html
or
cd <path-to-virga_sniffer>/docs/
make latex