Skip to content

Commit

Permalink
Remove deprecated lonlat_to_cartesian functions (#842)
Browse files Browse the repository at this point in the history
Closes #796

Authors:
  - Mark Harris (https://github.com/harrism)

Approvers:
  - H. Thomson Comer (https://github.com/thomcom)
  - Michael Wang (https://github.com/isVoid)

URL: #842
  • Loading branch information
harrism authored Dec 7, 2022
1 parent 9ca38c8 commit 138dc69
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 128 deletions.
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
8 changes: 4 additions & 4 deletions docs/source/user_guide/cuspatial_api_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -638,15 +638,15 @@
"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": 5,
"id": "a7a870dd-c0ae-41c1-a66c-cff4bd2db0ec",
"metadata": {},
"outputs": [
Expand All @@ -667,7 +667,7 @@
"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 +1362,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
43 changes: 0 additions & 43 deletions python/cuspatial/cuspatial/core/spatial/projection.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Copyright (c) 2022, NVIDIA CORPORATION.

import warnings

from cudf import DataFrame

from cuspatial._lib.spatial import (
Expand Down Expand Up @@ -48,44 +46,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

0 comments on commit 138dc69

Please sign in to comment.