Changeset 19421
- Timestamp:
- 07/03/15 00:41:51 (10 years ago)
- Location:
- issm/trunk-jpl/src/m/exp
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/exp/expwrite.py
r17898 r19421 3 3 def expwrite(contours,filename): 4 4 """ 5 EXPWRITE - write an Argus file from a structuregiven in input5 EXPWRITE - write an Argus file from a dictionary given in input 6 6 7 This routine writes an Argus file from a list of dict'scontaining the fields:7 This routine writes an Argus file from a dict containing the fields: 8 8 x and y of the coordinates of the points. 9 9 The first argument is the list containing the points coordinates … … 20 20 21 21 fid=open(filename,'w') 22 for contour in contours: 23 if numpy.size(contour['x'])!=numpy.size(contour['y']): 22 for x,y in zip(contours['x'],contours['y']): 23 #if numpy.size(contour['x'])!=numpy.size(contour['y']): 24 if len(x)!=len(y): 24 25 raise RuntimeError("contours x and y coordinates must be of identical size") 25 26 if 'name' in contour: 26 if 'name' in contours: 27 27 fid.write("%s%s\n" % ('## Name:',contour['name'])) 28 28 else: 29 29 fid.write("%s%s\n" % ('## Name:',filename)) 30 30 31 #Add density if it's not there 32 if 'density' not in contour: 33 contour['density']=1 31 #Add density if it's not there FIXME what is this ever used for? 32 #if 'density' not in contours: 33 # contours['density']=1 34 density=1 34 35 35 36 fid.write("%s\n" % '## Icon:0') 36 37 fid.write("%s\n" % '# Points Count Value') 37 fid.write("%i %f\n" % (numpy.size(contour['x']),contour['density'])) 38 #fid.write("%i %f\n" % (numpy.size(contour['x']),contour['density'])) 39 fid.write("%i %f\n" % (numpy.size(x),density)) 38 40 fid.write("%s\n" % '# X pos Y pos') 39 for x,y in zip(contour['x'],contour['y']): 40 fid.write("%10.10f %10.10f\n" % (x,y)) 41 #for x,y in zip(contour['x'],contour['y']): 42 for xi,yi in zip(x,y): 43 fid.write("%10.10f %10.10f\n" % (xi,yi)) 41 44 fid.write("\n") 42 45
Note:
See TracChangeset
for help on using the changeset viewer.