Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Args:
num_bands (int): The number of bands the ``TiledRasterLayer`` has.
Returns:
:class:`~geopyspark.geotrellis.layer.TiledRasterLayer`
"""
try:
from pyrasterframes import RasterFrame
except ImportError:
raise ImportError("pyrasterframes must be installed in order to use the to_rasterframe method")
rf_context = get_spark_context()._rf_context
if rf_context:
return RasterFrame(rf_context._jrfctx.asRF(self.srdd.rdd(), num_bands), rf_context._spark_session)
else:
raise AttributeError("RasterFrames has not been enabled in the active SparkSession")