You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Hi there, 

i am trying to get the monthly mean of the sea-surface-temperature for 40 years. When i run the code below i am getting a memory error, also shown below.

If i am just selcting 3 years it works just fine, except for the grid which remains as a 0.05x0.05 grid and not the requested 0.25x0.25 grid. 

Any advice how to get the data and change the grid?

Script:
 

import cdstoolbox as ct

@ct.application(title='Download data')
@ct.output.download()
def download_application():
  count=1
for yr in ['1982', '1983', '1984', '1984', '1985',
'1986', '1987', '1988', '1989', '1990',
'1991', '1992', '1993', '1994', '1995',
'1996', '1997', '1998', '1999', '2000',
'2001', '2002', '2003', '2004', '2005',
'2006', '2007', '2008', '2009', '2010',
'2011', '2012', '2013', '2014', '2015',
'2016', '2017', '2018', '2019', '2020']:
for mn in ['01','02','03','04','05','06','07',
'08','09','10','11','12']:
data1 = ct.catalogue.retrieve(
'satellite-sea-surface-temperature',
{
'processinglevel': 'level_4',
'sensor_on_satellite': 'combined_product',
'version': '2_0',
'year': yr,
'month': mn,
'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',
],
'variable': 'sea_surface_temperature',
'grid': [0.25, 0.25],
}
)
data = ct.cube.resample(data1, dim='time', freq='MS')
data_monthly = ct.climate.monthly_mean(data)
if mn == '01':
data_monthly_all=data_monthly
else:
data_monthly_all=ct.cube.concat([data_monthly_all,data_monthly],dim='time')
if count == 1:
monthly_all=data_monthly_all
else:
monthly_all=ct.cube.concat([monthly_all,data_monthly_all],dim='time')
count = count+1
print(monthly_all)
return monthly_all


Error Message:


  • No labels