Hi,

I'm trying to retrieve multiple variables from the  'sis-agroclimatic-indicators' dataset and attempting to do it in one call. However if I unpack it to a list of objects or to an array, each individual data object is related to the last variable in the request. I've checked the docs and not sure what I'm doing wrong.

Here's a test example where each print out of the data is referencing the 'wet_days':

data = ct.catalogue.retrieve(
'sis-agroclimatic-indicators',
{
'origin': 'gfdl_esm2m_model',
'variable': [
'heavy_precipitation_days', 'maximum_of_daily_maximum_temperature', 'wet_days',
],
'experiment': 'rcp8_5',
'temporal_aggregation': '10_day',
'period': '201101_204012'
}
)

print(data[0])
print(data[1])
print(data[2])

#######################

output * 3:

<xarray.DataArray 'number_of_days' (time: 1080, lat: 360, lon: 720)>
dask.array<xarray-number_of_days, shape=(1080, 360, 720), dtype=float32, chunksize=(48, 360, 720), chunktype=numpy.ndarray>
Coordinates:
  * time     (time) datetime64[ns] 2011-01-05 2011-01-15 ... 2040-12-25
  * lat      (lat) float64 -89.75 -89.25 -88.75 -88.25 ... 88.75 89.25 89.75
  * lon      (lon) float64 -179.8 -179.2 -178.8 -178.2 ... 178.8 179.2 179.8
Attributes:
    long_name:     Wet days (precipitation >= 1 mm)
    units:         day
    cell_methods:  time: sum
    type:          real
    valid_min:     0.0

#######################

Thanks for any help

Ceri



2 Comments

  1. Hi Ceri,

    Apologies for not getting back to you sooner. I think this is a bug, but while we look into it you can work around the issue by retrieving each variable individually, e.g.:

    data = []
    for variable in ['heavy_precipitation_days', 'maximum_of_daily_maximum_temperature', 'wet_days']:
        variable_data = ct.catalogue.retrieve(
            'sis-agroclimatic-indicators',
            {
                'origin': 'gfdl_esm2m_model',
                'variable': variable,
                'experiment': 'rcp8_5',
                'temporal_aggregation': '10_day',
                'period': '201101_204012'
            }
        )
        data.append(variable_data)

    This is generally good practice anyway, as breaking up a big request into smaller requests can be helpful for retaining the cache on your workflow - but we'll investigate your issue and try to get it fixed.

    Many thanks,
    James

  2. Hi James,

    That's good to know. I'd actually thought it would have been better to do the request for multiple variables in one call. 

    I will call them individually as you suggest.

    Best.


    Ceri