Skip to content

Instantly share code, notes, and snippets.

@ejc123
Created April 9, 2014 14:56
Show Gist options
  • Save ejc123/10279886 to your computer and use it in GitHub Desktop.
Save ejc123/10279886 to your computer and use it in GitHub Desktop.
After
val results = months.flatMap {
month => {
val raster = RasterSource(store, s"${month}${year}NDVI_TOA_UTM14")
val mask = RasterSource(store, s"${month}${year}ACCA_State_UTM14")
val masked = raster.localMask(mask, 1, NODATA)
valid.map {
g =>
val polygon = Polygon(g.geom, 0)
val coords = Demo.server.get(GetCentroid(polygon)).geom.getCoordinate
masked.zonalMean(polygon).run match {
case Complete (result, _) => isNoData(result) match {
case true => (coords, month, None)
case false => (coords, month, Some(math.round(result)))
}
case _ => (coords, month, None)
}
}
}
}
val results = months.flatMap {
month => {
val raster = RasterSource(store, s"${month}${year}NDVI_TOA_UTM14")
val mask = RasterSource(store, s"${month}${year}ACCA_State_UTM14")
val masked = raster.localMask(mask, 1, NODATA).run match {
case Complete(result, _) => RasterSource(result)
}
valid.map {
g =>
val polygon = Polygon(g.geom, 0)
val coords = Demo.server.get(GetCentroid(polygon)).geom.getCoordinate
masked.zonalMean(polygon).run match {
case Complete (result, _) => isNoData(result) match {
case true => (coords, month, None)
case false => (coords, month, Some(math.round(result)))
}
case _ => (coords, month, None)
}
}
}
}
@ejc123
Copy link
Author

ejc123 commented Apr 9, 2014

gistfile1.txt should be 'After'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment