Retrieving MeteoSwiss products from CSCS with pyrad#

Most MeteoSwiss products can be retrieved from the CSCS or MeteoSwiss servers using the functions documented here.

The reading/writing functions for these files are available in the MeteoSwiss Py-ART fork. Please also check the following notebook for an example of reading/writing such files.

Please also check the internal MeteoSwiss confluence page

Most products can be fetched with the retrieve_mch_prod function. You need to specify an output directory, make sure there is sufficient space in the output directory before you run the command!

Example 1: reading polar data from Albis at low-resolution (500m)#

from pyrad.util import retrieve_mch_prod
import pyart
import datetime

OUTPUT_DIRECTORY = '/scratch/wolfensb/temp/' # Adjust to your needs
T0 = datetime.datetime(2024,5,10,10,10)
T1 = datetime.datetime(2024,5,10,10,20)

files = retrieve_mch_prod(OUTPUT_DIRECTORY ,T0, T1,  product_name='MLA')

print(len(files))
print(files[0])

radar = pyart.aux_io.read_metranet(files[0])
print(radar.fields.keys())
60
/scratch/wolfensb//MLA2413110100U.001
dict_keys(['reflectivity', 'signal_to_noise_ratio', 'reflectivity_vv', 'differential_reflectivity', 'uncorrected_cross_correlation_ratio', 'uncorrected_differential_phase', 'velocity', 'spectrum_width', 'reflectivity_hh_clut'])

Example 2: same as example 1 but getting only certain sweeps#

files = retrieve_mch_prod(OUTPUT_DIRECTORY ,T0, T1, product_name='MLA', sweeps = [1,2,3,4])
print(len(files))
print(files[0:4])
12
[np.str_('/scratch/wolfensb//MLA2413110100U.001'), np.str_('/scratch/wolfensb//MLA2413110100U.002'), np.str_('/scratch/wolfensb//MLA2413110100U.003'), np.str_('/scratch/wolfensb//MLA2413110100U.004')]

Example 3: getting a Cartesian product, RZC = radar QPE#

files = retrieve_mch_prod(OUTPUT_DIRECTORY ,T0, T1,  product_name='RZC')
print(len(files))
print(files)
5
[np.str_('/scratch/wolfensb//RZC241311010VL.001'), np.str_('/scratch/wolfensb//RZC241311012VL.001'), np.str_('/scratch/wolfensb//RZC241311015VL.001'), np.str_('/scratch/wolfensb//RZC241311017VL.001'), np.str_('/scratch/wolfensb//RZC241311020VL.001')]

Example 4: getting a Cartesian product, CPC = radar-gauge QPE, but only at hourly accumulation#

files = retrieve_mch_prod(OUTPUT_DIRECTORY ,T0, T1,  product_name='CPC', pattern='*00060*')
print(len(files))
print(files)
2
[np.str_('/scratch/wolfensb//CPC/CPC2413110100_00060.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413110200_00060.801.gif')]

Example 5: more complex filtering of retrieved files with regex#

Extracting all CPC files except those at 5 minute resolution (CPC*_00005.801.gif)

T0 = datetime.datetime(2024,5,10,8,10)
T1 = datetime.datetime(2024,5,10,10,20)
files = retrieve_mch_prod(OUTPUT_DIRECTORY ,T0, T1,  product_name='CPC', pattern='^(?!.*00005\.801\.gif$).*\.gif$', pattern_type='regex')

print(files)
[np.str_('/scratch/wolfensb//CPC/CPC2413108100_00060.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108100_00180.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108100_00360.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108100_00720.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108100_01440.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108200_00060.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108200_00180.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108200_00360.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108200_00720.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108200_01440.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108300_00060.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108300_00180.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108300_00360.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108300_00720.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108300_01440.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108400_00060.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108400_00180.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108400_00360.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108400_00720.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108400_01440.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108500_00060.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108500_00180.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108500_00360.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108500_00720.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413108500_01440.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109000_00060.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109000_00180.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109000_00360.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109000_00720.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109000_01440.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109001_02880.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109003_04320.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109100_00060.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109100_00180.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109100_00360.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109100_00720.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109100_01440.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109200_00060.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109200_00180.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109200_00360.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109200_00720.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109200_01440.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109300_00060.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109300_00180.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109300_00360.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109300_00720.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109300_01440.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109400_00060.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109400_00180.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109400_00360.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109400_00720.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109400_01440.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109500_00060.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109500_00180.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109500_00360.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109500_00720.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413109500_01440.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413110000_00060.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413110000_00180.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413110000_00360.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413110000_00720.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413110000_01440.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413110001_02880.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413110003_04320.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413110100_00060.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413110100_00180.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413110100_00360.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413110100_00720.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413110100_01440.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413110200_00060.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413110200_00180.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413110200_00360.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413110200_00720.801.gif'), np.str_('/scratch/wolfensb//CPC/CPC2413110200_01440.801.gif')]
<>:3: SyntaxWarning: invalid escape sequence '\.'
<>:3: SyntaxWarning: invalid escape sequence '\.'
/tmp/ipykernel_136299/2933435368.py:3: SyntaxWarning: invalid escape sequence '\.'
  files = retrieve_mch_prod('/scratch/wolfensb/',T0, T1,  product_name='CPC', pattern='^(?!.*00005\.801\.gif$).*\.gif$', pattern_type='regex')