Diana User Guide: Field functions |  Previous: Setup file |  Next: Vertical crossection functions |  Index

Field computation/conversion functions

//----------------------------------------------------------------------
// Names used in functions:
//-------------------------
// plevel  = pressure levels
// hlevel  = model hybrid levels, eta/hybrid(hirlam,ecmwf,...) and sigma_norlam
// alevel  = model levels, any vertical coordinate with pressure field in each level
// ilevel  = isentrpoic levels (constant potential temperature levels)
// ozlevel = ocean depth levels
//----------
// Field names:
//-------------
// th    = potential temperature (Kelvin)
// tk    = temperature (Kelvin)
// tc    = temperature (Celsius)
// tx    = any temperature
// tdk   = dew point temperature (Kelvin)
// tdc   = dew point temperature (Celsius)
// rh    = relative humidity (%)
// q     = specific humidity (kg/kg)
// psurf = surface pressure (hPa) needed for hlevel functions
// p     = pressure (hPa) needed in all levels for alevel functions
// z     = height (m)
// mpot  = Montgomery potential (in isentropic surfaces)
// f     = any scalar field
// u,v   = wind components in grid x- and y-direction (m/s)
// salt  = water salt content in ppt
//----------
// Notes:
//----------
// Function argument and result names are just examples.
// "const:name" means a float or an int number.
// The last argument may be a variable number of constants; "const:name,..."
// Constants are after all input fields (except for the last simple functions).
// The number of result fields (1 or 2) is checked when the setup file is read.
//----------
// The real functions often need more arguments than used in setup.
// Like constant pressure, the hybrid eta.A and eta.B, map ratios and coriolis parameter fields.
// This is done automatic. Also the existence of any undefined/missing values in the input fields.
// ---------
// If the result field name also is among the input parameter/field names,
// the function will not be activated when the input field is found.
// The shortest "route" with fewest functions are chosen to make the final plot field.
//----------------------------------------------------------------------

Pressure level functions

Resultfield(s)Function(argumet(s))
tc = tc.plevel_th(th)
tk = tk.plevel_th(th)
th = th.plevel_tk(tk)
thesat = thesat.plevel_tk(tk)
thesat = thesat.plevel_th(th)
the = the.plevel_tk_rh(tk,rh)
the = the.plevel_th_rh(th,rh)
the = rh.plevel_tk_q(tk,q)
rh = rh.plevel_th_q(th,q)
q = q.plevel_tk_rh(tk,rh)
q = q.plevel_th_rh(th,rh)
tdc = tdc.plevel_tk_rh(tk,rh)
tdc = tdc.plevel_th_rh(th,rh)
tdc = tdc.plevel_tk_q(tk,q)
tdc = tdc.plevel_th_q(th,q)
tdk = tdk.plevel_tk_rh(tk,rh)
tdk = tdk.plevel_th_rh(th,rh)
tdk = tdk.plevel_tk_q(tk,q)
tdk = tdk.plevel_th_q(th,q)
tcmean = tcmean.plevel_z1_z2(z1,z2)
tkmean = tkmean.plevel_z1_z2(z1,z2)
thmean = thmean.plevel_z1_z2(z1,z2)
qvx,qvy = qvector.plevel_z_tk(z,tk)
qvx,qvy = qvector.plevel_z_th(z,th)
ducting = ducting.plevel_tk_q(tk,q)
ducting = ducting.plevel_th_q(th,q)
ducting = ducting.plevel_tk_rh(tk,rh)
ducting = ducting.plevel_th_rh(th,rh)
ug,vg = geostrophic.wind.plevel_z(z)
gvort = geostrophic.vorticity.plevel_z(z)
kindex = kindex.plevel_tk_rh(tk500,tk700,rh700,tk850,rh850)
kindex = kindex.plevel_th_rh(th500,th700,rh700,th850,rh850)
ductingindex = ductingindex.plevel_tk_rh(tk850,rh850)
ductingindex = ductingindex.plevel_th_rh(th850,rh850)
showalterindex = showalterindex.plevel_tk_rh(tk500,tk850,rh850)
showalterindex = showalterindex.plevel_th_rh(th500,th850,rh850)
boydenindex = boydenindex.plevel_tk_z(tk700,z700,z1000)
boydenindex = boydenindex.plevel_th_z(th700,z700,z1000)

Hybrid (eta) level functions

Resultfield(s)Function(argumet(s))
tc = tc.hlevel_th_psurf(th,psurf)
tk = tk.hlevel_th_psurf(th,psurf)
th = th.hlevel_tk_psurf(tk,psurf)
thesat = thesat.hlevel_tk_psurf(tk,psurf)
thesat = thesat.hlevel_th_psurf(th,psurf)
the = the.hlevel_tk_q_psurf(tk,q,psurf)
the = the.hlevel_th_q_psurf(th,q,psurf)
rh = rh.hlevel_tk_q_psurf(tk,q,psurf)
rh = rh.hlevel_th_q_psurf(th,q,psurf)
q = q.hlevel_tk_rh_psurf(tk,rh,psurf)
q = q.hlevel_th_rh_psurf(th,rh,psurf)
tdc = tdc.hlevel_tk_q_psurf(tk,q,psurf)
tdc = tdc.hlevel_th_q_psurf(th,q,psurf)
tdc = tdc.hlevel_tk_rh_psurf(tk,rh,psurf)
tdc = tdc.hlevel_th_rh_psurf(th,rh,psurf)
tdk = tdk.hlevel_tk_q_psurf(tk,q,psurf)
tdk = tdk.hlevel_th_q_psurf(th,q,psurf)
tdk = tdk.hlevel_tk_rh_psurf(tk,rh,psurf)
tdk = tdk.hlevel_th_rh_psurf(th,rh,psurf)
ducting = ducting.hlevel_tk_q_psurf(tk,q,psurf)
ducting = ducting.hlevel_th_q_psurf(th,q,psurf)
ducting = ducting.hlevel_tk_rh_psurf(tk,rh,psurf)
ducting = ducting.hlevel_th_rh_psurf(th,rh,psurf)
p = pressure.hlevel_xx_psurf(xx,psurf)

Atmospheric model level functions

Resultfield(s)Function(argumet(s))
tc = tc.alevel_th_p(th,p)
tk = tk.alevel_th_p(th,p)
th = th.alevel_tk_p(tk,p)
thesat = thesat.alevel_tk_p(tk,p)
thesat = thesat.alevel_th_p(th,p)
the = the.alevel_tk_q_p(tk,q,p)
the = the.alevel_th_q_p(th,q,p)
rh = rh.alevel_tk_q_p(tk,q,p)
rh = rh.alevel_th_q_p(th,q,p)
q = q.alevel_tk_rh_p(tk,rh,p)
q = q.alevel_th_rh_p(th,rh,p)
tdc = tdc.alevel_tk_q_p(tk,q,p)
tdc = tdc.alevel_th_q_p(th,q,p)
tdc = tdc.alevel_tk_rh_p(tk,rh,p)
tdc = tdc.alevel_th_rh_p(th,rh,p)
tdk = tdk.alevel_tk_q_p(tk,q,p)
tdk = tdk.alevel_th_q_p(th,q,p)
tdk = tdk.alevel_tk_rh_p(tk,rh,p)
tdk = tdk.alevel_th_rh_p(th,rh,p)
ducting = ducting.alevel_tk_q_p(tk,q,p)
ducting = ducting.alevel_th_q_p(th,q,p)
ducting = ducting.alevel_tk_rh_p(tk,rh,p)
ducting = ducting.alevel_th_rh_p(th,rh,p)

Isentropic level functions

Resultfield(s)Function(argumet(s))
ug,vg = geostrophic_wind.ilevel_mpot(mpot)

Ocean constant depth level functions

Resultfield(s)Function(argumet(s))
soundspeed = sea.soundspeed.ozlevel_tc_salt(seatemp.c,salt)
soundspeed = sea.soundspeed.ozlevel_tk_salt(seatemp.k,salt)

General (pressure/level independant) functions

Resultfield(s)Function(argumet(s))
tc = temp_k2c(tk)
tk = temp_c2k(tc)
tc = temp_k2c_possibly(tk)
tk = temp_c2k_possibly(tc)
tdk = tdk.tk_rh(tk,rh)
tdc = tdc.tk_rh(tk,rh)
tdc = tdc.tc_rh(tc,rh)
rh = rh.tk_tdk(tk,tdk)
rh = rh.tc_tdc(tc,tdc)
ff = vector.abs(u,v)
relvort = rel.vorticity(u,v)
absvort = abs.vorticity(u,v)
divergence = divergence(u,v)
advection(f) = advection(f,u,v,const:hours)
df/dx = d/dx(f)
df/dy = d/dy(f)
f_res = abs.del(f)
f_res = del.square(f)
f_res = minvalue.fields(f1,f2)
f_res = maxvalue.fields(f1,f2)
f_res = minvalue.field.const(f,const:value)
f_res = maxvalue.field.const(f,const:value)
f_res = abs(f)
f_res = log10(f)
f_res = pow10(f)
f_res = log(f)
f_res = exp(f)
f_res = power(f,const:exponent)
f_res = shapiro2.filter(f)
f_res = smooth(f,const:numsmooth)
delta_t = windcooling_tk_u_v(tk2m,u10m,v10m)
delta_t = windcooling_tc_u_v(tc2m,u10m,v10m)
danger = undercooled.rain(precip,snow,tk,const:precipMin,const:snowRateMax,const:tcMax)
tfp = thermal.front.parameter_tx(tx)
flightlevel = pressure2flightlevel(p)
m.comp = momentum.x.coordinate(v,const:coriolisMin)
n.comp = momentum.y.coordinate(u,const:coriolisMin)
jacobian = jacobian(fx,fy)
f_res = replace.undefined(f,const:value)
f_res = replace.defined(f,const:value)
f_res = replace.all(f,const:value)
f_classes = values2classes(f,const:limits_low_to_high,...)
field.diff = field.diff.forecast.hour(field,const:relHourFirst,const:relHourLast)
accum.diff = accum.diff.forecast.hour(accumfield,const:relHourFirst,const:relHourLast)
field_sum = sum_of_forecast_hours(field,const:forecastHours,...)
f_res = add(a,b)

Simple functions where one of the argumets (a or b) may be a constant

ResultfieldFunction(argumets)
f_res = add(a,b)
f_res = subtract(a,b)
f_res = multiply(a,b)
f_res = divide(a,b)

 Diana User Guide: Field functions |  Previous: Setup file |  Next: Vertical crossection functions |  Index