def sph2cart(*args):
 if (len(args) == 1):
  elev = args[0][0, :]
  azim = args[0][1, :]
  radius = args[0][2, :]
  returnAsArray = True
 elif (len(args) == 3):
  elev = args[0]
  azim = args[1]
  radius = args[2]
  returnAsArray = False
 z = (radius * numpy.sin(radians(elev)))
 x = ((radius * numpy.cos(radians(elev))) * numpy.cos(radians(azim)))
 y = ((radius * numpy.cos(radians(elev))) * numpy.sin(radians(azim)))
 if returnAsArray:
  return numpy.asarray([x, y, z])
 else:
  return (x, y, z)

def sph2cart ( * args ) : if ( len ( args ) == 1 ) : elev = args [ 0 ] [ 0 , : ] azim = args [ 0 ] [ 1 , : ] radius = args [ 0 ] [ 2 , : ] returnAsArray = True elif ( len ( args ) == 3 ) : elev = args [ 0 ] azim = args [ 1 ] radius = args [ 2 ] returnAsArray = False z = ( radius * numpy . sin ( radians ( elev ) ) ) x = ( ( radius * numpy . cos ( radians ( elev ) ) ) * numpy . cos ( radians ( azim ) ) ) y = ( ( radius * numpy . cos ( radians ( elev ) ) ) * numpy . sin ( radians ( azim ) ) ) if returnAsArray : return numpy . asarray ( [ x , y , z ] ) else : return ( x , y , z )
convert from spherical coordinates to cartesian .