[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    Re: [postgis-users] Raster calculation on 3d raster (stack)
From:       Pierre Racine <Pierre.Racine () sbf ! ulaval ! ca>
Date:       2015-11-20 13:23:43
Message-ID: e910072b38bb4fd79e6ba264c5737cc9 () ul-exc-pr-mbx13 ! ulaval ! ca
[Download RAW message or body]

[Attachment #2 (text/plain)]

Doesn't the second example (One raster, several bands) similar to your case in the \
doc?

http://postgis.net/docs/RT_ST_MapAlgebra.html

Pierre

From: postgis-users [mailto:postgis-users-bounces@lists.osgeo.org] On Behalf Of David \
                Haynes
Sent: Tuesday, November 17, 2015 9:48 AM
To: postgis-users@lists.osgeo.org
Subject: [postgis-users] Raster calculation on 3d raster (stack)

Hello,

I have a mulibanded raster and I am wondering if I can apply any of the raster \
processing functions (min, max, mean, stdev) to multibanded rasters. Specifically, I \
am wondering if these functions will be able to applied to the z-axis.

Here is an example, I have worked up in python starting with two 2d arrays.
x = [[1,4,5,6], [3,5,6,2]]
z = [[2,7,8,9], [8,3,5,9]]
convert to np.array
y = np.dstack((np.array(x), np.array(z)))
> > > y.sum(2)
array([[ 3, 11, 13, 15],
       [11,  8, 11, 11]])

I want to apply the raster processing functions to the z-axis and I am wondering if I \
can do it in PostGIS? It seems like the mapalgebra call back functions could do this, \
but I am having difficulty finding an example.


[Attachment #3 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-reply;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
.MsoChpDefault
	{mso-style-type:export-only;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Doesn't \
the second example (One raster, several bands) similar to your case in the \
doc?<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><a \
href="http://postgis.net/docs/RT_ST_MapAlgebra.html">http://postgis.net/docs/RT_ST_MapAlgebra.html</a><o:p></o:p></span></p>
 <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Pierre<o:p></o:p></span></p>
 <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
 <div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span \
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span \
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> \
postgis-users [mailto:postgis-users-bounces@lists.osgeo.org] <b>On Behalf Of \
</b>David Haynes<br> <b>Sent:</b> Tuesday, November 17, 2015 9:48 AM<br>
<b>To:</b> postgis-users@lists.osgeo.org<br>
<b>Subject:</b> [postgis-users] Raster calculation on 3d raster \
(stack)<o:p></o:p></span></p> </div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<p class="MsoNormal">Hello,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">I have a mulibanded raster and I am wondering if I can apply any \
of the raster processing functions (min, max, mean, stdev) to multibanded rasters. \
Specifically, I am wondering if these functions will be able to applied to the \
z-axis.&nbsp;<o:p></o:p></p> </div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">Here is an example, I have worked up in python starting with two \
2d arrays.<o:p></o:p></p> </div>
<div>
<p class="MsoNormal">x = [[1,4,5,6], [3,5,6,2]]<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">z = [[2,7,8,9], [8,3,5,9]]<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">convert to np.array<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">y = np.dstack((np.array(x), np.array(z)))<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">&gt;&gt;&gt; y.sum(2)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">array([[ 3, 11, 13, 15],<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">&nbsp; &nbsp; &nbsp; &nbsp;[11, &nbsp;8, 11, \
11]])<o:p></o:p></p> </div>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">I want to apply the raster processing functions to the z-axis \
and I am wondering if I can do it in PostGIS? It seems like the mapalgebra call back \
functions could do this, but I am having difficulty finding an \
example.<o:p></o:p></p> </div>
</div>
</div>
</div>
</body>
</html>


[Attachment #4 (unknown)]

_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/postgis-users

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic