gutils/__init__.py
def interpolate_gps(timestamps, latitude, longitude):
    """Calculates interpolated GPS coordinates between the two surfacings

    Parameters:
        'dataset': An N by 3 numpy array of time, lat, lon pairs
    Returns interpolated gps dataset over entire time domain of dataset
    """

    validate_glider_args(timestamps, latitude, longitude)

    est_lat = np.array([np.nan] * latitude.size)
    est_lon = np.array([np.nan] * longitude.size)

    anynull = (timestamps.isnull()) | (latitude.isnull()) | (longitude.isnull())
    newtimes = timestamps.loc[~anynull]
    latitude = latitude.loc[~anynull]
    longitude = longitude.loc[~anynull]

    if latitude.size == 0 or longitude.size == 0:
        L.warning('GPS time-seies contains no valid GPS fixes for interpolation')
        return est_lat, est_lon

    # If only one GPS point, make it the same for the entire dataset
    if latitude.size == 1 and longitude.size == 1:
        est_lat[:] = latitude.iloc[0]
        est_lon[:] = longitude.iloc[0]
    else:
        # Interpolate data
        est_lat = np.interp(
            timestamps,
            newtimes,
            latitude,
            left=latitude.iloc[0],
            right=latitude.iloc[-1]
        )
        est_lon = np.interp(
            timestamps,
            newtimes,
            longitude,
            left=longitude.iloc[0],
            right=longitude.iloc[-1]
        )

    return est_lat, est_lon
Calculates interpolated GPS coordinates between the two surfacings

    Parameters:
        'dataset': An N by 3 numpy array of time, lat, lon pairs
    Returns interpolated gps dataset over entire time domain of dataset
    
Calculates interpolated GPS coordinates between the two surfacings
Calculates interpolated GPS coordinates between the two surfacings
def interpolate_gps(timestamps, latitude, longitude):
    validate_glider_args(timestamps, latitude, longitude)
    est_lat = np.array([np.nan] * latitude.size)
    est_lon = np.array([np.nan] * longitude.size)
    anynull = (timestamps.isnull()) | (latitude.isnull()) | (longitude.isnull())
    newtimes = timestamps.loc[~anynull]
    latitude = latitude.loc[~anynull]
    longitude = longitude.loc[~anynull]
    if latitude.size == 0 or longitude.size == 0:
        L.warning('GPS time-seies contains no valid GPS fixes for interpolation')
        return est_lat, est_lon
    if latitude.size == 1 and longitude.size == 1:
        est_lat[:] = latitude.iloc[0]
        est_lon[:] = longitude.iloc[0]
    else:
        est_lat = np.interp(
            timestamps,
            newtimes,
            latitude,
            left=latitude.iloc[0],
            right=latitude.iloc[-1]
        )
        est_lon = np.interp(
            timestamps,
            newtimes,
            longitude,
            left=longitude.iloc[0],
            right=longitude.iloc[-1]
        )
    return est_lat, est_lon
def interpolate_gps ( timestamps , latitude , longitude ) : validate_glider_args ( timestamps , latitude , longitude ) est_lat = np . array ( [ np . nan ] * latitude . size ) est_lon = np . array ( [ np . nan ] * longitude . size ) anynull = ( timestamps . isnull ( ) ) | ( latitude . isnull ( ) ) | ( longitude . isnull ( ) ) newtimes = timestamps . loc [ ~ anynull ] latitude = latitude . loc [ ~ anynull ] longitude = longitude . loc [ ~ anynull ] if latitude . size == 0 or longitude . size == 0 : L . warning ( 'GPS time-seies contains no valid GPS fixes for interpolation' ) return est_lat , est_lon if latitude . size == 1 and longitude . size == 1 : est_lat [ : ] = latitude . iloc [ 0 ] est_lon [ : ] = longitude . iloc [ 0 ] else : est_lat = np . interp ( timestamps , newtimes , latitude , left = latitude . iloc [ 0 ] , right = latitude . iloc [ - 1 ] ) est_lon = np . interp ( timestamps , newtimes , longitude , left = longitude . iloc [ 0 ] , right = longitude . iloc [ - 1 ] ) return est_lat , est_lon
Calculates interpolated GPS coordinates between the two surfacings
Calculates interpolated GPS coordinates between the two surfacings
"""Calculates interpolated GPS coordinates between the two surfacings

    Parameters:
        'dataset': An N by 3 numpy array of time, lat, lon pairs
    Returns interpolated gps dataset over entire time domain of dataset
    """ # If only one GPS point, make it the same for the entire dataset # Interpolate data
timestamps
latitude
longitude
'dataset'
An N by 3 numpy array of time, lat, lon pairs
An N by 3 numpy array of time lat lon pairs