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

Move cartesian coordinate handling to a utils package #24

Open
sjoro opened this issue May 28, 2020 · 0 comments
Open

Move cartesian coordinate handling to a utils package #24

sjoro opened this issue May 28, 2020 · 0 comments

Comments

@sjoro
Copy link
Contributor

sjoro commented May 28, 2020

Cartesian coordinate handling could be generalized in a utils-package, something like:

from functools import wraps

def use_carts(use_carts=False, latitude_xy_threshold=60):
    """Convert input to a function to cartesian and back."""
    def decorator(func):
        @wraps(func)
        def wrapper(data, **kwargs):
            if use_carts:
                data = _lonlat2xyz(*data)
            result = func(data, **kwargs)
            if use_carts:
                result = _xyz2lonlat(*result, latitude_xy_threshold=latitude_xy_threshold)
            return result
        return wrapper
    return decorator

Usage would be simplified to

interpolate = use_carts(to_cart)(tie_points_interpolation)
return interpolate([longitude, latitude], scan_alt_tie_points, tie_points_factor)
@sjoro sjoro mentioned this issue May 28, 2020
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant