import cdsapi

c = cdsapi.Client()

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

    c.retrieve(
        'reanalysis-uerra-europe-soil-levels',
        {
            'format':format_file,
            'year':'2000',
            'month':'01',
            'day':'01',
            'time':'06:00',
            'variable':'volumetric_soil_moisture',
            'soil_level':[
                '1','2'
            ],
            'origin':'uerra_harmonie'
        },
        filename)
