Timeline for Can you create a custom reducer?
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 23, 2021 at 17:31 | comment | added | Noel Gorelick |
You don't need to go back to the original angles to compute circular variance; you can get it as 1 - hypot(cos, sin) (see: docs.astropy.org/en/stable/_modules/astropy/stats/…) unless you want linear variance from the circular mean. If you really want to subtract the image value from all the original angles instead, you need to reduceRegion to get the mean angle for each building (probably easiest to map over the original buildings and get it for each one)
|
|
Aug 22, 2021 at 16:42 | comment | added | Emma | I've done that, but now I need to subtract the circle mean from angles in each area (to calculate the variance). And am running into trouble (e.g. can I do this without also converting angles into images?): code.earthengine.google.com/bae0bd9f1579ebd29e45239d00f89fda (line 196 throws the error) | |
Aug 22, 2021 at 14:05 | comment | added | Noel Gorelick | You can't reduce the angles into an image, you have to convert to sines and cosines and reduce those into an image by summing. | |
Aug 22, 2021 at 10:15 | comment | added | Emma | I did what you suggested, and now have angles represented in an image. To sum the sines I use: sin_angles.reduceRegion({reducer: ee.Reducer.sum(), geometry: block, scale: 50}), is this correct? I'm getting some strange results. The code can also be seen here (line 182): code.earthengine.google.com/e1850bf0d52f371da62755e4d92e4187 | |
Aug 21, 2021 at 22:24 | comment | added | Noel Gorelick | It might work if you had a feature per edge, each with an angle (do-able; you just need to map over the buildings producing a collection of edges/angles); but once you have that, you can just do the circular mean math yourself by summing the sines and cosines of the angle into the image directly. | |
Aug 21, 2021 at 13:50 | comment | added | Emma | I was thinking reduceToImage using that reducer and a 1000m scale - would that work? | |
Aug 21, 2021 at 13:15 | comment | added | Noel Gorelick | No, you can't create a custom reducer. But assuming you had the appropriate reducer, how would you expect to do this? map over a big collection of 1km cells, doing a filterBounds for each? | |
Aug 21, 2021 at 9:38 | history | asked | Emma | CC BY-SA 4.0 |