Skip to content

Commit bcb233b

Browse files
committed
Tweak raster read for back compatibility; update some unit tests
Signed-off-by: Jason T. Brown <[email protected]>
1 parent b64e804 commit bcb233b

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

pyrasterframes/src/main/python/pyrasterframes/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ def _raster_reader(
134134

135135
from pandas import DataFrame as PdDataFrame
136136

137+
if 'catalog' in options:
138+
source = options['catalog'] # maintain back compatibility with 0.8.0
139+
137140
def to_csv(comp):
138141
if isinstance(comp, str):
139142
return comp

pyrasterframes/src/main/python/tests/RasterFunctionsTests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def test_render_composite(self):
286286
cat = self.spark.createDataFrame([
287287
Row(red=self.l8band_uri(4), green=self.l8band_uri(3), blue=self.l8band_uri(2))
288288
])
289-
rf = self.spark.read.raster(catalog = cat, catalog_col_names=['red', 'green', 'blue'])
289+
rf = self.spark.read.raster(catalog=cat, catalog_col_names=cat.columns)
290290

291291
# Test composite construction
292292
rgb = rf.select(rf_tile(rf_rgb_composite('red', 'green', 'blue')).alias('rgb')).first()['rgb']

pyrasterframes/src/main/python/tests/RasterSourceTest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828

2929
class RasterSourceTest(TestEnvironment):
3030

31-
3231
@staticmethod
3332
def path(scene, band):
3433
scene_dict = {

pyrasterframes/src/main/python/tests/RasterSourceTests.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,12 @@ def path(scene, band):
113113
{'b1': path(2, 1), 'b2': path(2, 2), 'b3': path(2, 3)},
114114
{'b1': path(3, 1), 'b2': path(3, 2), 'b3': path(3, 3)},
115115
])
116-
# comma separated list of column names containing URI's to read.
117-
catalog_columns = ','.join(path_pandas.columns.tolist()) # 'b1,b2,b3'
118116
path_table = self.spark.createDataFrame(path_pandas)
119117

120118
path_df = self.spark.read.raster(
121119
tile_dimensions=(512, 512),
122120
catalog=path_table,
123-
catalog_col_names=catalog_columns,
121+
catalog_col_names=path_table.columns,
124122
lazy_tiles=True # We'll get an OOM error if we try to read 9 scenes all at once!
125123
)
126124

0 commit comments

Comments
 (0)