code: def dimap(D, I):
      
      try:
          D = float(D)
          I = float(I)
      except TypeError:  # is an array
          return dimap_V(D, I)
  # DEFINE FUNCTION VARIABLES
      # initialize equal area projection x,y
      XY = [0., 0.]
  
  # GET CARTESIAN COMPONENTS OF INPUT DIRECTION
      X = dir2cart([D, I, 1.])
  
  # CHECK IF Z = 1 AND ABORT
      if X[2] == 1.0:
          return XY                       # return [0,0]
  
  # TAKE THE ABSOLUTE VALUE OF Z
      if X[2] < 0:
          # this only works on lower hemisphere projections
          X[2] = -X[2]
  
  # CALCULATE THE X,Y COORDINATES FOR THE EQUAL AREA PROJECTION
      # from Collinson 1983
      R = old_div(np.sqrt(1. - X[2]), (np.sqrt(X[0]**2 + X[1]**2)))
      XY[1], XY[0] = X[0] * R, X[1] * R
  
  # RETURN XY[X,Y]
      return XY
docs: Function to map directions  to x,y pairs in equal area projection
  
      Parameters
      ----------
      D : list or array of declinations (as float)
      I : list or array or inclinations (as float)
  
      Returns
      -------
      XY : x, y values of directions for equal area projection [x,y]