Skip to content

Commit 458c027

Browse files
committed
Merge remote-tracking branch 'locationtech/develop' into feature/local_is_in
2 parents 5229651 + 45ab397 commit 458c027

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

pyrasterframes/src/main/python/docs/nodata-handling.pymd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Drawing on @ref:[local map algebra](local-algebra.md) techniques, we will create
105105
```python, def_mask
106106
from pyspark.sql.functions import lit
107107

108-
mask = unmasked.withColumn('mask', rf_local_is_in('scl', [0, 1, 8, 9, 10])
108+
mask = unmasked.withColumn('mask', rf_local_is_in('scl', [0, 1, 8, 9, 10]))
109109

110110
cell_types = mask.select(rf_cell_type('mask')).distinct()
111111
cell_types

pyrasterframes/src/main/python/docs/supervised-learning.pymd

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ catalog_df = pd.DataFrame([
3232
{b: uri_base.format(b) for b in cols}
3333
])
3434

35-
df = spark.read.raster(catalog_df, catalog_col_names=cols, tile_dimensions=(256, 256)) \
35+
tile_size = 256
36+
df = spark.read.raster(catalog_df, catalog_col_names=cols, tile_dimensions=(tile_size, tile_size)) \
3637
.repartition(100)
3738

3839
df = df.select(
@@ -193,10 +194,10 @@ scored = model.transform(df_mask.drop('label'))
193194
retiled = scored \
194195
.groupBy('extent', 'crs') \
195196
.agg(
196-
rf_assemble_tile('column_index', 'row_index', 'prediction', 128, 128).alias('prediction'),
197-
rf_assemble_tile('column_index', 'row_index', 'B04', 128, 128).alias('red'),
198-
rf_assemble_tile('column_index', 'row_index', 'B03', 128, 128).alias('grn'),
199-
rf_assemble_tile('column_index', 'row_index', 'B02', 128, 128).alias('blu')
197+
rf_assemble_tile('column_index', 'row_index', 'prediction', tile_size, tile_size).alias('prediction'),
198+
rf_assemble_tile('column_index', 'row_index', 'B04', tile_size, tile_size).alias('red'),
199+
rf_assemble_tile('column_index', 'row_index', 'B03', tile_size, tile_size).alias('grn'),
200+
rf_assemble_tile('column_index', 'row_index', 'B02', tile_size, tile_size).alias('blu')
200201
)
201202
retiled.printSchema()
202203
```

0 commit comments

Comments
 (0)