Jump to content
Toby Devlin

Visualise customised variables

Recommended Posts

fvg objects all have a great property call 'expression'.

This allows the users to overload the variables with a custom combination of variables.

The scope of uses for this ranges from changing current velocity units to km/h, up to computing total change in bed level over time.


the expression needs to be a string.



fvg_sheet(fobj , modfil , 'expression' , 'V*3.6')

This will read in the variable V, then multiply it by 3.6, then plot that. You do not specify the variables when doing this, it is all done on the expression.

This doesnt affect any other properties.


a few things to keep in mind:


  • The expression will allow some matlab builtins,  sum, hypot, min, max, etc.   but the correct, and sensible usage of all the functions is up to the users discretion. The variables that you will be working with will typically have some dimension followed by a number of cells dimension. The first dimension can be depth levels, or it could be number of sediments.  keep that in mind when executing expressions that might change depending on whether doing calculations 'element-wise', or on the whole array.  
  • The expression calculations occur before depth averaging, so operations that occur on 2D and 3D variables at the same time  ie.  H*SAL will not work.
  • Derived variables that may be allowed in the 'variables' property (ie. Vmag) will not be available in the expression string, you will have to calculate these from scratch if you need them, ie. 'hypot(V_x,V_y)'.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...