Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Now variable flx holds all the data in our FLEXTRA output. First, we will find out the number of trajectory groups we have by using the count() function.

Code Block
num=count(flx) 

Now we will create a for loop to go though all the trajectory groups and extract and print some data out of them:

Code Block
for i=1 to num do

...


	vals=flextra_group_get(flx[i],["name","type"])

...


 	print("tr: ",i," name: ",vals[1]," type: ",vals[2])

...


end for 

Here we used the flextra_group_get() function to read the value for a list of metadata keys from the i-th trajectory group. Please note that just as in the previous step we specified the trajectory group by the [] operator.

In the next step we will read some data from the first trajectory of the second trajectory group (volcano Stromboli). It goes like this:

Code Block
vals=flextra_tr_get(flx[2],1,["date","lat","lon"] 

In the last step we print the data:
 

Code Block
print(" ")

...


print("date: ",vals[1])

...


print("lat: ",vals[2])

...


print("lon: ",vals[3])

  Now, if you run this macro you will see the data values appearing in the standard output.

...

Warning

Please be aware that the preparation process is currently only working for operational forecasts having 91 or 137 model levels and requires parameter etadot from MARS. Because parameter etadot has only been archived in MARS since 4 June 2008, earlier dates cannot be used.

...

  • Parameter Flextra Prepare Mode can be set to 'Period' to retrieve input data between a specified starting and ending date.

...

Running the Icon

Save your FLEXTRA Prepare icon (Apply) then right-click and execute to start the data preparations. After two-three minutes (it might take longer on your system and machine) the icon should turn green indicating that the preparations were successful. The input data preparations involved several Metview tasks in the background:

...

  Alternatively we can set the Macro execution mode to synchronous by using the waitmode() function. We need to place it before calling flextra prepare() like this:

 

Code Block
languagebash
waitmode(1) 
 
res=flextra_prepare( ...
 ) 
 
flextra_run( ...
 )