Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated lonlat_to_cartesian functions #842

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 0 additions & 62 deletions cpp/include/cuspatial/coordinate_transform.hpp

This file was deleted.

10 changes: 0 additions & 10 deletions cpp/src/spatial/sinusoidal_projection.cu
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,4 @@ pair_of_columns sinusoidal_projection(double origin_lon,
origin_lon, origin_lat, input_lon, input_lat, rmm::cuda_stream_default, mr);
}

// deprecated
pair_of_columns lonlat_to_cartesian(double origin_lon,
double origin_lat,
cudf::column_view const& input_lon,
cudf::column_view const& input_lat,
rmm::mr::device_memory_resource* mr)
{
return sinusoidal_projection(origin_lon, origin_lat, input_lon, input_lat, mr);
}

} // namespace cuspatial
2 changes: 1 addition & 1 deletion docs/source/api_docs/spatial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Bounding Boxes
Projection Functions
++++++++++++++++++++

.. autofunction:: cuspatial.lonlat_to_cartesian
.. autofunction:: cuspatial.sinusoidal_projection

Spatial Filtering Functions
+++++++++++++++++++++++++++
Expand Down
25 changes: 12 additions & 13 deletions docs/source/user_guide/cuspatial_api_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -638,36 +638,35 @@
"cuSpatial provides a simple sinusoidal longitude / latitude to Cartesian coordinate transform. \n",
"This function requires an origin point to determine the scaling parameters for the lonlat inputs. \n",
"\n",
"### [cuspatial.lonlat_to_cartesian](https://docs.rapids.ai/api/cuspatial/nightly/api_docs/spatial.html#cuspatial.lonlat_to_cartesian)\n",
"### [cuspatial.sinusoidal_projection](https://docs.rapids.ai/api/cuspatial/nightly/api_docs/spatial.html#cuspatial.sinusoidal_projection)\n",
"\n",
"The following cell converts the lonlat coordinates of the country of Afghanistan to Cartesian \n",
"coordinates in km, centered around the center of the country, suitable for graphing and display."
]
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 1,
"id": "a7a870dd-c0ae-41c1-a66c-cff4bd2db0ec",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" x y\n",
"0 112.173577 -281.589872\n",
"1 62.152088 -280.852048\n",
"2 -5.573132 -257.390948\n",
"3 -33.070528 -243.848851\n",
"4 -98.002306 -279.540041\n"
"ename": "NameError",
harrism marked this conversation as resolved.
Show resolved Hide resolved
"evalue": "name 'geopandas' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[1], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m host_dataframe \u001b[39m=\u001b[39m geopandas\u001b[39m.\u001b[39mread_file(geopandas\u001b[39m.\u001b[39mdatasets\u001b[39m.\u001b[39mget_path(\u001b[39m\"\u001b[39m\u001b[39mnaturalearth_lowres\u001b[39m\u001b[39m\"\u001b[39m))\n\u001b[1;32m 2\u001b[0m gpu_dataframe \u001b[39m=\u001b[39m cuspatial\u001b[39m.\u001b[39mfrom_geopandas(host_dataframe)\n\u001b[1;32m 3\u001b[0m afghanistan \u001b[39m=\u001b[39m gpu_dataframe[\u001b[39m'\u001b[39m\u001b[39mgeometry\u001b[39m\u001b[39m'\u001b[39m][gpu_dataframe[\u001b[39m'\u001b[39m\u001b[39mname\u001b[39m\u001b[39m'\u001b[39m] \u001b[39m==\u001b[39m \u001b[39m'\u001b[39m\u001b[39mAfghanistan\u001b[39m\u001b[39m'\u001b[39m]\n",
"\u001b[0;31mNameError\u001b[0m: name 'geopandas' is not defined"
]
}
],
"source": [
"host_dataframe = geopandas.read_file(geopandas.datasets.get_path(\"naturalearth_lowres\"))\n",
"gpu_dataframe = cuspatial.from_geopandas(host_dataframe)\n",
"afghanistan = gpu_dataframe['geometry'][gpu_dataframe['name'] == 'Afghanistan']\n",
"projected = cuspatial.lonlat_to_cartesian(\n",
"projected = cuspatial.sinusoidal_projection(\n",
" afghanistan.polygons.x.mean(),\n",
" afghanistan.polygons.y.mean(),\n",
" afghanistan.polygons.x,\n",
Expand Down Expand Up @@ -1362,7 +1361,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.9.15"
},
"vscode": {
"interpreter": {
Expand Down
4 changes: 2 additions & 2 deletions java/src/main/native/src/cuSpatialJni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cuspatial_CuSpatial_lonlatToCartesia
column_view *input_lon_column_view = reinterpret_cast<column_view *>(input_lon_view_handle);
column_view *input_lat_column_view = reinterpret_cast<column_view *>(input_lat_view_handle);
std::pair<std::unique_ptr<cudf::column>, std::unique_ptr<cudf::column>> result =
cuspatial::lonlat_to_cartesian(origin_lon, origin_lat, *input_lon_column_view,
*input_lat_column_view);
cuspatial::sinusoidal_projection(origin_lon, origin_lat, *input_lon_column_view,
*input_lat_column_view);

std::vector<std::unique_ptr<cudf::column>> columns;
columns.emplace_back(std::move(result.first));
Expand Down
4 changes: 2 additions & 2 deletions python/cuspatial/benchmarks/api/bench_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ def bench_linestring_bounding_boxes(benchmark, sorted_trajectories):
)


def bench_lonlat_to_cartesian(benchmark, gpu_dataframe):
def bench_sinusoidal_projection(benchmark, gpu_dataframe):
afghanistan = gpu_dataframe["geometry"][
gpu_dataframe["name"] == "Afghanistan"
]
benchmark(
cuspatial.lonlat_to_cartesian,
cuspatial.sinusoidal_projection,
afghanistan.polygons.y.mean(),
afghanistan.polygons.x.mean(),
afghanistan.polygons.y,
Expand Down
1 change: 0 additions & 1 deletion python/cuspatial/cuspatial/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
haversine_distance,
join_quadtree_and_bounding_boxes,
linestring_bounding_boxes,
lonlat_to_cartesian,
pairwise_linestring_distance,
pairwise_point_distance,
pairwise_point_linestring_distance,
Expand Down
3 changes: 1 addition & 2 deletions python/cuspatial/cuspatial/core/spatial/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@
quadtree_point_to_nearest_linestring,
)
from .nearest_points import pairwise_point_linestring_nearest_points
from .projection import lonlat_to_cartesian, sinusoidal_projection
from .projection import sinusoidal_projection

__all__ = [
"directed_hausdorff_distance",
"haversine_distance",
"join_quadtree_and_bounding_boxes",
"sinusoidal_projection",
"lonlat_to_cartesian",
"pairwise_point_distance",
"pairwise_linestring_distance",
"pairwise_point_linestring_distance",
Expand Down
41 changes: 0 additions & 41 deletions python/cuspatial/cuspatial/core/spatial/projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,44 +48,3 @@ def sinusoidal_projection(origin_lon, origin_lat, input_lon, input_lat):
origin_lon, origin_lat, input_lon._column, input_lat._column
)
return DataFrame({"x": result[0], "y": result[1]})


def lonlat_to_cartesian(origin_lon, origin_lat, input_lon, input_lat):
"""
Convert lon/lat to ``x,y`` coordinates with respect to an origin lon/lat
point. Results are scaled relative to the size of the Earth in kilometers.

This API is deprecated. Please use sinusoidal_projection.

Parameters
----------
origin_lon : ``number``
longitude offset (this is subtracted from each input before
converting to x,y)
origin_lat : ``number``
latitude offset (this is subtracted from each input before
converting to x,y)
input_lon : ``Series`` or ``list``
longitude coordinates to convert to x
input_lat : ``Series`` or ``list``
latitude coordinates to convert to y

Returns
-------
result : cudf.DataFrame
x : cudf.Series
x-coordinate of the input relative to the size of the Earth in
kilometers.
y : cudf.Series
y-coordinate of the input relative to the size of the Earth in
kilometers.
"""
warnings.warn(
"lonlat_to_cartesian is deprecated. "
"Please use sinusoidal_projection.",
FutureWarning,
)
result = cpp_sinusoidal_projection(
origin_lon, origin_lat, input_lon._column, input_lat._column
)
return DataFrame({"x": result[0], "y": result[1]})
2 changes: 1 addition & 1 deletion python/cuspatial/demos/traj_test_soa_locust.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def get_ts_struct(ts):

y, m, d, hh, mm, ss, wd, yd, ms, pid = get_ts_struct(ts_0)

xys = cuspatial.lonlat_to_cartesian(
xys = cuspatial.sinusoidal_projection(
cam_lon, cam_lat, lonlats["lon"], lonlats["lat"]
)
num_traj, trajectories = cuspatial.derive(xys["x"], xys["y"], ids, ts)
Expand Down