Skip to content

Move cartesian coordinate handling to a utils package #24

@sjoro

Description

@sjoro

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions