Changeset 27950
- Timestamp:
- 10/08/23 10:41:58 (18 months ago)
- Location:
- issm/trunk-jpl/src/m
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/exp/contourlevelzero.py
r26374 r27950 3 3 from collections import OrderedDict 4 4 5 5 6 def contourlevelzero(md,mask,level): 6 """CONTOURLEVELZERO - figure out the zero level (or offset thereof, specified by the level value) 7 of a vectorial mask, and vectorialize it into an exp or shp compatible structure. 8 9 Usage: 10 contours=contourlevelzero(md,mask,level) 11 12 See also: PLOT_CONTOUR 7 """CONTOURLEVELZERO - figure out the zero level (or offset thereof, 8 specified by the level value of a vectorial mask, and vectorialize it into 9 an exp or shp compatible structure. 10 11 Usage: 12 contours=contourlevelzero(md,mask,level) 13 14 See also: PLOT_CONTOUR 13 15 """ 14 15 # process data16 if md.mesh.dimension() ==3:16 17 # Process data 18 if md.mesh.dimension() == 3: 17 19 x = md.mesh.x2d 18 20 y = md.mesh.y2d 19 z =md.mesh.z20 index =md.mesh.elements2d-121 z = md.mesh.z 22 index = md.mesh.elements2d - 1 21 23 else: 22 x =md.mesh.x23 y =md.mesh.y24 index =md.mesh.elements-125 z =np.zeros((md.mesh.numberofvertices,1))26 27 if len(mask) ==0:24 x = md.mesh.x 25 y = md.mesh.y 26 index = md.mesh.elements - 1 27 z = np.zeros((md.mesh.numberofvertices, 1)) 28 29 if len(mask) == 0: 28 30 raise OSError("mask provided is empty") 29 30 if md.mesh.dimension() ==3:31 if len(mask) !=md.mesh.numberofvertices2d:31 32 if md.mesh.dimension() == 3: 33 if len(mask) != md.mesh.numberofvertices2d: 32 34 raise OSError("mask provided should be specified at the vertices of the mesh") 33 35 else: 34 if len(mask) !=md.mesh.numberofvertices:36 if len(mask) != md.mesh.numberofvertices: 35 37 raise OSError("mask provided should be specified at the vertices of the mesh") 38 39 # Initialization of some variables 40 numberofelements = np.size(index, 0) 41 elementslist = np.c_[0:numberofelements] 42 c = [] 43 h = [] 44 45 # Get unique edges in mesh 46 # 1: list of edges 47 edges = np.vstack((np.vstack((index[:, (0, 1)], index[:, (1, 2)])), index[:, (2, 0)])) 48 # 2: find unique edges 49 [edges, J] = np.unique(np.sort(edges, 1), axis=0, return_inverse=True) 50 # 3: unique edge numbers 51 vec = J 52 # 4: unique edges numbers in each triangle (2 triangles sharing the same 53 # edge will have the same edge number) 54 edges_tria = np.hstack((np.hstack((vec[elementslist], vec[elementslist + numberofelements])), vec[elementslist + 2 * numberofelements])) 55 56 # Segments [nodes1 nodes2] 57 Seg1 = index[:, (0, 1)] 58 Seg2 = index[:, (1, 2)] 59 Seg3 = index[:, (2, 0)] 60 61 # Segment numbers [1;4;6;...] 62 Seg1_num = edges_tria[:, 0] 63 Seg2_num = edges_tria[:, 1] 64 Seg3_num = edges_tria[:, 2] 65 66 #value of data on each tips of the segments 67 Data1 = mask[Seg1] 68 Data2 = mask[Seg2] 69 Data3 = mask[Seg3] 70 71 # Get the ranges for each segment 72 Range1 = np.sort(Data1, 1) 73 Range2 = np.sort(Data2, 1) 74 Range3 = np.sort(Data3, 1) 75 76 # Find the segments that contain this value 77 pos1 = (Range1[:, 0] < level) & (Range1[:, 1] >= level) 78 pos2 = (Range2[:, 0] < level) & (Range2[:, 1] >= level) 79 pos3 = (Range3[:, 0] < level) & (Range3[:, 1] >= level) 80 81 # Get elements 82 poselem12 = (pos1) & (pos2) 83 poselem13 = (pos1) & (pos3) 84 poselem23 = (pos2) & (pos3) 85 poselem = np.where((poselem12) | (poselem13) | (poselem23)) 86 poselem = poselem[0] 87 numelems = len(poselem) 88 89 # If no element has been flagged, skip to the next level 90 if numelems == 0: 91 raise Exception('contourlevelzero warning message: no elements found with corresponding level value in mask') 92 contours = [] 93 return contours 94 95 # Go through the elements and build the coordinates for each segment (1 by element) 96 x1 = np.zeros((numelems, 1)) 97 x2 = np.zeros((numelems, 1)) 98 y1 = np.zeros((numelems, 1)) 99 y2 = np.zeros((numelems, 1)) 100 z1 = np.zeros((numelems, 1)) 101 z2 = np.zeros((numelems, 1)) 102 103 edge_l = np.zeros((numelems, 2)) 104 105 for j in range(0, numelems): 106 with np.errstate(divide='ignore', invalid='ignore'): 107 weight1 = np.divide(level - Data1[poselem[j], 0],Data1[poselem[j], 1] - Data1[poselem[j], 0]) 108 weight2 = np.divide(level - Data2[poselem[j], 0],Data2[poselem[j], 1] - Data2[poselem[j], 0]) 109 weight3 = np.divide(level - Data3[poselem[j], 0],Data3[poselem[j], 1] - Data3[poselem[j], 0]) 110 111 if poselem12[poselem[j]] == True: 112 x1[j] = x[Seg1[poselem[j], 0]] + weight1 * [x[Seg1[poselem[j], 1]] - x[Seg1[poselem[j], 0]]] 113 x2[j] = x[Seg2[poselem[j], 0]] + weight2 * [x[Seg2[poselem[j], 1]] - x[Seg2[poselem[j], 0]]] 114 y1[j] = y[Seg1[poselem[j], 0]] + weight1 * [y[Seg1[poselem[j], 1]] - y[Seg1[poselem[j], 0]]] 115 y2[j] = y[Seg2[poselem[j], 0]] + weight2 * [y[Seg2[poselem[j], 1]] - y[Seg2[poselem[j], 0]]] 116 z1[j] = z[Seg1[poselem[j], 0]] + weight1 * [z[Seg1[poselem[j], 1]] - z[Seg1[poselem[j], 0]]] 117 z2[j] = z[Seg2[poselem[j], 0]] + weight2 * [z[Seg2[poselem[j], 1]] - z[Seg2[poselem[j], 0]]] 118 119 edge_l[j, 0] = Seg1_num[poselem[j]] 120 edge_l[j, 1] = Seg2_num[poselem[j]] 121 elif poselem13[poselem[j]] == True: 122 x1[j] = x[Seg1[poselem[j], 0]] + weight1 * [x[Seg1[poselem[j], 1]] - x[Seg1[poselem[j], 0]]] 123 x2[j] = x[Seg3[poselem[j], 0]] + weight3 * [x[Seg3[poselem[j], 1]] - x[Seg3[poselem[j], 0]]] 124 y1[j] = y[Seg1[poselem[j], 0]] + weight1 * [y[Seg1[poselem[j], 1]] - y[Seg1[poselem[j], 0]]] 125 y2[j] = y[Seg3[poselem[j], 0]] + weight3 * [y[Seg3[poselem[j], 1]] - y[Seg3[poselem[j], 0]]] 126 z1[j] = z[Seg1[poselem[j], 0]] + weight1 * [z[Seg1[poselem[j], 1]] - z[Seg1[poselem[j], 0]]] 127 z2[j] = z[Seg3[poselem[j], 0]] + weight3 * [z[Seg3[poselem[j], 1]] - z[Seg3[poselem[j], 0]]] 128 129 edge_l[j, 0] = Seg1_num[poselem[j]] 130 edge_l[j, 1] = Seg3_num[poselem[j]] 131 elif poselem23[poselem[j]] == True: 132 x1[j] = x[Seg2[poselem[j], 0]] + weight2 * [x[Seg2[poselem[j], 1]] - x[Seg2[poselem[j], 0]]] 133 x2[j] = x[Seg3[poselem[j], 0]] + weight3 * [x[Seg3[poselem[j], 1]] - x[Seg3[poselem[j], 0]]] 134 y1[j] = y[Seg2[poselem[j], 0]] + weight2 * [y[Seg2[poselem[j], 1]] - y[Seg2[poselem[j], 0]]] 135 y2[j] = y[Seg3[poselem[j], 0]] + weight3 * [y[Seg3[poselem[j], 1]] - y[Seg3[poselem[j], 0]]] 136 z1[j] = z[Seg2[poselem[j], 0]] + weight2 * [z[Seg2[poselem[j], 1]] - z[Seg2[poselem[j], 0]]] 137 z2[j] = z[Seg3[poselem[j], 0]] + weight3 * [z[Seg3[poselem[j], 1]] - z[Seg3[poselem[j], 0]]] 138 139 edge_l[j, 0] = Seg2_num[poselem[j]] 140 edge_l[j, 1] = Seg3_num[poselem[j]] 141 # else: 142 # Should never get here 143 144 # Now that we have the segments, we must try to connect them... 145 146 # Loop over the subcontours 147 contours = [] 148 149 while len(edge_l) > 0: 150 # Take the right edge of the second segment and connect it to the next segments if any 151 e1 = edge_l[0, 0] 152 e2 = edge_l[0, 1] 153 xc = np.vstack((x1[0], x2[0])) 154 yc = np.vstack((y1[0], y2[0])) 155 zc = np.vstack((z1[0], z2[0])) 156 # Erase the lines corresponding to this edge 157 edge_l = np.delete(edge_l, 0, axis=0) 158 x1 = np.delete(x1, 0, axis=0) 159 x2 = np.delete(x2, 0, axis=0) 160 y1 = np.delete(y1, 0, axis=0) 161 y2 = np.delete(y2, 0, axis=0) 162 z1 = np.delete(z1, 0, axis=0) 163 z2 = np.delete(z2,0,axis=0) 164 pos1 = np.where(edge_l == e1) 36 165 37 #initialization of some variables 38 numberofelements=np.size(index,0) 39 elementslist=np.c_[0:numberofelements] 40 c=[] 41 h=[] 42 43 #get unique edges in mesh 44 #1: list of edges 45 edges=np.vstack((np.vstack((index[:,(0,1)],index[:,(1,2)])),index[:,(2,0)])) 46 47 #2: find unique edges 48 [edges,J]=np.unique(np.sort(edges,1),axis=0,return_inverse=True) 49 #3: unique edge numbers 50 vec=J 51 #4: unique edges numbers in each triangle (2 triangles sharing the same edge will have 52 # the same edge number) 53 edges_tria=np.hstack((np.hstack((vec[elementslist],vec[elementslist+numberofelements])),vec[elementslist+2*numberofelements])) 54 55 #segments [nodes1 nodes2] 56 Seg1=index[:,(0,1)] 57 Seg2=index[:,(1,2)] 58 Seg3=index[:,(2,0)] 59 60 #segment numbers [1;4;6;...] 61 Seg1_num=edges_tria[:,0] 62 Seg2_num=edges_tria[:,1] 63 Seg3_num=edges_tria[:,2] 64 65 #value of data on each tips of the segments 66 Data1=mask[Seg1] 67 Data2=mask[Seg2] 68 Data3=mask[Seg3] 69 70 #get the ranges for each segment 71 Range1=np.sort(Data1,1) 72 Range2=np.sort(Data2,1) 73 Range3=np.sort(Data3,1) 74 75 #find the segments that contain this value 76 pos1=(Range1[:,0]<level) & (Range1[:,1]>=level) 77 pos2=(Range2[:,0]<level) & (Range2[:,1]>=level) 78 pos3=(Range3[:,0]<level) & (Range3[:,1]>=level) 79 80 #get elements 81 poselem12=(pos1) & (pos2) 82 poselem13=(pos1) & (pos3) 83 poselem23=(pos2) & (pos3) 84 poselem=np.where((poselem12) | (poselem13) | (poselem23)) 85 poselem=poselem[0] 86 numelems=len(poselem) 87 88 #if no element has been flagged, skip to the next level 89 if numelems==0: 90 raise Exception('contourlevelzero warning message: no elements found with corresponding level value in mask') 91 contours=[] 92 return contours 93 94 #go through the elements and build the coordinates for each segment (1 by element) 95 x1=np.zeros((numelems,1)) 96 x2=np.zeros((numelems,1)) 97 y1=np.zeros((numelems,1)) 98 y2=np.zeros((numelems,1)) 99 z1=np.zeros((numelems,1)) 100 z2=np.zeros((numelems,1)) 101 102 edge_l=np.zeros((numelems,2)) 103 104 for j in range(0,numelems): 105 106 with np.errstate(divide='ignore', invalid='ignore'): 107 weight1=np.divide(level-Data1[poselem[j],0],Data1[poselem[j],1]-Data1[poselem[j],0]) 108 weight2=np.divide(level-Data2[poselem[j],0],Data2[poselem[j],1]-Data2[poselem[j],0]) 109 weight3=np.divide(level-Data3[poselem[j],0],Data3[poselem[j],1]-Data3[poselem[j],0]) 110 111 if poselem12[poselem[j]]==True: 112 113 x1[j]=x[Seg1[poselem[j],0]]+weight1*[x[Seg1[poselem[j],1]]-x[Seg1[poselem[j],0]]] 114 x2[j]=x[Seg2[poselem[j],0]]+weight2*[x[Seg2[poselem[j],1]]-x[Seg2[poselem[j],0]]] 115 y1[j]=y[Seg1[poselem[j],0]]+weight1*[y[Seg1[poselem[j],1]]-y[Seg1[poselem[j],0]]] 116 y2[j]=y[Seg2[poselem[j],0]]+weight2*[y[Seg2[poselem[j],1]]-y[Seg2[poselem[j],0]]] 117 z1[j]=z[Seg1[poselem[j],0]]+weight1*[z[Seg1[poselem[j],1]]-z[Seg1[poselem[j],0]]] 118 z2[j]=z[Seg2[poselem[j],0]]+weight2*[z[Seg2[poselem[j],1]]-z[Seg2[poselem[j],0]]] 119 120 edge_l[j,0]=Seg1_num[poselem[j]] 121 edge_l[j,1]=Seg2_num[poselem[j]] 122 elif poselem13[poselem[j]]==True: 123 124 x1[j]=x[Seg1[poselem[j],0]]+weight1*[x[Seg1[poselem[j],1]]-x[Seg1[poselem[j],0]]] 125 x2[j]=x[Seg3[poselem[j],0]]+weight3*[x[Seg3[poselem[j],1]]-x[Seg3[poselem[j],0]]] 126 y1[j]=y[Seg1[poselem[j],0]]+weight1*[y[Seg1[poselem[j],1]]-y[Seg1[poselem[j],0]]] 127 y2[j]=y[Seg3[poselem[j],0]]+weight3*[y[Seg3[poselem[j],1]]-y[Seg3[poselem[j],0]]] 128 z1[j]=z[Seg1[poselem[j],0]]+weight1*[z[Seg1[poselem[j],1]]-z[Seg1[poselem[j],0]]] 129 z2[j]=z[Seg3[poselem[j],0]]+weight3*[z[Seg3[poselem[j],1]]-z[Seg3[poselem[j],0]]] 130 131 edge_l[j,0]=Seg1_num[poselem[j]] 132 edge_l[j,1]=Seg3_num[poselem[j]] 133 elif poselem23[poselem[j]]==True: 134 135 x1[j]=x[Seg2[poselem[j],0]]+weight2*[x[Seg2[poselem[j],1]]-x[Seg2[poselem[j],0]]] 136 x2[j]=x[Seg3[poselem[j],0]]+weight3*[x[Seg3[poselem[j],1]]-x[Seg3[poselem[j],0]]] 137 y1[j]=y[Seg2[poselem[j],0]]+weight2*[y[Seg2[poselem[j],1]]-y[Seg2[poselem[j],0]]] 138 y2[j]=y[Seg3[poselem[j],0]]+weight3*[y[Seg3[poselem[j],1]]-y[Seg3[poselem[j],0]]] 139 z1[j]=z[Seg2[poselem[j],0]]+weight2*[z[Seg2[poselem[j],1]]-z[Seg2[poselem[j],0]]] 140 z2[j]=z[Seg3[poselem[j],0]]+weight3*[z[Seg3[poselem[j],1]]-z[Seg3[poselem[j],0]]] 141 142 edge_l[j,0]=Seg2_num[poselem[j]] 143 edge_l[j,1]=Seg3_num[poselem[j]] 144 145 #else: 146 #it shoud not go here 147 148 #now that we have the segments, we must try to connect them... 149 150 #loop over the subcontours 151 contours=[] 152 153 while len(edge_l)>0: 154 155 #take the right edge of the second segment and connect it to the next segments if any 156 e1=edge_l[0,0] 157 e2=edge_l[0,1] 158 xc=np.vstack((x1[0],x2[0])) 159 yc=np.vstack((y1[0],y2[0])) 160 zc=np.vstack((z1[0],z2[0])) 161 #erase the lines corresponding to this edge 162 edge_l=np.delete(edge_l,0,axis=0) 163 x1=np.delete(x1,0,axis=0) 164 x2=np.delete(x2,0,axis=0) 165 y1=np.delete(y1,0,axis=0) 166 y2=np.delete(y2,0,axis=0) 167 z1=np.delete(z1,0,axis=0) 168 z2=np.delete(z2,0,axis=0) 169 pos1=np.where(edge_l==e1) 170 171 while len(pos1[0])>0: 172 173 if np.all(pos1[1]==0): 174 xc=np.vstack((x2[pos1[0]],xc)) 175 yc=np.vstack((y2[pos1[0]],yc)) 176 zc=np.vstack((z2[pos1[0]],zc)) 177 #next edge: 178 e1=edge_l[pos1[0],1] 166 while len(pos1[0]) > 0: 167 if np.all(pos1[1] == 0): 168 xc = np.vstack((x2[pos1[0]], xc)) 169 yc = np.vstack((y2[pos1[0]], yc)) 170 zc = np.vstack((z2[pos1[0]], zc)) 171 # Next edge: 172 e1 = edge_l[pos1[0], 1] 179 173 else: 180 xc=np.vstack((x1[pos1[0]],xc)) 181 yc=np.vstack((y1[pos1[0]],yc)) 182 zc=np.vstack((z1[pos1[0]],zc)) 183 #next edge: 184 e1=edge_l[pos1[0],0] 185 186 #erase the lines of this 187 edge_l=np.delete(edge_l,pos1[0],axis=0) 188 x1=np.delete(x1,pos1[0],axis=0) 189 x2=np.delete(x2,pos1[0],axis=0) 190 y1=np.delete(y1,pos1[0],axis=0) 191 y2=np.delete(y2,pos1[0],axis=0) 192 z1=np.delete(z1,pos1[0],axis=0) 193 z2=np.delete(z2,pos1[0],axis=0) 194 #next connection 195 pos1=np.where(edge_l==e1) 196 197 #same thing the other way (to the right) 198 pos2=np.where(edge_l==e2) 199 200 while len(pos2[0])>0: 201 202 if np.all(pos2[1]==0): 203 xc=np.vstack((xc,x2[pos2[0]])) 204 yc=np.vstack((yc,y2[pos2[0]])) 205 zc=np.vstack((zc,z2[pos2[0]])) 206 #next edge: 207 e2=edge_l[pos2[0],1] 174 xc = np.vstack((x1[pos1[0]], xc)) 175 yc = np.vstack((y1[pos1[0]], yc)) 176 zc = np.vstack((z1[pos1[0]], zc)) 177 # Next edge: 178 e1 = edge_l[pos1[0], 0] 179 180 # Erase the lines of this 181 edge_l = np.delete(edge_l, pos1[0], axis=0) 182 x1 = np.delete(x1, pos1[0], axis=0) 183 x2 = np.delete(x2, pos1[0], axis=0) 184 y1 = np.delete(y1, pos1[0], axis=0) 185 y2 = np.delete(y2, pos1[0], axis=0) 186 z1 = np.delete(z1, pos1[0], axis=0) 187 z2 = np.delete(z2, pos1[0], axis=0) 188 # Next connection 189 pos1 = np.where(edge_l == e1) 190 191 # Same thing the other way (to the right) 192 pos2 = np.where(edge_l == e2) 193 194 while len(pos2[0]) > 0: 195 if np.all(pos2[1] == 0): 196 xc = np.vstack((xc, x2[pos2[0]])) 197 yc = np.vstack((yc, y2[pos2[0]])) 198 zc = np.vstack((zc, z2[pos2[0]])) 199 # Next edge: 200 e2 = edge_l[pos2[0], 1] 208 201 else: 209 xc =np.vstack((xc,x1[pos2[0]]))210 yc =np.vstack((yc,y1[pos2[0]]))211 zc =np.vstack((zc,z1[pos2[0]]))212 # next edge:213 e2 =edge_l[pos2[0],0]214 215 # erase the lines of this216 edge_l =np.delete(edge_l,pos2[0],axis=0)217 x1 =np.delete(x1,pos2[0],axis=0)218 x2 =np.delete(x2,pos2[0],axis=0)219 y1 =np.delete(y1,pos2[0],axis=0)220 y2 =np.delete(y2,pos2[0],axis=0)221 z1 =np.delete(z1,pos2[0],axis=0)222 z2 =np.delete(z2,pos2[0],axis=0)223 # next connection224 pos2 =np.where(edge_l==e2)225 226 # save xc,yc contour:202 xc = np.vstack((xc, x1[pos2[0]])) 203 yc = np.vstack((yc, y1[pos2[0]])) 204 zc = np.vstack((zc, z1[pos2[0]])) 205 # Next edge: 206 e2 = edge_l[pos2[0], 0] 207 208 # Erase the lines of this 209 edge_l = np.delete(edge_l, pos2[0], axis=0) 210 x1 = np.delete(x1, pos2[0], axis=0) 211 x2 = np.delete(x2, pos2[0], axis=0) 212 y1 = np.delete(y1, pos2[0], axis=0) 213 y2 = np.delete(y2, pos2[0], axis=0) 214 z1 = np.delete(z1, pos2[0], axis=0) 215 z2 = np.delete(z2, pos2[0], axis=0) 216 # Next connection 217 pos2 = np.where(edge_l == e2) 218 219 # Save xc, yc contour: 227 220 newcontour = OrderedDict() 228 221 newcontour['nods'] = np.size(xc) 229 newcontour['density'] = 1 222 newcontour['density'] = 1 230 223 newcontour['closed'] = 0 231 224 newcontour['x'] = np.ma.filled(xc.astype(float), np.nan) … … 234 227 newcontour['name'] = '' 235 228 contours.append(newcontour) 236 229 237 230 return contours -
issm/trunk-jpl/src/m/exp/exptool.m
r26786 r27950 16 16 % - markersize (default=7) 17 17 % - markeredgecolor (default='r') 18 % - nofigurecopy (default=0) do not copy current figure, this is needed on some plat eform to avoid an offset in the figure18 % - nofigurecopy (default=0) do not copy current figure, this is needed on some platform to avoid an offset in the figure 19 19 % 20 20 % Usage: … … 139 139 disableDefaultInteractivity(gca); %disables the built-in interactions for the specified axes 140 140 141 %Build backup struct re for do and redo141 %Build backup structure for do and redo 142 142 backup=cell(1,3); 143 143 backup{1,1}=A; -
issm/trunk-jpl/src/m/solve/loadresultsfromcluster.py
r26661 r27950 17 17 18 18 def loadresultsfromcluster(md, *args): #{{{ 19 """ LOADRESULTSFROMCLUSTER- load results of solution sequence from cluster19 """loadresultsfromcluster - load results of solution sequence from cluster 20 20 21 21 Usage: -
issm/trunk-jpl/src/m/solve/marshall.py
r26365 r27950 5 5 6 6 def marshall(md): 7 """ MARSHALL- outputs a compatible binary file from @model md, for certain solution type.7 """marshall - outputs a compatible binary file from @model md, for certain solution type. 8 8 9 9 The routine creates a compatible binary file from @model md … … 15 15 16 16 if md.verbose.solution: 17 print( "marshalling file {}.bin".format(md.miscellaneous.name))17 print('marshalling file \'{}\'.bin'.format(md.miscellaneous.name)) 18 18 19 19 # Open file for binary writing … … 21 21 fid = open(md.miscellaneous.name + '.bin', 'wb') 22 22 except IOError as e: 23 raise IOError("marshall error message: could not open '%s.bin' file for binary writing. Due to: ".format(md.miscellaneous.name), e)23 print('marshall error message: could not open \'{}.bin\' file for binary writing due to: {}'.format(md.miscellaneous.name, e)) 24 24 25 25 fields = md.properties() … … 32 32 # Check that current field is an object 33 33 if not hasattr(getattr(md, field), 'marshall'): 34 raise TypeError( "field '{}' is not an object.".format(field))34 raise TypeError('field \'{}\' is not an object.'.format(field)) 35 35 36 36 # Marshall current object … … 46 46 47 47 except IOError as e: 48 print('marshall error message: could not close file \'{}.bin\' due to:'.format(md.miscellaneous.name), e)48 print('marshall error message: could not close \'{}.bin\' file for binary writing due to: {}'.format(md.miscellaneous.name, e)) 49 49 50 50 # Uncomment the following to make a copy of the binary input file for -
issm/trunk-jpl/src/m/solve/solve.py
r26358 r27950 11 11 12 12 def solve(md, solutionstring, *args): 13 """ SOLVE- apply solution sequence for this model13 """solve - apply solution sequence for this model 14 14 15 15 Usage: … … 98 98 if options.getfieldvalue('checkconsistency', 'yes') == 'yes': 99 99 if md.verbose.solution: 100 print( "checking model consistency")100 print('checking model consistency') 101 101 ismodelselfconsistent(md) 102 102 … … 112 112 if options.getfieldvalue('runtimename', True): 113 113 c = datetime.now() 114 md.private.runtimename = "%s-%02i-%02i-%04i-%02i-%02i-%02i-%i"% (md.miscellaneous.name, c.month, c.day, c.year, c.hour, c.minute, c.second, os.getpid())114 md.private.runtimename = '%s-%02i-%02i-%04i-%02i-%02i-%02i-%i' % (md.miscellaneous.name, c.month, c.day, c.year, c.hour, c.minute, c.second, os.getpid()) 115 115 else: 116 116 md.private.runtimename = md.miscellaneous.name -
issm/trunk-jpl/src/m/solve/solveslm.py
r27327 r27950 10 10 11 11 def solveslm(slm, solutionstringi, *args): 12 """ SOLVESLM- apply solution sequence for this sealevel model12 """solveslm - apply solution sequence for this sealevel model 13 13 14 14 Usage: 15 slm =solveslm(slm,solutionstring,varargin)15 slm = solveslm(slm,solutionstring,varargin) 16 16 where varargin is a lit of paired arguments of string OR enums 17 17
Note:
See TracChangeset
for help on using the changeset viewer.