Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

From a given list of V vectors, each with the same number, N, of elements, and a set of P percentiles, computes a new list of P vectors, each containing N elements - one percentile for each of the N elements across all V input vectors. The function implements the nearest neighbour algorithm. The set of percentiles is supplied as the second argument and can be a vector, a list or a single number. If it is a single number then the result will be a single vector rather than a list of vectors; however, supplying a vector or list with just one percentile will result in a list of one vector result. The function complements the Percentile module, which acts directly on GRIB fields.

One example use of this function is to simulate the Percentile module, but using data that is all in memory. The following code does exactly that, but starts and ends with GRIB data.


Code Block
data = read('my_data.grib')
vals = values(data)
percents = percentile(vals, [100, 90, 89, 80, 75, 55])
new_grib = set_values(duplicate(data[1], 6), percents)



Excerpt

vector percentile( vector,list )

Computes, from a single array of data in the first argument, the percentiles listed in the second argument. For example:

p = percentile(vdata, |2, 99, 60|) # vector of 3 percentiles


Anchor
sgn
sgn

Excerpt
vector sgn( vector )

...