TL EFFECTS VERSION 1/4
ENTER MAGNITUDE, ANGLE
{mag_angles_table: magnitudes and angles}
{rho: ENTER EARTH RESISTIVITY IN OHM-METERS}
ENTER COORDINATES OF PARALLEL CONDUCTOR AND AUGMENT THE LINE IMPEDANCE MATRIX
{x: X}
{y: Y}
# CrossCompute
mag_angles_table_path = 'magnitude_angles.csv'
rho = 100
x = 0
y = 0
target_folder = '/tmp'
from os.path import join
output_text_path = join(target_folder, 'magnetic_field_parallel.log')
target_text_path = join(target_folder, 'magnetic_field_parallel.txt')
from pandas import read_csv
df = read_csv(mag_angles_table_path)
df
mag_angles = [','.join((str(x), str(y))) for x,y in zip(df['magnitudes'], df['angles'])]
pylon_text_path = ''
from itertools import chain
from os.path import expanduser
cmd = list(chain([
'./magnetic_field_parallel.out',
pylon_text_path,
expanduser(target_text_path)
],
mag_angles,
[str(rho),
str(x),
str(y)]))
from subprocess import check_output, STDOUT
output_text = check_output(cmd, stderr=STDOUT)
with open(output_text_path, 'wb') as output_file:
output_file.write(output_text)
print('output_text_path = ' + output_text_path)
print('target_text_path = ' + target_text_path)