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': 'analysed_sst',
                              '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:

Traceback (most recent call last):
  File "/opt/cdstoolbox/cdscompute/cdscompute/cdshandlers/services/handler.py", line 55, in handle_request
    result = cached(context.method, proc, context, context.args, context.kwargs)
  File "/opt/cdstoolbox/cdscompute/cdscompute/caching.py", line 108, in cached
    result = proc(context, *context.args, **context.kwargs)
  File "/opt/cdstoolbox/cdscompute/cdscompute/services.py", line 118, in __call__
    return p(*args, **kwargs)
  File "/opt/cdstoolbox/cdscompute/cdscompute/services.py", line 59, in __call__
    return self.proc(context, *args, **kwargs)
  File "/home/cds/cdsservices/services/retrieve.py", line 201, in execute
    **retrieve_kwargs
  File "/opt/cdstoolbox/cdscompute/cdscompute/context.py", line 301, in call
    return c.call(service, *args, **kwargs).value
  File "/opt/cdstoolbox/cdsworkflows/cdsworkflows/future.py", line 76, in value
    raise self._result
cdsworkflows.error.ClientError: {'traceback': 'Traceback (most recent call last):
  File "/opt/cdstoolbox/cdscompute/cdscompute/cdshandlers/services/handler.py", line 55, in handle_request
    result = cached(context.method, proc, context, context.args, context.kwargs)
  File "/opt/cdstoolbox/cdscompute/cdscompute/caching.py", line 108, in cached
    result = proc(context, *context.args, **context.kwargs)
  File "/opt/cdstoolbox/cdscompute/cdscompute/services.py", line 118, in __call__
    return p(*args, **kwargs)
  File "/opt/cdstoolbox/cdscompute/cdscompute/services.py", line 59, in __call__
    return self.proc(context, *args, **kwargs)
  File "/home/cds/cdsservices/services/cdm_translate.py", line 64, in execute
    retrieve_kwargs=retrieve_kwargs
  File "/opt/cdstoolbox/cdscdm/cdscdm/gridded.py", line 767, in open_dataset
    xr.concat(variables[var], **concat_kwargs).sortby(sortby)
  File "/usr/local/lib/python3.6/site-packages/xarray/core/dataset.py", line 5308, in sortby
    aligned_vars = align(self, *variables, join="left")
  File "/usr/local/lib/python3.6/site-packages/xarray/core/alignment.py", line 338, in align
    new_obj = obj.copy(deep=copy)
  File "/usr/local/lib/python3.6/site-packages/xarray/core/dataset.py", line 1087, in copy
    variables = {k: v.copy(deep=deep) for k, v in self._variables.items()}
  File "/usr/local/lib/python3.6/site-packages/xarray/core/dataset.py", line 1087, in <dictcomp>
    variables = {k: v.copy(deep=deep) for k, v in self._variables.items()}
  File "/usr/local/lib/python3.6/site-packages/xarray/core/variable.py", line 937, in copy
    data = copy.deepcopy(data)
  File "/usr/lib64/python3.6/copy.py", line 161, in deepcopy
    y = copier(memo)
MemoryError: Unable to allocate array with shape (30, 3600, 7200) and data type float32
'}