Hello, I receive the following error, when I try to animate 12 Pcolormesh plots using ct.animate.figure:
Traceback (most recent call last):
File "/opt/cdstoolbox/cdscompute/cdscompute/cdshandlers/services/handler.py", line 49, 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/animate.py", line 46, in figure
cmd = prepare_cmd(context, figures=figures, framerate=framerate)
File "/home/cds/cdsservices/services/animate.py", line 27, in prepare_cmd
context.run_command('/bin/bash', '-c', '%s' % " ".join(cmd + palette_opt))
TypeError: sequence item 1: expected str instance, dict found
I use the following code:
figs = []
for mm in range(1,13):
month = '%02d'%(mm)
data = ct.catalogue.retrieve(
'satellite-humidity-profiles', {
'year':Year,
'month':month,
'variable': 'all',
'product_type': Product_type.lower().replace(' ','_'),
'product_version': '0010',
}
)
print(data)
if mm==1:
year_data = data
else:
year_data = ct.cube.concat([year_data,data], dim='time')
fig = ct.cdsplot.figure(suptitle='Zonal Humidity - '+Year+month)
fig = ct.cdsplot.pcolormesh(
data, cmap='coolwarm', x='lat', y='height',
ylim=[0,1.2e4], fig=fig)
figs.append(fig)
anim = ct.animate.figure(figs)
The rest of the code can be found here:
https://sis-dev.climate.copernicus.eu/toolbox-editor/1474/satellite-humidity
I hope someone can help.
Thank You.
2 Comments
Vivien MAVEL
Dear Huayuan,
ct.animate.figure only support figures output with ct.map at the moment so you cannot animate a list of figures created with ct.cdsplot as it is unfortunately.
Regards.
Vivien
Huayuan Song
Thank you for your quick reply VivienÂ