Search the Community
Showing results for tags 'fvg'.
Found 4 results
The expression tool can be taken even further. If you want to input some function that requires input from two separate model runs, this can be achieved with a simple specifier. First you need to input a cell array of model files in the modfil input, the order of this is important. Then, (for example if we were comparing water level between two runs with different bathymetery), we specify our variables with M1. or M2. beforehand. eg. 'M1.H - M2.H' will subtract the water level of the second model in the model cell array from the water level of the first model. This has the same limitations of normal expressions, therefore at this stage it is not possible to do these comparisons on models with different numbers of cells.
FVG objects construct a matlab patch object for the actual image that is presented on screen. Each face of the patch object represents the cells of the model, and the corners of these faces represent the vertices. The handle to this patch object is stored as a property of the fvg objects, which allow us to customize various aspects of the visualisation. Just a few of the options for this: If you want to apply a slight transparency to the entire mesh equally, you can edit the patch object's facealpha property. sheet1 = fvgsheet(fobj, modfil) patchhandle = sheet1.PatchObj; set( patchhandle , 'FaceAlpha', 0.5) This sets all the faces of the patch to be 50% transparent. Be careful when setting these patch properties as some of them will be updated by moving the slider bar, and all your hard work will be erased. for more info on patches and their properties, see MathWorks documentation on patches. http://www.mathworks.com.au/help/matlab/ref/patch.html http://www.mathworks.com.au/help/matlab/ref/patch_props.html
The 'expression' property of fvg objects has a few more advanced options for truly customized output. One of these is the ability to bring in a workspace variable as part of your expression. Just put a dollar sign ($) in front of the variable that you wish to include from your workspace, ie. if you have a variable a=2; and you want to offset your water levels by this then '$a+H' would be your expression string. For single scalars though it is probably better to specify it directly, ie. if you want to offset all the water levels by 2m then 'H+2' is easier than storing the 2m in a variable beforehand. The real strength of this is for vectors, keep in mind that as usual, these vector and matrix operations will have specific limitations on size, and there are no extra checks in place to account for this. A useful example of using this is to plot the difference in a variable since a particular timestep, for example the start. A quick example is plotting the total change in bed level since the beginning of the model run, it will require extracting a variable seperately first. tmp = netcdf_get_var(modfil,'names','ZB','timestep',1); %BMTWBM function that will extract ZB at the first timestep firstbedlevel = tmp.ZB; %get it out of a structure and save it to a useful variable fobj = fvgraphics; %usual, gca customsheet = fvg_sheet(fobj, modfil, 'expression', 'ZB - $firstbedlevel') There are a lot of possibilities with this, the only downside being that it does require a bit of setting up first to get the variable that you want. Keep in mind that this variable will be 'saved' into the function persistantly, so even if you clear the original 'firstbedlevel' from your workspace, or change it, only the original one will be used in the calculations. If you wish to update the variable, then you must call the 'set' method on the expression again. ie. firstbedlevel = firstbedlevel+1; %changed the variable set(customsheet,'expression','ZB - $firstbedlevel'); %now it will bring in the new version of 'firstbedlevel';
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. eg. 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)'.