import cdsapi

c = cdsapi.Client()

for format_file in ['grib','netcdf']:
    if format_file == 'grib':
        extension = '.grib'
    else:
        extension = '.nc'
    
    filename = '../archives/reanalysis/29_reanalysis-uerra-europe-single-levels' + extension

    c.retrieve(
        'reanalysis-uerra-europe-single-levels',
        {
            'format':format_file,
            'origin':'mescan_surfex',
            'variable':'total_precipitation',
            'year':'2000',
            'month':'01',
            'day':'01',
            'time':'06:00'
        },
        filename)
