Skip to content

Commit 74f09df

Browse files
committed
Normalize RasterSourceDataSource param names between python and SQL
Signed-off-by: Jason T. Brown <[email protected]>
1 parent e342580 commit 74f09df

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

datasource/src/main/scala/org/locationtech/rasterframes/datasource/raster/RasterSourceDataSource.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ object RasterSourceDataSource {
4444
final val SHORT_NAME = "raster"
4545
final val PATH_PARAM = "path"
4646
final val PATHS_PARAM = "paths"
47-
final val BAND_INDEXES_PARAM = "bandIndexes"
48-
final val TILE_DIMS_PARAM = "tileDimensions"
49-
final val CATALOG_TABLE_PARAM = "catalogTable"
50-
final val CATALOG_TABLE_COLS_PARAM = "catalogColumns"
51-
final val CATALOG_CSV_PARAM = "catalogCSV"
52-
final val LAZY_TILES_PARAM = "lazyTiles"
47+
final val BAND_INDEXES_PARAM = "band_indexes"
48+
final val TILE_DIMS_PARAM = "tile_dimensions"
49+
final val CATALOG_TABLE_PARAM = "catalog_table"
50+
final val CATALOG_TABLE_COLS_PARAM = "catalog_col_names"
51+
final val CATALOG_CSV_PARAM = "catalog_csv"
52+
final val LAZY_TILES_PARAM = "lazy_tiles"
5353

5454
final val DEFAULT_COLUMN_NAME = PROJECTED_RASTER_COLUMN.columnName
5555

pyrasterframes/src/main/python/docs/languages.pymd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ sql("""
9797
CREATE OR REPLACE TEMPORARY VIEW red_nir_tiles_monthly_2017
9898
USING raster
9999
OPTIONS (
100-
catalogTable='red_nir_monthly_2017',
101-
catalogColumns='red,nir',
102-
tileDimensions='256,256'
100+
catalog_table='red_nir_monthly_2017',
101+
catalog_col_names='red,nir',
102+
tile_dimensions='256,256'
103103
)
104104
""")
105105
```

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ def temp_name():
153153
band_indexes = [0]
154154

155155
options.update({
156-
"bandIndexes": to_csv(band_indexes),
157-
"tileDimensions": to_csv(tile_dimensions),
158-
"lazyTiles": lazy_tiles
156+
"band_indexes": to_csv(band_indexes),
157+
"tile_dimensions": to_csv(tile_dimensions),
158+
"lazy_tiles": lazy_tiles
159159
})
160160

161161
# Parse the `source` argument
@@ -166,11 +166,11 @@ def temp_name():
166166
catalog = None
167167
options.update(dict(paths='\n'.join([str(i) for i in source]))) # pass in "uri1\nuri2\nuri3\n..."
168168
if all([isinstance(i, list) for i in source]):
169-
# list of lists; we will rely on pandas to
170-
# - coerce all data to str (possibly using objects' __str__ or __repr__\
169+
# list of lists; we will rely on pandas to:
170+
# - coerce all data to str (possibly using objects' __str__ or __repr__)
171171
# - ensure data is not "ragged": all sublists are same len
172172
path = None
173-
catalog_col_names = ['proj_raster_{}'.format(i) for i in range(len(source[0]))]
173+
catalog_col_names = ['proj_raster_{}'.format(i) for i in range(len(source[0]))] # assign these names
174174
catalog = PdDataFrame(source,
175175
columns=catalog_col_names,
176176
dtype=str,
@@ -194,8 +194,8 @@ def temp_name():
194194

195195
if isinstance(catalog, str):
196196
options.update({
197-
"catalogCSV": catalog,
198-
"catalogColumns": to_csv(catalog_col_names)
197+
"catalog_csv": catalog,
198+
"catalog_col_names": to_csv(catalog_col_names)
199199
})
200200
elif isinstance(catalog, DataFrame):
201201
# check catalog_col_names
@@ -205,8 +205,8 @@ def temp_name():
205205
tmp_name = temp_name()
206206
catalog.createOrReplaceTempView(tmp_name)
207207
options.update({
208-
"catalogTable": tmp_name,
209-
"catalogColumns": to_csv(catalog_col_names)
208+
"catalog_table": tmp_name,
209+
"catalog_col_names": to_csv(catalog_col_names)
210210
})
211211
elif isinstance(catalog, PdDataFrame):
212212
# check catalog_col_names
@@ -220,8 +220,8 @@ def temp_name():
220220
spark_catalog = session.createDataFrame(catalog)
221221
spark_catalog.createOrReplaceTempView(tmp_name)
222222
options.update({
223-
"catalogTable": tmp_name,
224-
"catalogColumns": to_csv(catalog_col_names)
223+
"catalog_table": tmp_name,
224+
"catalog_col_names": to_csv(catalog_col_names)
225225
})
226226

227227
return df_reader \

0 commit comments

Comments
 (0)