<jupyter_start><jupyter_text>Download ERA5 Data<jupyter_code>import cdsapi
import os

def download_era5_data(year,month,days,hours,data_path): 
    """Downloads data for the specified days and hours in a given year/month."""

    c = cdsapi.Client()

    for day in days: 

        atmos_fname = os.path.join(data_path,"ERA5","ERA5_atmospheric_vbls_"+year+month+day+".nc")
        slvl_fname  = os.path.join(data_path,"ERA5","ERA5_singlelevel_vbls_"+year+month+day+".nc")

        c.retrieve("reanalysis-era5-pressure-levels", {
                "product_type":   "reanalysis",
                "format":         "netcdf",
                "area":           "90.00/-180.00/60.00/180.00",
                "variable":       ['geopotential','specific_cloud_ice_water_content',
                                   'specific_cloud_liquid_water_content', 'specific_humidity',
                                   'temperature','u_component_of_wind',
                                   'v_component_of_wind','vertical_velocity'],
                "pressure_level": ["850","700"],
                "year":           year,
                "month":          month,
                "day":            day,
                "time":           hours
            }, atmos_fname)

        c.retrieve('reanalysis-era5-single-levels', {
            'product_type':   'reanalysis',
            'format':         'netcdf',
            'area':           '90.00/-180.00/60.00/180.00',
            'variable':       ['2m_dewpoint_temperature','2m_temperature',
                               'mean_sea_level_pressure','surface_pressure'],
            'year':           year,
            'month':          month,
            'day':            day,
            'time':           hours
        }, slvl_fname)
        
    return None

data_path = os.path.join('/','Users','Lucien','Documents','cloudsat_project','data')

year = "2015"
month = "09"
days = ["01","02","03","04","05","06","07","08","09","10","11",
       "12","13","14","15","16","17","18","19","20","21","22",
       "23","24","25","26","27","28","29","30"]
hours = ["00","01","02","03","04","05","06","07","08","09","10","11",
        "12","13","14","15","16","17","18","19","20","21","22",
        "23"]

download_era5_data(year,month,days,hours,data_path)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18558480794130341, 'fraction_numerical': 0.07207596029348295, 'mean_word_length': 2.030065359477124, 'pattern_counts': {'":': 9, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '135216', 'license': 'MIT', 'n_tokens_mistral': 837, 'n_tokens_neox': 716, 'n_words': 90, 'path': 'notebooks/download_era5_data.ipynb', 'repo_name': 'lucien-sim/cloudsat-viz', 'size': '2317'}