# [Topcoder] import sys import os import os.path sys.path.append(os.path.dirname(os.path.dirname(__file__))) # Load the needed modules from bemio from bemio.io.wamit import read from bemio.io.output import write_hdf5 from bemio.utilities.hdf_utilities import combine_h5 from bemio.utilities.hdf_utilities import create_hydro_data # .out files inFile = sys.argv[1] inDir = os.path.dirname(inFile) head, tail = os.path.split(inFile) head = os.path.dirname(head) # H5 files #outFile = os.path.splitext(inFile)[0] # Load the data using the wamit module. wamit_1 = read(out_file=inFile+'.out') write_hdf5(wamit_1,out_file = head + '/openwarp/' + tail + '.h5' )
# Import bemio modules from bemio.io.wamit import read from bemio.io.output import write_hdf5 # Load the data wamit_data = read(out_file='ellipsoid.out') num_bodies = wamit_data.body[0].num_bodies # Calculate IRF for i in xrange(num_bodies): wamit_data.body[i].calc_irf_radiation(t_end=100., n_t=1001, n_w=1001) wamit_data.body[i].calc_ss_radiation() wamit_data.body[i].calc_irf_excitation(t_end=100., n_t=1001, n_w=1001) # Save the data in HDF5 format write_hdf5(wamit_data)
#! /usr/bin/python # bemio WAMIT tutorial # Load the needed modules from bemio from bemio.io.wamit import read from bemio.io.output import write_hdf5 # Load the data using the wamit module. wamit_data = read(out_file='./sphere.out') # Calculate IRF and plot using the wamit module for i in xrange(wamit_data.body[0].num_bodies): #wamit_data.body[0].num_bodies wamit_data.body[i].calc_irf_radiation(t_end=100,n_t=201,n_w=201) #wamit_data.body[i].calc_ss_radiation(max_order=5, r2_thresh=0.90) wamit_data.body[i].calc_irf_excitation(t_end=50,n_t=101,n_w=101) # Save the data in the hdf5 format. write_hdf5(wamit_data)
from bemio.io.aqwa import read from bemio.io.output import write_hdf5 # Load AQWA output data file aqwa_data = read(hydro_file='./data/aqwa_example_data.AH1', list_file='./data/aqwa_example_data.LIS') # Calculate IRF and state space coefficients for i in range(aqwa_data.body[0].num_bodies): aqwa_data.body[i].calc_irf_radiation(t_end=50, n_t=101, n_w=101) aqwa_data.body[i].calc_irf_excitation() # aqwa_data.body[i].calc_ss_radiation(max_order=3, r2_thresh=0.5 ) # Write hydrodynamic data to HDF5 file format write_hdf5(aqwa_data)
#! /usr/bin/python from bemio.io.nemoh import read from bemio.io.output import write_hdf5 ### Read the Nemoh simulation data # One body nemoh_data_one_body = read(sim_dir='./data/one_body', cal_file='Nemoh.cal', results_dir='Results', mesh_dir='Mesh') nemoh_data_one_body.read_hydrostatics(body_num=0,file='./data/one_body/Mesh/Hydrostatics.dat') nemoh_data_one_body.read_kh(body_num=0, file='./data/one_body/Mesh/KH.dat') write_hdf5(nemoh_data_one_body) # Two body nemoh_data_two_body = read(sim_dir='./data/two_body', cal_file='Nemoh.cal', results_dir='Results', mesh_dir='Mesh') nemoh_data_two_body.read_hydrostatics(body_num=1,file='./data/two_body/Mesh/Hydrostatics_1.dat') nemoh_data_two_body.read_kh(body_num=1, file='./data/two_body/Mesh/KH_1.dat') for i in xrange(nemoh_data_two_body.body[0].num_bodies): nemoh_data_two_body.body[i].calc_irf_radiation(t_end=20., n_t=1001, n_w=501) nemoh_data_two_body.body[i].calc_irf_excitation(t_end=20., n_t=1001, n_w=501) # nemoh_data_two_body.body[i].calc_ss_radiation() write_hdf5(nemoh_data_two_body)
# Load the needed modules from bemio from bemio.io.wamit import read from bemio.io.output import write_hdf5 from bemio.utilities.hdf_utilities import combine_h5 from bemio.utilities.hdf_utilities import create_hydro_data # Load the data using the wamit module. wamit_1 = read(out_file='wamit_data/coer_comp_f.out') write_hdf5(wamit_1, out_file='wamit_1.h5') # Load the data using the wamit module. wamit_2 = read(out_file='wamit_data/coer_comp_f.out') write_hdf5(wamit_2, out_file='wamit_2.h5') hdf5_data = combine_h5(['wamit_1.h5', 'wamit_2.h5']) hydro_data = create_hydro_data(hdf5_data)
#! /usr/bin/python from bemio.io.nemoh import read from bemio.io.output import write_hdf5 ### Read the Nemoh simulation data # One body nemoh_data_one_body = read(sim_dir='./data/one_body', cal_file='Nemoh.cal', results_dir='Results', mesh_dir='Mesh') nemoh_data_one_body.read_hydrostatics(body_num=0,file='./data/one_body/Mesh/Hydrostatics.dat') nemoh_data_one_body.read_kh(body_num=0, file='./data/one_body/Mesh/KH.dat') write_hdf5(nemoh_data_one_body) # Two body nemoh_data_two_body = read(sim_dir='./data/two_body', cal_file='Nemoh.cal', results_dir='Results', mesh_dir='Mesh') nemoh_data_two_body.read_hydrostatics(body_num=1,file='./data/two_body/Mesh/Hydrostatics_1.dat') nemoh_data_two_body.read_kh(body_num=1, file='./data/two_body/Mesh/KH_1.dat') for i in range(nemoh_data_two_body.body[0].num_bodies): nemoh_data_two_body.body[i].calc_irf_radiation(t_end=20., n_t=1001, n_w=501) nemoh_data_two_body.body[i].calc_irf_excitation(t_end=20., n_t=1001, n_w=501) # nemoh_data_two_body.body[i].calc_ss_radiation() write_hdf5(nemoh_data_two_body)
# Load the needed modules from bemio from bemio.io.wamit import read from bemio.io.output import write_hdf5 # Load the data using the wamit module. wamit_data_f = read(out_file='coer_comp_f.out') # Calculate IRF and SS coefficients for i in xrange(wamit_data_f.body[0].num_bodies): #wamit_data_f.body[0].num_bodies wamit_data_f.body[i].calc_irf_radiation(t_end=20.0, n_t=2001, n_w=4001) # wamit_data_f.body[i].calc_ss_radiation(max_order=7, r2_thresh=0.95) wamit_data_f.body[i].calc_irf_excitation(t_end=20.0, n_t=2001, n_w=4001) # Save the data in the hdf5 format. write_hdf5(wamit_data_f,out_file='coer_comp_f.h5')
from bemio.io.aqwa import read from bemio.io.output import write_hdf5 # Load AQWA output data file aqwa_data = read(hydro_file='./data/aqwa_example_data.AH1',list_file='./data/aqwa_example_data.LIS') # Calculate IRF and state space coefficients for i in xrange(aqwa_data.body[0].num_bodies): aqwa_data.body[i].calc_irf_radiation(t_end=50,n_t=101,n_w=101) aqwa_data.body[i].calc_irf_excitation() # aqwa_data.body[i].calc_ss_radiation(max_order=3, r2_thresh=0.5 ) # Write hydrodynamic data to HDF5 file format write_hdf5(aqwa_data)
from bemio.io.wamit import read from bemio.io.output import write_hdf5 import os import matplotlib.pyplot as plt plt.close('all') plt.interactive(True) # Load the data wamit_data = read(out_file='./wamit_data/oswec.out') num_bodies = wamit_data.body[0].num_bodies # Calculate IRF and plot for i in xrange(num_bodies): wamit_data.body[i].calc_irf_excitation(t_end=30.) wamit_data.body[i].calc_irf_radiation(t_end=30.) # wamit_data.body[i].calc_ss_radiation() # Save the data in HDF5 format write_hdf5(wamit_data,out_file='oswec.h5')
# Load the needed modules from bemio from bemio.io.wamit import read from bemio.io.output import write_hdf5 from bemio.utilities.hdf_utilities import combine_h5 from bemio.utilities.hdf_utilities import create_hydro_data # Load the data using the wamit module. wamit_1 = read(out_file='wamit_data/coer_comp_f.out') write_hdf5(wamit_1,out_file='wamit_1.h5') # Load the data using the wamit module. wamit_2 = read(out_file='wamit_data/coer_comp_f.out') write_hdf5(wamit_2,out_file='wamit_2.h5') hdf5_data = combine_h5(['wamit_1.h5','wamit_2.h5']) hydro_data = create_hydro_data(hdf5_data)
from bemio.io.wamit import read from bemio.io.output import write_hdf5 import os import matplotlib.pyplot as plt plt.close('all') plt.interactive(True) # Load the data wamit_data = read(out_file='oswec.out') num_bodies = wamit_data.body[0].num_bodies # Calculate IRF and plot for i in xrange(num_bodies): wamit_data.body[i].calc_irf_excitation(t_end=30.) wamit_data.body[i].calc_irf_radiation(t_end=30.) # wamit_data.body[i].calc_ss_radiation() # Save the data in HDF5 format write_hdf5(wamit_data,out_file='oswec.h5')