[postgis-users] stddev from average cell value of a raster

Bborie Park dustymugs at gmail.com
Fri Jan 31 06:56:18 PST 2014


Your usage of ST_SummaryStats() won't work. ST_SummaryStats provides the
average and the standard deviation of the input raster...

SELECT (ST_SummaryStats(rast)).mean, (ST_SummaryStats(rast)).stddev FROM
mytable

-bborie


On Fri, Jan 31, 2014 at 5:59 AM, <g.singh at utwente.nl> wrote:

>  Dear All,
>
>
>
> I have a raster in which the pixel values ranges from 0 - 1. I want to
> find the standard deviation of from the average cell value of the raster
> for which I use a query as under. The query can be executed but do not see
> any values in data output window. I initially thought that it could be
>  smaller cell values, and to compensate that I use a factor of 10^10 but
> still the problem remains. Can someone please suggest where I am going
> wrong.
>
>
>
> with
>
> cellscores as (
>
> select rid, gaztext_id, dist_meter, direction,sigma_dist,
> sigma_dir,sdis,sdir, (10^10) * cellvalue as cellvalue, maxprob, rastersize
>
> from cellscores_new_final_raster_parm_disdir_spatialhint where
> gaztext_id=2502 and count=1 and rid=651
>
> )
>
> ,avg_value as (
>
> select c.rid, c.gaztext_id, c.dist_meter, c.direction,c.sigma_dist,
> c.sigma_dir,c.sdis,c.sdir, c.cellvalue, c.maxprob, c.rastersize, n.rast,
>
> (10^10)*(sum(st_summarystats(n.rast))/c.rastersize) as average_cellvalue
>
> from cellscores c JOIN new_final_raster_parm_disdir_spatialhint n ON
> n.rid=c.rid
>
> order by c.gaztext_id
>
> )
>
> select stddev(sum(st_summarystats(rast))/rastersize)
>
> from avg_value
>
>
>
>
>
> Tanks and Regards,
>
> Gaurav
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20140131/761013de/attachment.html>


More information about the postgis-users mailing list