# Formula (Main window) ## Basic example Simple calculation can be made by assigning a formula to p (or u and v). Open the two files in the directory “bathymetry”: 1. Primary menu → formulatAndIso, then Secondary menu → p = a - b 2. Primary menu → etopo-37_IBI.nc → topography, then Secondary menu → a → interp 3. Primary menu → gebco_[...].tif → 1, then Secondary menu → b → interp ![Menu](../../_static/operation_menu.jpg) ## Native functions and variables Some functions are already coded, the calculation of the slope can be with the two following methods: 1. Primary menu → formulatAndIso, then Secondary menu 2. → p = ( gradx(p0)^2 + grady(p0)^2 )^0.5 2. → p = ellipseM( gradx(p0) , grady(p0) ) 3. Primary menu → etopo-37_IBI.nc → topography, then Secondary menu → p0 → interp ### Operators | Name | Description | |------|-------------| | `+`, `-`, `*`, `/`, `^`, `%` | Addition, difference, product, ratio, power, scalar product | | `<`, `<=`, `>`, `>=`, `==`, `!=` | Comparison operator (return 0 or 1) | | `or` | Merge the fields of different variables | ### Variables | Name | Description | |------|-------------| | `d2r` | Degree to radian (π/180) | | `e` | Exponential | | `nan` | Not a number | | `pi` | π | | `r2d` | Radian to degree (180/π) | | `lat` | Latitude over the view | | `lon` | Longitude over the view | | `p` | Variable that displays a gridded field | | `u` | Variable that displays a gridded zonal velocity (quiver) | | `v` | Variable that displays a gridded meridional velocity (quiver) | | `pcloud` | Variable that displays a pixel cloud | | `landmask` | Landmask | | `pmask` | Mask of the plotted variable [ p or (u,v) ] | | | If `pmask <= 1` then masked; | | | If `pmask >= 0` unmasked; | | | Gradient of white mask between 0-1 | | `p[4445]` | Value of the variable `p` at index 4445 | | `p[4445.3]` | Interpolation of the variable at the location between index 4445 and 4446 | ### Functions | Name | Description | |------|-------------| | `abs()` | Norm (real or complex) | | `arg()` | Phase lag (complex) | | `cos()` | Cosine | | `exp()` | Exponential | | `gradx()` | Zonal gradient | | `grady()` | Meridian gradient | | `sin()` | Sine | | `sinh()` | Hyperbolic sine | | `cnes2date()` | Convert Julian days since 1950 to date format (e.g., `yyyy-mm-dd hh:mm:ss`) | | `date2cnes()` | Convert date format (e.g., `yyyy-mm-dd hh:mm:ss`) to Julian days since 1950 | | `dx()` | Zonal difference to the neighbor pixel | | `dy()` | Meridian difference to the neighbor pixel | | `fliph()` | Flip along x-axis | | `flipv()` | Flip along y-axis | | `nearest()` | Interpolate the masked value with the nearest one | | `geokm(plg)` | Cumulative distance along a polygon | | `ellipseM(X,Y)` | Norm of vector or maximum current of ellipse |