Hi everyone


Any thoughts on how I could create a (gridded) animated map? There is a function cdsplot.geoseries() that returns a list of pcolormesh plots from a DataArray along the specified dimension. And there is the function animate.figure() that returns "an animated gif from list of input figures."


So I naively assumed I could use the output of the first to feed into the second: 

    figlist = ct.cdsplot.geoseries(data,pcolormesh_kwargs={'cmap': 'viridis'})
    fig = ct.animate.figure(figlist)


But this produces an error:

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


A list of figures is created, but animate doesn't like it. So how could I get this to work? Any pointers to get me started?


Many thanks!

Rutger



8 Comments

  1. Dear Rutger,

    Thanks for flagging this issue up.

    It is a bug which we are currently working on.

    I will update you on this post when it is fixed.

    Sorry for the inconvenience.

    Regards.

    Vivien

  2. Dear Rutger,

    The animate tool is now working again and need to be used with ct.map.plot() instead of ct.cdsplot.*.

    Here is an example of animation:

    https://cds.climate.copernicus.eu/toolbox-editor/168/animate_magics

    Let me know if you have any question on this Rutger.

    Regards.

    Vivien

  3. Hi Vivien


    Thanks for this, and for the example. Are there any plans for getting animate to work with cdsplot / cdsplot.geoseries(...) as well? 


    Many thanks

    Rutger


  4. Hi Rutger,

    The current strategy is to promote Magics as the tool to produce maps and to deprecate cdsplot, so, as far as I know, animate is not planned to work with cdsplot.

    A feature request can always be made through the user support service though.

    Regards.

    Vivien

  5. Hi Vivien


    OK thanks. In that case I'm looking forward to the second how-to guide on customisation options with Magics, as I could do with some more examples...


    Cheers

    Rutger


    1. Hi Rutger,

      You can already find it here: https://cds-toolbox-dev.bopen.eu/toolbox/doc/how-to/22_how_to_make_a_map_with_magics_part2/22_how_to_make_a_map_with_magics_part2.html#ht22.

      I will be be on the production webtite at the next Toolbox release but I understand you might need it right now:

      I hope this helps.

      Vivien

  6. Thanks! That is certainly helpful!

  7. Great. Any feedback in the Magics guide is welcome and do not hesitate to open separate threads on the forum for questions regarding Magics.