import cdsapi

c = cdsapi.Client()

for format_file in ['grib','netcdf']:
    if format_file == 'grib':
        extension = '.grib'
    else:
        extension = '.nc'

    filename = '../archives/reanalysis/36-reanalysis-efas_historical-surface_level' + extension
    
    c.retrieve(
        'efas-historical',
        {
            'format':format_file,
            'variable':[
                'river_discharge','snow_depth_water_equivalent'
            ],
            'model_levels':'surface_level',
            'hyear':'2018',
            'hmonth':'january',
            'hday':[
                '01','15'
            ],
            'simulation_version':'version_3'
        },
        filename)
