| 1391 | '''ST_Sum(raster, nband) -> double precision'''[[BR]] |
| 1392 | |
| 1393 | This function calls ST_SummaryStats and only returns the sum from that function. |
| 1394 | |
| 1395 | 1. ST_Sum(rast raster, nband int, hasnodata boolean) -> double precision |
| 1396 | |
| 1397 | returns the sum as an integer |
| 1398 | |
| 1399 | nband: index of band |
| 1400 | |
| 1401 | hasnodata: if FALSE, any pixel who's value is nodata is ignored |
| 1402 | |
| 1403 | {{{ |
| 1404 | ST_Sum(rast, 1, FALSE) |
| 1405 | }}} |
| 1406 | |
| 1407 | 2. ST_Sum(rast raster, nband int) -> double precision |
| 1408 | |
| 1409 | assumes hasnodata = TRUE |
| 1410 | |
| 1411 | {{{ |
| 1412 | ST_Sum(rast, 2) |
| 1413 | }}} |
| 1414 | |
| 1415 | 3. ST_Sum(rast raster, hasnodata boolean) -> double precision |
| 1416 | |
| 1417 | assumes nband = 1 |
| 1418 | |
| 1419 | {{{ |
| 1420 | ST_Sum(rast, TRUE) |
| 1421 | }}} |
| 1422 | |
| 1423 | 4. ST_Sum(rast raster) -> double precision |
| 1424 | |
| 1425 | assumes nband = 1 and hasnodata = TRUE |
| 1426 | |
| 1427 | {{{ |
| 1428 | ST_Sum(rast) |
| 1429 | }}} |
| 1430 | |
| 1431 | The set of ST_ApproxSum functions are: |
| 1432 | |
| 1433 | 1. ST_ApproxSum(rast raster, nband int, hasnodata boolean, sample_percent double precision) -> double precision |
| 1434 | |
| 1435 | sample_percent: a value between 0 and 1 indicating the percentage of the raster band's pixels to consider |
| 1436 | |
| 1437 | {{{ |
| 1438 | ST_ApproxSum(rast, 3, FALSE, 0.1) |
| 1439 | |
| 1440 | ST_ApproxSum(rast, 1, TRUE, 0.5) |
| 1441 | }}} |
| 1442 | |
| 1443 | 2. ST_ApproxSum(rast raster, nband int, sample_percent double precision) -> double precision |
| 1444 | |
| 1445 | assumes that nband = 1 |
| 1446 | |
| 1447 | {{{ |
| 1448 | ST_ApproxSum(rast, 2 0.01) |
| 1449 | |
| 1450 | ST_ApproxSum(rast, 4, 0.025) |
| 1451 | }}} |
| 1452 | |
| 1453 | 3. ST_ApproxSum(rast raster, hasnodata boolean, sample_percent double precision) -> double precision |
| 1454 | |
| 1455 | assumes that nband = 1 |
| 1456 | |
| 1457 | {{{ |
| 1458 | ST_ApproxSum(rast, FALSE, 0.01) |
| 1459 | |
| 1460 | ST_ApproxSum(rast, TRUE, 0.025) |
| 1461 | }}} |
| 1462 | |
| 1463 | 4. ST_ApproxSum(rast raster, sample_percent double precision) -> double precision |
| 1464 | |
| 1465 | assumes that nband = 1 and hasnodata = TRUE |
| 1466 | |
| 1467 | {{{ |
| 1468 | ST_ApproxSum(rast, 0.25) |
| 1469 | }}} |
| 1470 | |
| 1471 | 5. ST_ApproxSum(rast raster) -> double precision |
| 1472 | |
| 1473 | assumes that nband = 1, hasnodata = TRUE and sample_percent = 0.1 |
| 1474 | |
| 1475 | {{{ |
| 1476 | ST_ApproxSum(rast) |
| 1477 | }}} |
| 1478 | |
| 1479 | The following functions are provided for coverage tables. |
| 1480 | |
| 1481 | 1. ST_Sum(rastertable text, rastercolumn text, nband int, hasnodata boolean) -> double precision |
| 1482 | |
| 1483 | rastertable: name of table with raster column |
| 1484 | |
| 1485 | rastercolumn: name of column of data type raster |
| 1486 | |
| 1487 | {{{ |
| 1488 | ST_Sum('tmax_2010', 'rast', 1, FALSE) |
| 1489 | |
| 1490 | ST_Sum('precip_2011', 'rast', 1, TRUE) |
| 1491 | }}} |
| 1492 | |
| 1493 | 2. ST_Sum(rastertable text, rastercolumn text, nband int) -> double precision |
| 1494 | |
| 1495 | hasnodata = TRUE |
| 1496 | |
| 1497 | {{{ |
| 1498 | ST_Sum('tmax_2010', 'rast', 1) |
| 1499 | }}} |
| 1500 | |
| 1501 | 3. ST_Sum(rastertable text, rastercolumn text, hasnodata boolean) -> double precision |
| 1502 | |
| 1503 | nband = 1 |
| 1504 | |
| 1505 | {{{ |
| 1506 | ST_Sum('precip_2011', 'rast', TRUE) |
| 1507 | }}} |
| 1508 | |
| 1509 | 4. ST_Sum(rastertable text, rastercolumn text) -> double precision |
| 1510 | |
| 1511 | nband = 1 and hasnodata = TRUE |
| 1512 | |
| 1513 | {{{ |
| 1514 | ST_Sum('tmin_2009', 'rast') |
| 1515 | }}} |
| 1516 | |
| 1517 | Variations for ST_ApproxSum are: |
| 1518 | |
| 1519 | 1. ST_ApproxSum(rastertable text, rastercolumn text, nband int, hasnodata boolean, sample_percent double precision) -> double precision |
| 1520 | |
| 1521 | {{{ |
| 1522 | ST_ApproxSum('tmax_2010', 'rast', 1, FALSE, 0.5) |
| 1523 | |
| 1524 | ST_ApproxSum('precip_2011', 'rast', 1, TRUE, 0.2) |
| 1525 | }}} |
| 1526 | |
| 1527 | 2. ST_ApproxSum(rastertable text, rastercolumn text, nband int, sample_percent double precision) -> double precision |
| 1528 | |
| 1529 | hasnodata = TRUE |
| 1530 | |
| 1531 | {{{ |
| 1532 | ST_ApproxSum('tmax_2010', 'rast', 1, 0.5) |
| 1533 | |
| 1534 | ST_ApproxSum('precip_2011', 'rast', 1, 0.2) |
| 1535 | }}} |
| 1536 | |
| 1537 | 3. ST_ApproxSum(rastertable text, rastercolumn text, hasnodata boolean, sample_percent double precision) -> double precision |
| 1538 | |
| 1539 | nband = 1 |
| 1540 | |
| 1541 | {{{ |
| 1542 | ST_ApproxSum('tmax_2010', 'rast', FALSE, 0.5) |
| 1543 | |
| 1544 | ST_ApproxSum('precip_2011', 'rast', TRUE, 0.2) |
| 1545 | }}} |
| 1546 | |
| 1547 | 4. ST_ApproxSum(rastertable text, rastercolumn text, sample_percent double precision) -> double precision |
| 1548 | |
| 1549 | nband = 1 and hasnodata = TRUE |
| 1550 | |
| 1551 | {{{ |
| 1552 | ST_ApproxSum('tmax_2010', 'rast', 0.5) |
| 1553 | |
| 1554 | ST_ApproxSum('precip_2011', 'rast', 0.2) |
| 1555 | }}} |
| 1556 | |
| 1557 | 5. ST_ApproxSum(rastertable text, rastercolumn text) -> double precision |
| 1558 | |
| 1559 | nband = 1, hasnodata = TRUE and sample_percent = 0.1 |
| 1560 | |
| 1561 | {{{ |
| 1562 | ST_ApproxSum('tmax_2010', 'rast') |
| 1563 | |
| 1564 | ST_ApproxSum('precip_2011', 'rast') |
| 1565 | }}} |
| 1566 | |
| 1567 | ---- |
| 1568 | |