1SELECT 2 round(quantile::numeric, 3), 3 round(value::numeric, 3) 4FROM ST_Quantile( 5 ST_SetValue( 6 ST_SetValue( 7 ST_SetValue( 8 ST_AddBand( 9 ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0) 10 , 1, '64BF', 0, 0 11 ) 12 , 1, 1, 1, -10 13 ) 14 , 1, 5, 4, 0 15 ) 16 , 1, 5, 5, 3.14159 17 ) 18 , 1, FALSE, ARRAY[0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]::double precision[] 19); 20SELECT 21 round(quantile::numeric, 3), 22 round(value::numeric, 3) 23FROM ST_Quantile( 24 ST_SetValue( 25 ST_SetValue( 26 ST_SetValue( 27 ST_AddBand( 28 ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0) 29 , 1, '64BF', 0, 0 30 ) 31 , 1, 1, 1, -10 32 ) 33 , 1, 5, 4, 0 34 ) 35 , 1, 5, 5, 3.14159 36 ) 37 , 1, FALSE, ARRAY[0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]::double precision[] 38); 39SELECT 40 round(quantile::numeric, 3), 41 round(value::numeric, 3) 42FROM ST_Quantile( 43 ST_SetValue( 44 ST_SetValue( 45 ST_SetValue( 46 ST_AddBand( 47 ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0) 48 , 1, '64BF', 0, NULL 49 ) 50 , 1, 1, 1, -10 51 ) 52 , 1, 5, 4, 0 53 ) 54 , 1, 5, 5, 3.14159 55 ) 56 , 1, ARRAY[0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]::double precision[] 57); 58SELECT 59 round(quantile::numeric, 3), 60 round(value::numeric, 3) 61FROM ST_Quantile( 62 ST_SetValue( 63 ST_SetValue( 64 ST_SetValue( 65 ST_AddBand( 66 ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0) 67 , 1, '64BF', 0, 0 68 ) 69 , 1, 1, 1, -10 70 ) 71 , 1, 5, 4, 0 72 ) 73 , 1, 5, 5, 3.14159 74 ), 75 1, FALSE 76); 77SELECT 78 round(quantile::numeric, 3), 79 round(value::numeric, 3) 80FROM ST_Quantile( 81 ST_SetValue( 82 ST_SetValue( 83 ST_SetValue( 84 ST_AddBand( 85 ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0) 86 , 1, '64BF', 0, 0 87 ) 88 , 1, 1, 1, -10 89 ) 90 , 1, 5, 4, 0 91 ) 92 , 1, 5, 5, 3.14159 93 ), 94 1 95); 96SELECT 97 round(quantile::numeric, 3), 98 round(value::numeric, 3) 99FROM ST_Quantile( 100 ST_SetValue( 101 ST_SetValue( 102 ST_SetValue( 103 ST_AddBand( 104 ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0) 105 , 1, '64BF', 0, 0 106 ) 107 , 1, 1, 1, -10 108 ) 109 , 1, 5, 4, 0 110 ) 111 , 1, 5, 5, 3.14159 112 ), 113 ARRAY[0.05, 0.95]::double precision[] 114); 115SELECT 116 round(quantile::numeric, 3), 117 round(value::numeric, 3) 118FROM ST_Quantile( 119 ST_SetValue( 120 ST_SetValue( 121 ST_SetValue( 122 ST_AddBand( 123 ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0) 124 , 1, '64BF', 0, 0 125 ) 126 , 1, 1, 1, -10 127 ) 128 , 1, 5, 4, 0 129 ) 130 , 1, 5, 5, 3.14159 131 ) 132); 133SELECT round( 134 ST_Quantile( 135 ST_SetValue( 136 ST_SetValue( 137 ST_SetValue( 138 ST_AddBand( 139 ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0) 140 , 1, '64BF', 0, 0 141 ) 142 , 1, 1, 1, -10 143 ) 144 , 1, 5, 4, 0 145 ) 146 , 1, 5, 5, 3.14159 147 ), 148 1, FALSE, 0.05 149 )::numeric, 3 150); 151SELECT round( 152 ST_Quantile( 153 ST_SetValue( 154 ST_SetValue( 155 ST_SetValue( 156 ST_AddBand( 157 ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0) 158 , 1, '64BF', 0, 0 159 ) 160 , 1, 1, 1, -10 161 ) 162 , 1, 5, 4, 0 163 ) 164 , 1, 5, 5, 3.14159 165 ), 166 1, 0.95 167 )::numeric, 3 168); 169SELECT round( 170 ST_Quantile( 171 ST_SetValue( 172 ST_SetValue( 173 ST_SetValue( 174 ST_AddBand( 175 ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0) 176 , 1, '64BF', 0, 0 177 ) 178 , 1, 1, 1, -10 179 ) 180 , 1, 5, 4, 0 181 ) 182 , 1, 5, 5, 3.14159 183 ), 184 FALSE, 0.7 185 )::numeric, 3 186); 187SELECT round( 188 ST_Quantile( 189 ST_SetValue( 190 ST_SetValue( 191 ST_SetValue( 192 ST_AddBand( 193 ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0) 194 , 1, '64BF', 0, 0 195 ) 196 , 1, 1, 1, -10 197 ) 198 , 1, 5, 4, 0 199 ) 200 , 1, 5, 5, 3.14159 201 ), 202 0.45 203 )::numeric, 3 204); 205SELECT round( 206 ST_Quantile( 207 ST_SetValue( 208 ST_SetValue( 209 ST_SetValue( 210 ST_AddBand( 211 ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0) 212 , 1, '64BF', 0, 0 213 ) 214 , 1, 1, 1, -10 215 ) 216 , 1, 5, 4, 0 217 ) 218 , 1, 5, 5, 3.14159 219 ), 220 2, 0.45 221 )::numeric, 3 222); 223BEGIN; 224CREATE TEMP TABLE test_quantile 225 ON COMMIT DROP AS 226 SELECT 227 rast.rast 228 FROM ( 229 SELECT ST_SetValue( 230 ST_SetValue( 231 ST_SetValue( 232 ST_AddBand( 233 ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0) 234 , 1, '64BF', 0, 0 235 ) 236 , 1, 1, 1, -10 237 ) 238 , 1, 5, 4, 0 239 ) 240 , 1, 5, 5, 3.14159 241 ) AS rast 242 ) AS rast 243 FULL JOIN ( 244 SELECT generate_series(1, 2) AS id 245 ) AS id 246 ON 1 = 1; 247SELECT 248 round(quantile::numeric, 3), 249 round(value::numeric, 3) 250FROM ST_Quantile('test_quantile', 'rast', 1, TRUE, ARRAY[0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]::double precision[]); 251SELECT 252 round(quantile::numeric, 3), 253 round(value::numeric, 3) 254FROM ST_Quantile('test_quantile', 'rast', 1, TRUE); 255SELECT 256 round(quantile::numeric, 3), 257 round(value::numeric, 3) 258FROM ST_Quantile('test_quantile', 'rast', 1, FALSE, ARRAY[0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]::double precision[]); 259SELECT 260 round(quantile::numeric, 3), 261 round(value::numeric, 3) 262FROM ST_Quantile('test_quantile', 'rast', 1, FALSE); 263SELECT 264 round(quantile::numeric, 3), 265 round(value::numeric, 3) 266FROM ST_Quantile('test_quantile', 'rast', 1, ARRAY[0.05, 0.95]::double precision[]); 267SELECT 268 round(quantile::numeric, 3), 269 round(value::numeric, 3) 270FROM ST_Quantile('test_quantile', 'rast', ARRAY[0.05, 0.95]::double precision[]); 271SELECT round(ST_Quantile('test_quantile', 'rast', 1, FALSE, 0.95)::numeric, 3); 272SELECT round(ST_Quantile('test_quantile', 'rast', 1, 0.95)::numeric, 3); 273SELECT round(ST_Quantile('test_quantile', 'rast', TRUE, 0.95)::numeric, 3); 274SELECT round(ST_Quantile('test_quantile', 'rast', 0.5)::numeric, 3); 275SAVEPOINT test; 276SELECT round(ST_Quantile('test_quantile', 'rast', 2, 0.5)::numeric, 3); 277ROLLBACK TO SAVEPOINT test; 278RELEASE SAVEPOINT test; 279SAVEPOINT test; 280SELECT round(ST_Quantile('test_quantile', 'rast', 0.5)::numeric, 3); 281ROLLBACK TO SAVEPOINT test; 282RELEASE SAVEPOINT test; 283SAVEPOINT test; 284SELECT round(ST_Quantile('test_quantile', 'rast', 1, 0.5)::numeric, 3); 285ROLLBACK TO SAVEPOINT test; 286RELEASE SAVEPOINT test; 287SAVEPOINT test; 288SELECT round(ST_Quantile('test_quantile', 'rast', -1.)::numeric, 3); 289ROLLBACK TO SAVEPOINT test; 290RELEASE SAVEPOINT test; 291ROLLBACK; 292