How to create an animation of marine forecasts with QGis

We have discussed in a previous article,   How to integrate free marine and terrestrial weather forecasts into QGis , how to access, download and format the global marine forecast data proposed by the companies NASCA and Actimar  . For further details, visit www.enav-forecast.fr .
Now, we will discuss how to make an animation using these data with QGis and its Time Manager.

Once daily data is saved as shape format on your computer and added to your map, you must apply the desired symbology:
click on the layer -> Properties -> Style -> Load Style

In the previous article we have put at your disposal 3 QGis symbology files for wind, waves and currents.
If you have not already, you can download by   clicking here .

As example, here we are going to animate the wind forecast data. Therefore load the wind symbology stylevent.qml

You see the 65 time steps overlapping included in each point of the forecasts mesh..

In order to create the animation we will use the QGis Time Manager. We will follow the following steps:

  • format an attribute field of the table to ensure an accurate timeline
  • configure the animation parameters in Time Manager
  • export animation in a  video file

Format of an accurate timeline field

In order to create the different time steps of a layer using the Time Manager, we must allow it to distinguish the records that concern a single time step. It is the equivalent of what you make when using 0 Layer Properties -> “General” tab -> Subsystem (click query builder) in the previous article.

The Time Manager needs a field including date and time, however in the downloaded data, this information is located in two different fields: MeteoDate   and   hour.

Therefore, it is necessary to create a new field and fill it with the contents of the two fields.
This new field must be in text format, provided that the text string respects a certain format.

To create and fill this field you have to follow these instructions:

  • Open the attribute table of the layer ( right- click on the layer -> Open attribute table )

  • Open an update session (click the first button on the toolbar of the attribute table window)
  • Open field calculator (click the last button to the toolbar of the attribute table window)

  • Tick the box marked “Create a new field”
  • Name this field CtrlTime , for example
  • Select the format   Text ( string of characters )
  • Copy and paste the following  request  in the window   Expression :
  • CASE WHEN «   hour   ELSE concat (left (”   MeteoDate   “, 10), ”,”   hour   », ‘: 00:00’)

 

END

  • Click OK

Click the first button in the toolbar to close the edit session and save your work.
The field is ready to be used in the time management of the layer .

Configuration of the Time Manager Settings

To open the Time Manager window, click the View -> Panels menu and check the TimeManager box. The window appears at the bottom of the  Cartographic view .

Click on the button   “Settings” to configure the animation.

Click on   “Add layer” to add the  forecasts layer.
Check that the   Layer   depicts the correct name of the layer,
For   Start Time   tick the CtrlTime field (or the name you used in previous step)
Leave the other fields with their default values and click OK.

Change the duration of each image to 500 milliseconds and check the box   display frame start time on map   for the date and time of each time step to appear down and to the right of the cartographic window.
Click OK to complete the configuration.

In the Time Manager window,
Activate the layer time management by clicking the first button. Now you only see the first time step.
Indicate that the time interval between each frame is 3 hours, entering   3   in   Time frame size   and   hours   in the field next to it.

Click on the Play button to see run the temporal animation.
According to the result, you can adjust the options to get the desired animation .

How to export the animation to a video file ( avi )

By clicking the button “Export video” you create a sequence of images that you can use with different softwares such as Windows Live Movie Maker or others, in order to make a video in the desired format.

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *