pggeodb.nancy.inra.fr/db_cefs - db_cefs on pggeodb.nancy.inra.fr
Previous topic Chapter index Next topic

Function: st_range4ma

 

 

Schema

public

 

Owner

postgres

 

Descriptions

There is no description for function st_range4ma

 

Options

Option

Value

Returns

double precision

Language

plpgsql

Parameters

matrix double precision []

nodatamode text

variadic args text []

 

Definition

CREATE OR REPLACE FUNCTION public.st_range4ma (
 matrix double precision [],
 nodatamode text,
 variadic args text []
)
RETURNS double precision AS
$span$
   DECLARE

       _matrix float[][];
       min float;
       max float;
   BEGIN
       _matrix := matrix;
       min := 'Infinity'::float;
       max := '-Infinity'::float;
       FOR x in array_lower(matrix, 1)..array_upper(matrix, 1) LOOP
           FOR
y in array_lower(matrix, 2)..array_upper(matrix, 2) LOOP
               IF
_matrix[x][y] IS NULL THEN
                   IF NOT
nodatamode = 'ignore' THEN
                       _matrix[x][y] := nodatamode::float;
                   END IF;
               END IF;
               IF min > _matrix[x][y] THEN
                   min = _matrix[x][y];
               END IF;
               IF max < _matrix[x][y] THEN
                   max = _matrix[x][y];
               END IF;
           END LOOP;
       END LOOP;
       IF max = '-Infinity'::float OR min = 'Infinity'::float THEN
           RETURN NULL
;
       END IF;
       RETURN max - min;
   END;
$span$
LANGUAGE
'plpgsql'
IMMUTABLE
CALLED ON NULL INPUT
SECURITY INVOKER
COST
100;

This file was generated with SQL Manager for PostgreSQL (www.pgsqlmanager.com) at 13/03/2014 13:23
Previous topic Chapter index Next topic