# Changes between Version 79 and Version 80 of WKTRaster/SpecificationWorking03

Show
Ignore:
Timestamp:
05/16/11 11:50:40 (2 years ago)
Comment:

ST_Histogram

Unmodified
Removed
Modified
• ## WKTRaster/SpecificationWorking03

v79 v80
820820ST_ApproxMinMax('precip_2011', 'rast')
821821}}}
822
823----
824
825'''ST_Histogram(raster, nband) -> set of records'''[[BR]]
826ST_Histogram and ST_ApproxHistogram provide methods to determine a raster's data distribution.
827
828The return of ST_Histogram and ST_ApproxHistogram is a set of records where each record is (min, max, count, proportion).
829
830ST_Histogram has the following variations.
831
8321. ST_Histogram(rast raster, nband int, hasnodata boolean, bins int, width double precision[], right boolean) -> set of records
833
834  returns set of records of four columns (min, max, count, proportion)
835
836  nband: index of band to process on
837
838  hasnodata: if FALSE, any pixel who's value is nodata is ignored.
839
840  bins: the number of categories/bins to have in the histogram. If NULL or value less than one, the number of categories will be auto-computed using Sturges' formula if the number of values >= 30 or Square-root choice if number of values < 30.
841
842    http://en.wikipedia.org/wiki/Histogram#Mathematical_definition
843
844  width: an array indicating the width of each category/bin. If the number of bins is greater than the number of widths, the widths are repeated. Example: 9 bins, widths are [a, b, c] will have the output be [a, b, c, a, b, c, a, b, c].
845
846  right: compute the histogram from the right rather than from the left (default). This changes the criteria for evaluating a value x from [a, b) to (a, b].
847
848{{{
849ST_Histogram(rast, 2, FALSE, NULL, NULL, FALSE)
850
851ST_Histogram(rast, 1, TRUE, 100, NULL, FALSE)
852
853ST_Histogram(rast, 2, FALSE, NULL, ARRAY[100, 50], FALSE)
854
855ST_Histogram(rast, 2, FALSE, 9, ARRAY[1000], TRUE)
856
857ST_Histogram(rast, 2, FALSE, 20, ARRAY[100, 200, 300], TRUE)
858}}}
859
8602. ST_Histogram(rast raster, nband int, hasnodata boolean, bins int, right boolean) -> set of records
861
862  parameter "width" is not specified thus resulting in all bins having the same widths
863
864{{{
865ST_Histogram(rast, 2, FALSE, 5, FALSE)
866}}}
867
8683. ST_Histogram(rast raster, nband int, hasnodata boolean, bins int) -> set of records
869
870  the parameter "right" is removed and assumed to be FALSE
871
872{{{
873ST_Histogram(rast, 2, FALSE, 5)
874}}}
875
8764. ST_Histogram(rast raster, nband int, hasnodata boolean) -> set of records
877
878  the parameter "bins" is removed and set to NULL.  The function will compute the number of bins to use
879
8805. ST_Histogram(rast raster, nband int) -> set of records
881
882  parameter "hasnodata" is removed and assumed to be FALSE
883
8846. ST_Histogram(rast raster) -> set of records
885
886  assumes that nband is 1.
887
8887. ST_Histogram(rast raster, nband int, bins int, width double precision[], right boolean) -> set of records
889
890  hasnodata is assumed to be FALSE
891
8928. ST_Histogram(rast raster, nband int, bins int, right boolean) -> set of records
893
894  all bins will have equal widths
895
8969. ST_Histogram(rast raster, nband int, bins int) -> set of records
897
898  right is assumed to be FALSE
899
900ST_ApproxHistogram should have the following variations.
901
9021. ST_ApproxHistogram(rast raster, nband int, hasnodata boolean, sample_percent double precision, bins int, width double precision[], right boolean) -> set of record
903
904    sample_percent: a value between 0 and 1 indicating the percentage of the raster band's pixels to consider when generating the histogram.
905
906{{{
907ST_Histogram(rast, 2, FALSE, 0.1, NULL, NULL, FALSE)
908
909ST_Histogram(rast, 1, TRUE, 1, 100, NULL, FALSE)
910
911ST_Histogram(rast, 2, FALSE, 0.2, NULL, ARRAY[100, 50], FALSE)
912
913ST_Histogram(rast, 2, FALSE, 0.25, 9, ARRAY[1000], TRUE)
914
915ST_Histogram(rast, 2, FALSE, 0.05, 20, ARRAY[100, 200, 300], TRUE)
916}}}
917
9182. ST_ApproxHistogram(rast raster, nband int, hasnodata boolean, sample_percent double precision, bins int, right boolean) -> set of records
919
920  parameter "width" is not specified thus resulting in all bins having the same widths
921
9223. ST_ApproxHistogram(rast raster, nband int, hasnodata boolean, sample_percent double precision, bins int) -> set of records
923
924  the parameter "right" is removed and assumed to be FALSE
925
926{{{
927ST_ApproxHistogram(rast, 2, FALSE, 5)
928}}}
929
9304. ST_ApproxHistogram(rast raster, nband int, hasnodata boolean, sample_percent double precision) -> set of records
931
932  the parameter "bins" is removed and set to NULL so that function can compute the number of bins to use
933
9345. ST_ApproxHistogram(rast raster, nband int, sample_percent double precision) -> set of records
935
936  parameter "hasnodata" is removed and assumed to be FALSE
937
9386. ST_ApproxHistogram(rast raster, nband int) -> set of records
939
940  assumes that sample_percent is 0.1
941
9427. ST_ApproxHistogram(rast raster, sample_percent double_precision) -> set of records
943
944  assumes that nband is 1
945
9468. ST_ApproxHistogram(rast raster) -> set of records
947
948  assumes that nband is 1 and sample_percent is 0.1
949
9509. ST_ApproxHistogram(rast raster, nband int, sample_percent double precision, bins int, width double precision[], right boolean) -> set of records
951
952  hasnodata is assumed to be FALSE
953
95410. ST_ApproxHistogram(rast raster, nband int, sample_percent double precision, bins int, right boolean) -> set of records
955
956  all bins will have equal widths
957
95811. ST_ApproxHistogram(rast raster, nband int, sample_percent double precision, bins int) -> set of records
959
960  right is assumed to be FALSE
822961
823962----