Changeset 2438 in lmdz_wrf for trunk/tools/geometry_tools.py


Ignore:
Timestamp:
Apr 14, 2019, 10:51:53 PM (6 years ago)
Author:
lfita
Message:

Adding creation of file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/geometry_tools.py

    r2437 r2438  
    1414from mpl_toolkits.mplot3d import Axes3D
    1515import matplotlib.pyplot as plt
     16import os
    1617
    1718errormsg = 'ERROR -- error -- ERROR -- error'
     19infmsg = 'INFORMATION -- information -- INFORMATION -- information'
    1820
    1921####### Contents:
     
    416418    boat[4*dpts:5*dpts,:] = fstarboardsaid
    417419
     420    fname = 'boat_L' + str(int(length*100.)) + '_B' + str(int(beam*100.)) + '_lb' +  \
     421      str(int(lbeam*100.)) + '_sb' + str(int(sternbp*100.)) + '.dat'
     422    if not os.path.isfile(fname):
     423        print infmsg
     424        print '  ' + fname + ": writting boat coordinates file '" + fname + "' !!"
     425        of = open(fname, 'w')
     426        of.write('# boat file with Length: ' + str(length) +' max_beam: '+str(beam)+ \
     427          'length_at_max_beam:' + str(lbeam) + '% beam at stern: ' + str(sternbp)+   \
     428          ' %\n')
     429        for ip in range(dpts*5):
     430            of.write(str(boat[ip,0]) + ' ' + str(boat[ip,1]) + '\n')
     431       
     432        of.close()
     433        print fname + ": Successfull written '" + fname + "' !!"
     434 
    418435    return boat
    419436
Note: See TracChangeset for help on using the changeset viewer.