I'm using V8P1r0.
from data_manip.extraction.parser_selafin import subset_variables_slf,get_value_history
from data_manip.formats.selafin import Selafin
import os
fileName = "r3_Orkney14day130220.slf"
file3D = os.path.join(filePath, fileName)
slf = Selafin(file3D)
var_names=[item.rstrip() for item in slf.varnames]
varnames=[var_names[0:3]]
vars_indexes=[var_names.index('ELEVATION Z'),var_names.index('VELOCITY U'),var_names.index('VELOCITY V')]
times = slf.tags["times"] # print times
nodes = [246576,658083,1069590,1481097,1892604,2304111,2715618] # List of node numbers
series=slf.get_series(nodes, vars_indexes)
L1Z = series[0,0]
L2Z = series[0,1]
L3Z = series[0,2]
L4Z = series[0,3]
L5Z = series[0,4]
L6Z = series[0,5]
L7Z = series[0,6]
L1U=series[1,0]
L2U=series[1,1]
L3U=series[1,2]
L4U=series[1,3]
L5U=series[1,4]
L6U=series[1,5]
L7U=series[1,6]
L1V=series[2,0]
L2V=series[2,1]
L3V=series[2,2]
L4V=series[2,3]
L5V=series[2,4]
L6V=series[2,5]
L7V=series[2,6]
L=[times,L1U,L1V,L2U,L2V,L3U,L3V,L4U,L4V,L5U,L5V,L6U,L6V,L7U,L7V]
import numpy as np
Z=[L1Z,L2Z,L3Z,L4Z,L5Z,L6Z,L7Z]
U=[L1U,L2U,L3U,L4U,L5U,L6U,L7U]
V=[L1V,L2V,L3V,L4V,L5V,L6V,L7V]
VEL= U/np.cos(np.arctan2(V,U))
DIR= np.degrees(0.5 * np.pi-np.arctan2(V,U))
Time = [times]
import csv
with open('VEL.csv', 'wb') as csvfile:
csv_writer = csv.writer(csvfile, delimiter=' ')
csv_writer.writerow('\n')
csv_writer.writerows(Time)
csv_writer.writerow('\n')
csv_writer.writerows(U)
csv_writer.writerow('\n')
csv_writer.writerows(V)
csv_writer.writerow('\n')
csv_writer.writerows(VEL)
csv_writer.writerow('\n')
csv_writer.writerows(DIR)
csv_writer.writerow('\n')
csv_writer.writerows(Z)