def get_pos(da):
    """
    Takes an xarray DataArray containing veg_index values and calculates the vegetation 
    value and time (day of year) at peak of season (pos) for each timeseries per-pixel. 
    The peak of season is the maximum value in the timeseries, per-pixel.
    
    Parameters
    ----------
    ds: xarray DataArray
        A two-dimensional or multi-dimensional array containing an DataArray of veg_index 
        and time values. 

    Returns
    -------
    da_pos_values : xarray DataArray
        An xarray DataArray type with an x and y dimension (no time). Each pixel is the 
        veg_index value detected at the peak of season (pos).
    da_pos_times : xarray DataArray
        An xarray DataArray type with an x and y dimension (no time). Each pixel is the 
        time (day of year) value detected at the peak of season (pos).
    """
    
    # notify user
    print('Beginning calculation of peak of season (pos) values and times.')   

    # get pos values (max val in each pixel timeseries)
    print('Calculating peak of season (pos) values.')
    da_pos_values = da.max('time', keep_attrs=True)
        
    # get pos times (day of year) at max val in each pixel timeseries)
    print('Calculating peak of season (pos) times.')
    i = da.argmax('time', skipna=True)
    da_pos_times = da['time.dayofyear'].isel(time=i, drop=True)
    
    # convert type
    da_pos_values = da_pos_values.astype('float32')
    da_pos_times = da_pos_times.astype('int16')
    
    # rename vars
    da_pos_values = da_pos_values.rename('pos_values')
    da_pos_times = da_pos_times.rename('pos_times')

    # notify user
    print('Success!')
    return da_pos_values, da_pos_times