code: def pick(picklist,val):
      '''Index to first value in picklist that is larger than val.
  If none is larger, index=len(picklist).'''
      
      assert np.all(np.sort(picklist) == picklist), "pick list is not ordered correctly"
      val = np.array(val)
      i_pick, i_val = np.mgrid[0:len(picklist),0:len(val)]
      #
      # Mark a picklist entry as 1 if the value is before or at,
      # mark it as zero if it is afterward
      #
      is_not_larger = picklist[i_pick] <= val[i_val]
      #
      # The index is the number of entries that are 1
      #
      p = np.sum(is_not_larger, 0)
      
      return f pick(picklist,val):
      '''Index to first value in picklist that is larger than val.
  If none is larger, index=len(picklist).'''
      
      assert np.all(np.sort(picklist) == picklist), "pick list is not ordered correctly"
      val = np.array(val)
      i_pick, i_val = np.mgrid[0:len(picklist),0:len(val)]
      #
      # Mark a picklist entry as 1 if the value is before or at,
      # mark it as zero if it is afterward
      #
      is_not_larger = picklist[i_pick] <= val[i_val]
      #
      # The index is the number of entries that are 1
      #
      p = np.sum(is_not_larger, 0)
      
      return p
docs: Index to first value in picklist that is larger than val.
  If none is larger, index=len(picklist).