| 287 | |
| 288 | ---- |
| 289 | |
| 290 | '''ST_Mean(raster, nband) -> double precision'''[[BR]] |
| 291 | This function calls ST_SummaryStats and only returns the mean from that function. |
| 292 | |
| 293 | 1. ST_Mean(rast raster, nband int, hasnodata boolean) -> double precision |
| 294 | |
| 295 | returns the mean as a double precision |
| 296 | |
| 297 | nband: index of band |
| 298 | |
| 299 | hasnodata: if FALSE, any pixel who's value is nodata is ignored |
| 300 | |
| 301 | {{{ |
| 302 | ST_Mean(rast, 1, FALSE) |
| 303 | }}} |
| 304 | |
| 305 | 2. ST_Mean(rast raster, nband int) -> double precision |
| 306 | |
| 307 | assumes hasnodata = FALSE |
| 308 | |
| 309 | {{{ |
| 310 | ST_Mean(rast, 2) |
| 311 | }}} |
| 312 | |
| 313 | 3. ST_Mean(rast raster, hasnodata boolean) -> double precision |
| 314 | |
| 315 | assumes nband = 1 |
| 316 | |
| 317 | {{{ |
| 318 | ST_Mean(rast, TRUE) |
| 319 | }}} |
| 320 | |
| 321 | 4. ST_Mean(rast raster) -> double precision |
| 322 | |
| 323 | assumes nband = 1 and hasnodata = FALSE |
| 324 | |
| 325 | {{{ |
| 326 | ST_Mean(rast) |
| 327 | }}} |
| 328 | |
| 329 | The set of ST_ApproxMean functions are: |
| 330 | |
| 331 | 1. ST_ApproxMean(rast raster, nband int, hasnodata boolean, sample_percent double precision) -> double precision |
| 332 | |
| 333 | sample_percent: a value between 0 and 1 indicating the percentage of the raster band's pixels to consider |
| 334 | |
| 335 | {{{ |
| 336 | ST_ApproxMean(rast, 3, FALSE, 0.1) |
| 337 | |
| 338 | ST_ApproxMean(rast, 1, TRUE, 0.5) |
| 339 | }}} |
| 340 | |
| 341 | 2. ST_ApproxMean(rast raster, nband int, sample_percent double precision) -> double precision |
| 342 | |
| 343 | assumes that nband = 1 |
| 344 | |
| 345 | {{{ |
| 346 | ST_ApproxMean(rast, 2 0.01) |
| 347 | |
| 348 | ST_ApproxMean(rast, 4, 0.025) |
| 349 | }}} |
| 350 | |
| 351 | 3. ST_ApproxMean(rast raster, hasnodata boolean, sample_percent double precision) -> double precision |
| 352 | |
| 353 | assumes that nband = 1 |
| 354 | |
| 355 | {{{ |
| 356 | ST_ApproxMean(rast, FALSE, 0.01) |
| 357 | |
| 358 | ST_ApproxMean(rast, TRUE, 0.025) |
| 359 | }}} |
| 360 | |
| 361 | 4. ST_ApproxMean(rast raster, sample_percent double precision) -> double precision |
| 362 | |
| 363 | assumes that nband = 1 and hasnodata = FALSE |
| 364 | |
| 365 | {{{ |
| 366 | ST_ApproxMean(rast, 0.25) |
| 367 | }}} |
| 368 | |
| 369 | 5. ST_ApproxMean(rast raster) -> double precision |
| 370 | |
| 371 | assumes that nband = 1, hasnodata = FALSE and sample_percent = 0.1 |
| 372 | |
| 373 | {{{ |
| 374 | ST_ApproxMean(rast) |
| 375 | }}} |
| 376 | |
| 377 | The following functions are provided for coverage tables. |
| 378 | |
| 379 | 1. ST_Mean(rastertable text, rastercolumn text, nband int, hasnodata boolean) -> double precision |
| 380 | |
| 381 | rastertable: name of table with raster column |
| 382 | |
| 383 | rastercolumn: name of column of data type raster |
| 384 | |
| 385 | {{{ |
| 386 | ST_Mean('tmax_2010', 'rast', 1, FALSE) |
| 387 | |
| 388 | ST_Mean('precip_2011', 'rast', 1, TRUE) |
| 389 | }}} |
| 390 | |
| 391 | 2. ST_Mean(rastertable text, rastercolumn text, nband int) -> double precision |
| 392 | |
| 393 | hasnodata = FALSE |
| 394 | |
| 395 | {{{ |
| 396 | ST_Mean('tmax_2010', 'rast', 1) |
| 397 | }}} |
| 398 | |
| 399 | 3. ST_Mean(rastertable text, rastercolumn text, hasnodata boolean) -> double precision |
| 400 | |
| 401 | nband = 1 |
| 402 | |
| 403 | {{{ |
| 404 | ST_Mean('precip_2011', 'rast', TRUE) |
| 405 | }}} |
| 406 | |
| 407 | 4. ST_Mean(rastertable text, rastercolumn text) -> double precision |
| 408 | |
| 409 | nband = 1 and hasnodata = FALSE |
| 410 | |
| 411 | {{{ |
| 412 | ST_Mean('tmin_2009', 'rast') |
| 413 | }}} |
| 414 | |
| 415 | Variations for ST_ApproxMean are: |
| 416 | |
| 417 | 1. ST_ApproxMean(rastertable text, rastercolumn text, nband int, hasnodata boolean, sample_percent double precision) -> double precision |
| 418 | |
| 419 | {{{ |
| 420 | ST_ApproxMean('tmax_2010', 'rast', 1, FALSE, 0.5) |
| 421 | |
| 422 | ST_ApproxMean('precip_2011', 'rast', 1, TRUE, 0.2) |
| 423 | }}} |
| 424 | |
| 425 | 2. ST_ApproxMean(rastertable text, rastercolumn text, nband int, sample_percent double precision) -> double precision |
| 426 | |
| 427 | hasnodata = FALSE |
| 428 | |
| 429 | {{{ |
| 430 | ST_ApproxMean('tmax_2010', 'rast', 1, 0.5) |
| 431 | |
| 432 | ST_ApproxMean('precip_2011', 'rast', 1, 0.2) |
| 433 | }}} |
| 434 | |
| 435 | 3. ST_ApproxMean(rastertable text, rastercolumn text, hasnodata boolean, sample_percent double precision) -> double precision |
| 436 | |
| 437 | nband = 1 |
| 438 | |
| 439 | {{{ |
| 440 | ST_ApproxMean('tmax_2010', 'rast', FALSE, 0.5) |
| 441 | |
| 442 | ST_ApproxMean('precip_2011', 'rast', TRUE, 0.2) |
| 443 | }}} |
| 444 | |
| 445 | 4. ST_ApproxMean(rastertable text, rastercolumn text, sample_percent double precision) -> double precision |
| 446 | |
| 447 | nband = 1 and hasnodata = FALSE |
| 448 | |
| 449 | {{{ |
| 450 | ST_ApproxMean('tmax_2010', 'rast', 0.5) |
| 451 | |
| 452 | ST_ApproxMean('precip_2011', 'rast', 0.2) |
| 453 | }}} |
| 454 | |
| 455 | 5. ST_ApproxMean(rastertable text, rastercolumn text) -> double precision |
| 456 | |
| 457 | nband = 1, hasnodata = FALSE and sample_percent = 0.1 |
| 458 | |
| 459 | {{{ |
| 460 | ST_ApproxMean('tmax_2010', 'rast') |
| 461 | |
| 462 | ST_ApproxMean('precip_2011', 'rast') |
| 463 | }}} |
| 464 | |
| 465 | The mean returned in the coverage functions (has rastertable and rastercolumn arguments) is a weighted mean of the means of each raster tile. |