def day_of_year(dt):
    """
    Calculates the day of year for a numpy.array of numpy.datetime64 date-time
    objects.
    
    Parameters
    ----------
    dt : numpy.datetime64
        Objects of type datetime64 representing the date for which the day of
        the year will be calculated.
    
    Returns
    -------
    int
        An integer between 1 and 366 representing the day of year for a given date.
    
    """
    return ((dt - dt.astype("datetime64[Y]")).astype("timedelta64[D]") + 1).astype(int)