Hi there, 

I'm not a great coder but I've managed to write something to graph rainfall data by hour for a certain location. I would like to download this data as a CSV so I can use it in R. However, I keep getting errors or empty files. I'd be very grateful if someone could help me amend my code (please see below). Many thanks, Andy

import cdstoolbox as ct

# Initialise an application 
@ct.application(title='Rainfall at the Wildplace')

# Add output widget to the application
@ct.output.livefigure()

# Create a function that retrieves the Near Surface Air Temperature dataset, extracts data from a point and plots the line on the livefigure
def plot_time_series():
    
     # Retrieve a variable over a defined time range
    data = ct.catalogue.retrieve(
        'reanalysis-era5-single-levels',
        {
            'variable': 'total_precipitation',
            'product_type': 'reanalysis',
            'year': [
                '2023'
            ],
            'month': [
                '06', '07', '08'
            ],
            'day': [
                '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',
                '31'
            ],
            'time':[
            '00:00','01:00','02:00',
            '03:00','04:00','05:00',
            '06:00','07:00','08:00',
            '09:00','10:00','11:00',
            '12:00','13:00','14:00',
            '15:00','16:00','17:00',
            '18:00','19:00','20:00',
            '21:00','22:00','23:00'
        ],
        'grid':[3, 3]
        }
    )
    
    # Select a location, defined by longitude and latitude coordinates
    
    
    tp_hourly_column = data * 3600 * 1000

    tp_hourly_column = ct.cdm.update_attributes(tp_hourly_column, {'units': 'mm'})
    
    print (tp_hourly_column)

   

    # Compute the daily mean for the selected data
    #data_daily = ct.climate.daily_sum(data_point*1000)
    data_point = ct.geo.extract_point(
        tp_hourly_column, 
        lon=-2.6119880971029983, 
        lat=51.53050814340124
    )
   

    # Show the result as a time-series on an interactive chart
    figure = ct.chart.line(data_point);

    return figure