Changeset 25679
- Timestamp:
- 10/12/20 08:20:25 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/sealevelmodel.py
r25632 r25679 147 147 #}}} 148 148 149 def ncaps(self): #{{{ 150 return len(self.icecaps) 151 #}}} 152 149 153 def continents(self): # {{{ 150 154 list = [] … … 166 170 raise RuntimeError('addbasin method only takes a \'basin\' class object as input') 167 171 self.basins.append(bas) 172 #}}} 173 174 def intersections2d(self, *args): #{{{ 175 options = pairoptions(*args) 176 force = options.getfieldvalue('force', 0) 177 178 # Initialize, to avoid issues of having more transitions than meshes 179 self.transitions = [] 180 self.eltransitions = [] 181 182 # For elements 183 xe = np.mean(self.earth.mesh.x[self.earth.mesh.elements - 1], axis=1) 184 ye = np.mean(self.earth.mesh.y[self.earth.mesh.elements - 1], axis=1) 185 186 for i in range(len(self.icecaps)): 187 mdi = self.icecaps[i] 188 189 # For elements 190 xei = np.mean(mdi.mesh.x[mdi.mesh.elements - 1], axis=1) 191 yei = np.mean(mdi.mesh.y[mdi.mesh.elements - 1], axis=1) 192 193 print('Computing vertex intersections for basin {}'.format(self.basins[i].name)) 194 195 self.transitions.append(meshintersect2d(self.earth.mesh.x, self.earth.mesh.y, mdi.mesh.x, mdi.mesh.y, 'force', force)) 196 self.eltransitions.append(meshintersect2d(xe, ye, xei, yei, 'force', force)) 168 197 #}}} 169 198 … … 315 344 if loneedgesdetect: 316 345 edges = loneedges(md) 346 # TODO: Reconfigure the following in the process of bringing plotting online 317 347 plotmodel(md, 'data', md.mask.land_levelset) 318 348 for i in range(len(edges)): 319 349 ind1 = edges(i, 1) 320 350 ind2 = edges(i, 2) 321 # TODO: Reconfigure the following in the process of bringing plotting online322 351 plot3([md.mesh.x[ind1], md.mesh.x[ind2]], [md.mesh.y[ind1], md.mesh.y[ind2]], [md.mesh.z[ind1], md.mesh.z[ind2]], 'g*-') 323 352 … … 327 356 # Create mesh radius 328 357 self.earth.mesh.r = planetradius('earth') * np.ones((md.mesh.numberofvertices, )) 358 #}}} 359 360 def caticecaps2d(self, *args): #{{{ 361 # Recover options 362 options = pairoptions(*args) 363 tolerance = options.getfieldvalue('tolerance', 1e-5) 364 loneedgesdetect = options.getfieldvalue('loneedgesdetect', 0) 365 models = self.icecaps 366 367 # Plug all models together 368 md = models[0] 369 for i in range(1, len(models)): 370 md = modelmerge2d(md, models[i], 'tolerance', tolerance) 371 372 # Look for lone edges if asked for it 373 if loneedgesdetect: 374 edges = loneedges(md) 375 # TODO: Reconfigure the following in the process of bringing plotting online 376 plotmodel(md, 'data', md.mask.land_levelset) 377 for i in range(len(edges)): 378 ind1 = edges(i, 1) 379 ind2 = edges(i, 2) 380 plot([md.mesh.x[ind1], md.mesh.x[ind2]], [md.mesh.y[ind1], md.mesh.y[ind2]], 'g*-') 381 382 # Plug into earth 383 self.earth = md 329 384 #}}} 330 385
Note:
See TracChangeset
for help on using the changeset viewer.