Exporting animations

Use this procedure to export the animation defined in the animation timeline. The animation is exported as a GIF file.

  1. In the IRIS Focus Map view, set up the view you want to save.

    For example, you can save the settings for:

    • Weather products
    • Map tools such as the cross-section and tracking tools
    • Zoom level
  2. Select Saved Views > Save.
  3. Name the view and select Save.

    The new view is added to the Saved Views list for your future use.

  4. Configure your web server to access the IRIS Focus image export service:
    @Request: POST <your IRIS Focus URL>/focus-webapp/api/v2/image-export/get-image
    @Produces: "image/gif"
  5. Configure the following parameters:
    Parameter Description
    username

    IRIS Focus user name

    For a smooth user experience, Vaisala recommends that you use the dedicated image-export account created at time of installation for exporting images.
    password IRIS Focus password for the user
    startTime

    Start time, in ISO-8601 format:

    [YYYY]-[MM]-[DD]T[hh:mm:ss.sssZ]

    Example: 2024-06-18T16:25:23.000Z

    endTime

    End time, in ISO-8601 format:

    [YYYY]-[MM]-[DD]T[hh:mm:ss.sssZ]

    savedViewName

    The name of the saved view you created in 3.

    saveViewUser (Optional) The IRIS Focus user who owns the saved view. Used if you configure a specific user for exporting images (recommended).
    speedMs Animation speed
    hasLegend Add legend (0/1)
    animationType GIF
  6. Instead of 4 and 5, you can run the export from the command line by creating a script and setting-up a cron job. For example:
    1. Create a Python script animation-export.py for the animation export, such as the following:
      #!/usr/bin/python
      # -*- coding: utf-8 -*-
      from requests_futures.sessions import FuturesSession
      import datetime
      
      current_time = datetime.datetime.utcnow()
      duration = datetime.timedelta(hours=2)
      
      APP_URL = "your_url_here"
      IMAGE_EXPORT_LOC = "/focus-webapp/api/v2/image-export/animation"
      OUTPUT_FILE_PATH = "yourpath_and_nameofoutputanimationingif_here"
      USERNAME = "username_here"
      PASSWORD = "password_here"
      START_TIME = (current_time - duration).isoformat()
      END_TIME = current_time.isoformat()
      VIEW_NAME = "view_name_here"
      VIEW_USER = 'view_owner_here'
      ANIMATION_SPEED = "300"
      ADD_LEGEND = "1"
      ANIMATION_TYPE = "gif"
      
      def main():
          session = FuturesSession()
          req_params = {
              "username": USERNAME,
              "password": PASSWORD,
              "startTime": START_TIME,
              "endTime": END_TIME,
              "savedViewName": VIEW_NAME,
              "savedViewUser": VIEW_USER,
              'speedMs': ANIMATION_SPEED,
              'hasLegend': ADD_LEGEND,
              'animationType': ANIMATION_TYPE
          }
          future_one = session.post(APP_URL + IMAGE_EXPORT_LOC, params=req_params, verify=False)  # wait for the request to complete, if it hasn't already
          res = future_one.result()
          print('{0} response status: {1}'.format(END_TIME, res.status_code))
          if res.status_code == 200:
              with open(OUTPUT_FILE_PATH, 'wb') as f:
                  f.write(res.content)
      
      if __name__ == '__main__':
          main()
      
    2. Type crontab -e in the terminal and add, for example, the following line to the crontab file (add your own paths and arguments).
      */15 * * * * /usr/bin/python
              /path/to/script/animation-export.py >> /path/to/log/export.log 2>&1

      This executes the animation-export.py script every 15 minutes and saves the file as a GIF file to the server.