Focal Operations and Buffer Tile support#563
Conversation
ed2c406 to
29dc373
Compare
core/src/main/scala/org/locationtech/rasterframes/expressions/focalops/SurfaceOp.scala
Outdated
Show resolved
Hide resolved
11dd3d9 to
9f0e79d
Compare
| * - mutable version makes sense | ||
| * - toBytes needs to encode padding size? | ||
| */ | ||
| case class BufferTile( |
There was a problem hiding this comment.
TODO: merge into GeoTrellis
There was a problem hiding this comment.
2134586 to
602d818
Compare
db29294 to
9cb9c7f
Compare
7684fd8 to
b127329
Compare
6637698 to
c406536
Compare
…unction signature change
5c48898 to
d79a6ed
Compare
metasim
left a comment
There was a problem hiding this comment.
🤘 🧙 💪 ![]()
Can you update the release-notes.md file under a 0.10 heading? I forgot to ask for that in the last PR too.
| */ | ||
| def aspect(cs: CellSize, bounds: Option[GridBounds[Int]] = None, target: TargetCell = TargetCell.All): BufferTile = | ||
| self.mapTile(_.aspect(cs, bounds, target)) | ||
| } |
There was a problem hiding this comment.
| StructField("cols", IntegerType, false), | ||
| StructField("rows", IntegerType, false), | ||
| StructField("cells", BinaryType, true), | ||
| StructField("gridBounds", gridBoundsEncoder[Int].schema, true), |
There was a problem hiding this comment.
Yes! This is what I meant by making "everything a buffered tile".... it's effectively enabled now (with perhaps some further propogation)
| val ct = CellType.fromName(row.getString(0)) | ||
| val cols = row.getInt(1) | ||
| val rows = row.getInt(2) | ||
| val bytes = row.getBinary(3) | ||
| val gridBounds = row.getStruct(4, 5).as[GridBounds[Int]] | ||
| BufferTile(ArrayTile.fromBytes(bytes, ct, cols, rows), gridBounds) |
There was a problem hiding this comment.
One thing I miss about the CatalystSerializers... all this magic index number stuff was in one place.
| val (childTile, childCtx) = tileExtractor(child.dataType)(row(input)) | ||
| val result = op(childTile) | ||
| toInternalRow(result, childCtx) | ||
| // TODO: Ensure InternalRowTile is preserved |
There was a problem hiding this comment.
This reminds me... if we want to start improving performance (mainly reducing copies), we need to figure out how ensure InternalRowTile <op> R => InternalRowTile. Either requires changes to how GeoTrellis instantiates destination tiles, or reimplementation of some fundamental operations.
| rf_hillshade(tileCol, lit(azimuth), lit(altitude), lit(zFactor)) | ||
|
|
||
| def rf_hillshade(tileCol: Column, azimuth: Column, altitude: Column, zFactor: Column): Column = | ||
| Hillshade(tileCol, azimuth, altitude, zFactor) |
| """ | ||
| uri - STAC API uri | ||
| filters - a STAC API Search filters dict (bbox, datetime, intersects, collections, items, limit, query, next) | ||
| search_limit - search results convenient limit method |
There was a problem hiding this comment.
This might be better as named parameters, or as **kwargs.
There was a problem hiding this comment.
Discoverability when working in a notebook or something would benefit from these parameters being fully spelled out with defaults.
| altitude = lit(altitude) | ||
| if isinstance(z_factor, (int, float)): | ||
| z_factor = lit(z_factor) | ||
| return _apply_column_function('rf_hillshade', tile_col, azimuth, altitude, z_factor) |
There was a problem hiding this comment.
Sorry there's documentation duplicated. In another universe I would have figured out how to have the Python API generated from the annotations on the Expressions.
| # if the value in the array is `nd_value`, it is masked as nodata | ||
| self.cells = np.ma.masked_equal(self.cells, nd_value) | ||
|
|
||
| # is it a buffer tile? crop it on extraction to preserve the tile behavior |
There was a problem hiding this comment.
Not sure this is the right thing to do, but don't want to hold up the PR for this. Back to the "everything's a buffered tile" perspective, I'd want to explore supporting buffered tile semantics on the Python mirror type.
There was a problem hiding this comment.
@metasim yes, for now it is done to preserve the old behavior and not to break anything.
| "cell_data.type": type(cell_data_bytes), | ||
| "cell_data.values": repr(cell_data_bytes) | ||
| "cell_data.values": repr(cell_data_bytes), | ||
| "grid_bounds": datum.gridBounds |
| # jupyter/scipy-notebook isn't semantically versioned. | ||
| # We pick this arbitrary one from Sept 2019 because it's what latest was on Oct 17 2019. | ||
| FROM jupyter/scipy-notebook:7a0c7325e470 | ||
| FROM jupyter/scipy-notebook:python-3.8.8 |
f803707 to
c7d8f48
Compare
It is a port of #551
TODO:
, blocked by Python binding updates for PySpark 3.1 #562quay.io/daunnc/rasterframes-notebook:0.9.2-SNAPSHOTFocal Operations notebook screenshot
STAC API Example notebook screenshot
Closes #441
Closes #551
Closes #487
Blocked by locationtech/geotrellis#3419