Error while calculating mean

51 views
Skip to first unread message

Rohit Jain

unread,
Sep 27, 2015, 2:28:33 AM9/27/15
to Google App Engine
Hi,

can anyone help me with the below code I am some wearied output..don' know what exactly to do...
Also, can someone tell me that how to load an image collection like ImageCollection('?(asking about this)') and from the image collection how to know which image is where with name.
I am working on linux and using python.


import ee
ee.Initialize()
"""landsat5Toa = ee.ImageCollection('LC80150062013111LGN01').filterDate('2014-3-25').select('B[1]')"""

img = ee.Image('LC80150062013111LGN01').select('B1').unitScale(0, 255)

meanReducer = ee.Reducer.mean()
sigmaReducer = ee.Reducer.stdDev()
region = ee.Geometry.Rectangle(77.00133,-51.30404,74.69582,-41.38993 )
scale = 10000
mean = img.reduceRegion(meanReducer, region, scale)
sigma = img.reduceRegion(sigmaReducer, region, scale)
"""mean = landsat5Toa.get('bands')"""


 
def stretch(img, mean, sigma):

  return ee.Image(0).expression(


  '((img - mean) / (sigma * 3)) + 0.5',  {
  'img': img, 
  'mean': ee.Image.constant(mean),
  'sigma': ee.Image.constant(sigma)
  })

print(mean.getInfo())
print(sigma.getInfo())








Output

{u'B1': None}
{u'B1': None}



I dont know where I am haveing a problem.

Thank You 

Patrice (Cloud Platform Support)

unread,
Sep 28, 2015, 11:12:21 AM9/28/15
to Google App Engine
Hi Rohit,

While this is a very interesting question, it would probably belong better on Stack Overflow, since it's a question requiring 1-1 support. We do monitor Stack Overflow for good questions in the tags related to the Google Cloud Platform, so you can either get an answer by a member of support or from the community itself.

I would suggest separating your two questions into two separate posts. Remember to include enough code to your question about mean to have a Minimal example to reproduce your issue, as it will tremendously help other users in helping you out.

Cheers!
Reply all
Reply to author
Forward
0 new messages