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

g.singh at utwente.nl g.singh at utwente.nl
Fri Jan 31 05:59:29 PST 2014


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20140131/a4923dda/attachment.html>


More information about the postgis-users mailing list