Skip to content

Commit dc03ba8

Browse files
committed
Remove toCoord from pyspark3d (deprecated)
1 parent 419ea64 commit dc03ba8

File tree

1 file changed

+0
-84
lines changed

1 file changed

+0
-84
lines changed

pyspark3d/converters.py

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -146,90 +146,6 @@ def scala2python(scala_list: JavaObject) -> list:
146146

147147
return java2python(scala2java(scala_list))
148148

149-
# def toCoordRDD(
150-
# srdd: JavaObject, gridtype: str="", numPartitions: int=None) -> RDD:
151-
# """Convert a RDD of Shape3D objects from spark3D into a PythonRDD whose
152-
# elements are the coordinates of the Shape3D objects.
153-
#
154-
# The element of a RDD coming from the Scala/Java world won't be usable in
155-
# general in Python as they aren't defined (unless you wrote explicitly the
156-
# converter). For example, a RDD[Point3D] is understood in Python, but
157-
# you won't be able to manipulate its elements (Point3D are Java objects).
158-
# The idea is then to manipulate the full RDD in Scala, but interface just
159-
# the coordinates in the end, e.g. for visualisation.
160-
#
161-
# By default, `toCoord` will act on the raw RDD. You can also repartition the
162-
# RDD before the conversion.
163-
#
164-
# Parameters
165-
# ----------
166-
# srdd : JavaObject
167-
# Point3DRDD or SphereRDD instance (spatial3DRDD).
168-
# gridtype : str, optional
169-
# Type of the repartitioning to apply: onion, octree. Default
170-
# is no repartitioning (gridtype="").
171-
# numPartitions : int, optional
172-
# Number of partitions after repartitioning.
173-
#
174-
# Returns
175-
# -------
176-
# RDD
177-
# PythonRDD whose elements are object centers. If gridtype is specified,
178-
# the RDD has been repartitioned.
179-
#
180-
# Examples
181-
# -------
182-
# >>> from pyspark3d_conf import path_to_conf
183-
# >>> from pyspark3d.spatial3DRDD import Point3DRDD
184-
#
185-
# Load data
186-
# >>> fn = os.path.join(path_to_conf, "../src/test/resources/astro_obs.fits")
187-
# >>> p3d = Point3DRDD(spark, fn, "Z_COSMO,RA,DEC",
188-
# ... True, "fits", {"hdu": "1"})
189-
#
190-
# No repartitioning & no change of partition number
191-
# >>> pyrdd = toCoordRDD(p3d)
192-
# >>> print(round(pyrdd.first()[0], 2))
193-
# 0.55
194-
#
195-
# No repartitioning but increase the number of partitions
196-
# >>> pyrdd = toCoordRDD(p3d, numPartitions=100)
197-
# >>> print(round(pyrdd.first()[0], 2))
198-
# 0.06
199-
# >>> print(pyrdd.getNumPartitions())
200-
# 100
201-
#
202-
# OCTREE repartitioning, and increase the number of partitions
203-
# >>> pyrdd = toCoordRDD(p3d, "octree", 100)
204-
# >>> print(round(pyrdd.first()[0], 2))
205-
# 0.92
206-
#
207-
# For Octree, the number of partition is always a power of 8.
208-
# In this case, 8**2 is the closest.
209-
# >>> print(pyrdd.getNumPartitions())
210-
# 64
211-
#
212-
# """
213-
# pysc = get_spark_context()
214-
#
215-
# # Get the desired final number of partitions
216-
# if numPartitions is None:
217-
# npart = srdd.rawRDD().getNumPartitions()
218-
# else:
219-
# npart = numPartitions
220-
#
221-
# # Repartition if needed
222-
# if gridtype != "":
223-
# rdd = srdd.spatialPartitioningPython(gridtype, npart)
224-
# else:
225-
# if numPartitions is None:
226-
# rdd = srdd.rawRDD()
227-
# else:
228-
# rdd = srdd.rawRDD()
229-
# return _java2py(
230-
# pysc, srdd.toCenterCoordinateRDDPython(rdd)).repartition(npart)
231-
# return _java2py(pysc, srdd.toCenterCoordinateRDDPython(rdd))
232-
233149

234150
if __name__ == "__main__":
235151
"""

0 commit comments

Comments
 (0)