# AUTOGENERATED! DO NOT EDIT! File to edit: 01a_dem_corrections.ipynb (unless otherwise specified).

__all__ = ['t_prime', 'lat_prime']

# Cell
from math import tau

import numpy as np
from fastcore.test import is_close

# Cell
def t_prime(t, slope, az):
    """Calculate effective local time from surface slope and azimuth.

    Parameters
    ----------
    t: float
        Local time of Diviner measurement
    slope: float
        Dimensionless surface slope rise/run, i.e. slope[%] * 100
    az: float
        Azimuth angle of surface, measured from north.

    Returns
    -------
    float: Effective local time
    """
    term2 = 24 / tau * np.arctan(slope * np.sin(np.radians(az)))
    return t + term2


def lat_prime(lat, slope, az):
    """Calculate effective latitude from surface slope and azimuth.

    Parameters
    ----------
    lat: float(deg)
        Latitude of Diviner measurement
    slope: float
        Dimensionless surface slope rise/run, i.e. slope[%] * 100
    az: float
        Azimuth angle of surface, measured from north.

    Returns
    -------
    float: Effective latitude
    """
    term2 = 360 / tau * np.arctan(slope * np.cos(np.radians(az)))
    return lat + term2