Hi
I have tried several methods to extract climate data for a given coordinate, but I only seem to get run time errors. My code is working fine without me trying to specify coordinates.
I have tried also putting the ct.geo.extract_point(data, lat
, lon
) at the end without any luck.
Anyone have any idea on how I can modify my code to get data only for my desired location?
Would really appreciate any tips!
import cdstoolbox as ct
variables = {
'Near-Surface Air Temperature': '2m_temperature',
'Eastward Near-Surface Wind 10': '10m_u_component_of_wind',
'Northward Near-Surface Wind': '10m_v_component_of_wind',
'Sea Level Pressure': 'mean_sea_level_pressure',
'Sea Surface Temperature': 'sea_surface_temperature',
'Sea Surface Temperature': 'sea_surface_temperature',
'Eastward Near-Surface Wind 100': '100m_u_component_of_wind',
'Northward Near-Surface Wind 100': '100m_v_component_of_wind',
'Mean wave direction': 'mean_wave_direction',
'Mean wave period': 'mean_wave_period',
'Sea surface temperature': 'sea_surface_temperature',
'Significant height of combined wind waves and swell': 'significant_height_of_combined_wind_waves_and_swell'
}
@ct.input.dropdown('variable', label='Variable', values=variables.keys())
@ct.application(title='ERA5 dataset')
@ct.output.download()
def application(variable):
data = ct.catalogue.retrieve(
'reanalysis-era5-single-levels',
{
'product_type':'reanalysis',
'variable': variables[variable],
'lon': ['55'],
'lat': ['7'],
'year':['2009', '2010', '2011'],
'month': [
'01', '02', '03', '04', '05', '06',
'07', '08', '09', '10', '11', '12'],
'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' ]
} )
return data