|
Last change
on this file since 13975 was 13395, checked in by Mathieu Morlighem, 13 years ago |
|
merged trunk-jpl and trunk for revision 13393
|
|
File size:
1.2 KB
|
| Line | |
|---|
| 1 | import numpy
|
|---|
| 2 |
|
|---|
| 3 | def expwrite(contours,filename):
|
|---|
| 4 | """
|
|---|
| 5 | EXPWRITE - write an Argus file from a structure given in input
|
|---|
| 6 |
|
|---|
| 7 | This routine write an Argus file form a structure containing the fields:
|
|---|
| 8 | x and y of the coordinates of the points.
|
|---|
| 9 | The first argument is the structure containing the points coordinates
|
|---|
| 10 | and the second one the file to be write.
|
|---|
| 11 |
|
|---|
| 12 | Usage:
|
|---|
| 13 | expwrite(contours,filename)
|
|---|
| 14 |
|
|---|
| 15 | Example:
|
|---|
| 16 | expwrite(coordstruct,'domainoutline.exp')
|
|---|
| 17 |
|
|---|
| 18 | See also EXPDOC, EXPREAD, EXPWRITEASVERTICES
|
|---|
| 19 | """
|
|---|
| 20 |
|
|---|
| 21 | fid=open(filename,'w')
|
|---|
| 22 | for contour in contours:
|
|---|
| 23 | if numpy.size(contour['x'])!=numpy.size(contour['y']):
|
|---|
| 24 | raise RuntimeError("contours x and y coordinates must be of identical size")
|
|---|
| 25 |
|
|---|
| 26 | if 'name' in contour:
|
|---|
| 27 | if contour['name']:
|
|---|
| 28 | fid.write("%s%s\n" % ('## Name:',contour['name']))
|
|---|
| 29 | else:
|
|---|
| 30 | fid.write("%s\n" % '## Name:')
|
|---|
| 31 | else:
|
|---|
| 32 | fid.write("%s\n" % '## Name:')
|
|---|
| 33 |
|
|---|
| 34 | fid.write("%s\n" % '## Icon:0')
|
|---|
| 35 | fid.write("%s\n" % '# Points Count Value')
|
|---|
| 36 | fid.write("%i %f\n" % (numpy.size(contour['x']),contour['density']))
|
|---|
| 37 | fid.write("%s\n" % '# X pos Y pos')
|
|---|
| 38 | for x,y in zip(contour['x'],contour['y']):
|
|---|
| 39 | fid.write("%10.10f %10.10f\n" % (x,y))
|
|---|
| 40 | fid.write("\n")
|
|---|
| 41 |
|
|---|
| 42 | fid.close()
|
|---|
| 43 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.