You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Scalar functions

Scalar functions return a single value, based on one or more input values.

FunctionDescription
now()Returns the current date and time
date_now()Returns the current date
time_now()Returns the current time
year(date)Returns the year part of a date
month(date)Returns the month part of a date
day(date)Returns the day part of a date
hour(time)Returns the hour part of a time
minute(time)Returns the minute part of a time
second(time)Returns the second part of a time
timestamp(date, time)returns the timestamp of a date and time (format: YYYYMMDDHHMMSS)
tdiff(tgdate, tgtime, andate, antime)Time difference in seconds (tgdate,tgtime) are target times from which the nominal analysis timestamp (andate,antime) is getting subtracted from
cos(x)Cosine (where x is in degrees)
sin(x)Sine (where x is in degrees)
tan(x)Tangent (where x is in degrees)
acos(x)Arc cosine (the result is in degrees)
asin(x)Arc sine (the result is in degrees)
atan(x)Arc tangent (the result is in degrees)
atan2(x,y)Arc tangent of two variables (the result in degrees)
exp(x)Exponent
ldexp(x,n)x 2n
cosh(x)Hyperbolic cosine
sinh(x)Hyperbolic sine
tanh(x)Hyperbolic tangent
int(x), trunc(x)Truncate to integer
nint(x)Round-up to integer
floor(x)Calculate floor value
ceil(x)Calculate ceiling value
abs(x)Absolute value
max(x)Maximum value of x (x is an array) or values can be separated by a comma i.e. max(1,2,10,3)=10
min(x)Minimum value x (x is an array) or values can be separated by a comma i.e. min(1,2,10,3)=1
maxcount(x)Returns 1, when the row count (per pool) does not exceed value of x
maxrows()Returns the current row count (per pool)
count(x)Return the number of value of array x
sum(x)Compute the sum of array x
avg(x)Compute the average of x
stdev(x)Compute the standard deviation of x
var(x)Compute the variance of x
rms(x)Compute Root Mean Square of x
dotp(x,y)Compute the dot product of x and y
norm(x,y)Compute the norm of x,y
ibits(x,pos,len)Extract len bits from x offset pos
mod(x,y) or x%yx modulo y with floating point numbers accepted
pow(x,y) or x**y or x^yx power of y (xy)
sqrt(x)Square root (√x)
log(x),ln(x)Natural logarithm
log10(x),lg(x)Base-10 logarithm
deg2rad(x), radians(x)Convert degrees to radians
rad2deg(x), degrees(x)Convert radians to degrees
celsius(x), k2c(x)Convert Kelvin to Celsius
c2k(x)Convert Celcius to Kelvin
fahrenheit(x), k2f(x)Convert Kelvin to Fahrenheit
f2k(x)Convert Fahrenheit to Kelvin
c2f(x)Convert Celsius to Fahrenheit
f2c(x)Convert Fahrenheit to Celsius
circle(x,x0,y,y0,r)Returns 1, if the point (x,y) is inside (or on) the (planar) circle with origin at (x0,y0) and radius r
rad(lat0, lon0, angle, lat, lon)Returns 1, if the (lat,lon) is inside the great-circle (of any radius) with origin (lat0,lon0), and view angle (in degrees)
distance(lat1, lon1, lat2, lon2)Distance (expressed in metres) between two positions (lat1,lon1) and (lat2,lon2) along a great-circle of the Earth (R=6371km)
km(lat1, lon1, lat2, lon2)Synonym of distance-function but expressed in kilometres.
dist(reflat, reflon, refdist_km, lat, lon)return 1, if (lat,lon) is inside the great-circle of radius refdist_km (in kilometres) with origin (reflat,reflon)
eq_boxlat(lat,lon,resol)Compute the latitude by partitionning the unit spher into regions of equal area and small diameter (Algorithm by Paul Leopardi, School of Mathematics, University of South Wales)
eq_boxlon(lat,lon,resol)Same as eq_boxlat but compute the longitude instead
rgg_boxlat(lat,lon,Txxxx)Maps the latitude into its Reduced Gaussian Grid box at resolution Txxxx. (lat,lon) are assumed to be in degrees. Please note that some resolution may not be available.
rgg_boxlon(lat,lon,Txxxx)Maps the longitude into its Reduced Gaussian Grid box at resolution Txxxx. (lat,lon) are assumed to be in degrees. Please note that some resolution may not be available.
thin(value,x)x is a vector. It returns a new vector where only 1 over value is kept from x

 

Aggregate functions

Aggregate functions return a single value, calculated from values in a column.

  • AVG() - Returns average value
  • COUNT() - Returns number of rows
  • MAX() - Returns largest value
  • MIN() - Returns smallest value
  • SUM() - Returns sum
  • FIRST() - Returns value of the given expression evaluated for the first row of the query's result set
  • LAST() - Returns value of the given expression evaluated for the last row of the query's result set
  • No labels