Changeset 26744 for issm/trunk/src/m/exp/expwrite.py
- Timestamp:
- 12/22/21 10:39:44 (3 years ago)
- Location:
- issm/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk
- Property svn:mergeinfo changed
/issm/trunk-jpl merged: 25837-25866,25868-25993,25995-26330,26332-26733,26736-26739,26741
- Property svn:mergeinfo changed
-
issm/trunk/src
- Property svn:mergeinfo changed
-
issm/trunk/src/m/exp/expwrite.py
r24313 r26744 3 3 4 4 def expwrite(contours, filename): 5 """ 6 EXPWRITE - write an Argus file from a dictionary given in input 5 """EXPWRITE - write an Argus file from a dictionary given in input 7 6 8 9 10 The first argument is the list containing the points coordinates11 and thesecond one the file to be written.7 This routine writes an Argus file from a dict containing the fields: 8 x and y of the coordinates of the points. 9 The first argument is the list containing the points coordinates and the 10 second one the file to be written. 12 11 13 14 12 Usage: 13 expwrite(contours, filename) 15 14 16 17 15 Example: 16 expwrite(coordstruct, 'domainoutline.exp') 18 17 19 18 See also EXPDOC, EXPREAD, EXPWRITEASVERTICES 20 19 """ 21 20 22 21 fid = open(filename, 'w') 23 22 for x, y in zip(contours['x'], contours['y']): 24 #if np.size(contour['x']) != np.size(contour['y']):25 23 if len(x) != len(y): 26 raise RuntimeError("contours x and y coordinates must be of identical size") 24 raise RuntimeError('contours x and y coordinates must be of identical size') 25 27 26 if 'name' in contours: 28 fid.write( "%s%s\n" % ('# Name:', contours['name']))27 fid.write('{}{}\n'.format('# Name:', contours['name'])) 29 28 else: 30 fid.write( "%s%s\n" % ('# Name:', filename))29 fid.write('{}{}\n'.format('# Name:', filename)) 31 30 32 #Add density if it's not there FIXME what is this ever used for? 33 #if 'density' not in contours: 34 # contours['density'] = 1 35 density = 1 36 37 fid.write("%s\n" % ' # Icon:0') 38 fid.write("%s\n" % ' # Points Count Value') 39 #fid.write("%i %f\n" % (np.size(contour['x']), contour['density'])) 40 fid.write("%i %f\n" % (np.size(x), density)) 41 fid.write("%s\n" % ' # X pos Y pos') 42 #for x, y in zip(contour['x'], contour['y']): 31 fid.write('{}\n'.format('## Icon:0')) 32 fid.write('{}\n'.format('# Points Count Value')) 33 if 'density' in contours: 34 if isinstance(contours['density'], int): 35 fid.write('{} {}\n'.format(np.size(x), contours['density'])) 36 else: 37 fid.write('{} {}\n'.format(np.size(x), 1.)) 38 else: 39 fid.write('{} {}\n'.format(np.size(x), 1.)) 40 fid.write('{}\n'.format('# X pos Y pos')) 43 41 for xi, yi in zip(x, y): 44 fid.write( "%10.10f %10.10f\n"% (xi, yi))45 fid.write( "\n")42 fid.write('%10.10f %10.10f\n' % (xi, yi)) 43 fid.write('\n') 46 44 47 45 fid.close()
Note:
See TracChangeset
for help on using the changeset viewer.