How to use get_boundary method in responses

Best Python code snippet using responses

multipatch_domain_utilities.py

Source:multipatch_domain_utilities.py Github

copy

Full Screen

...41# domain_3 = mapping_3(dom_log_3)42# domain_4 = mapping_4(dom_log_4)43#44# interfaces = [45# [domain_1.get_boundary(axis=1, ext=1), domain_2.get_boundary(axis=1, ext=-1), 1],46# [domain_2.get_boundary(axis=1, ext=1), domain_3.get_boundary(axis=1, ext=-1), 1],47# [domain_3.get_boundary(axis=1, ext=1), domain_4.get_boundary(axis=1, ext=-1), 1],48# [domain_4.get_boundary(axis=1, ext=1), domain_1.get_boundary(axis=1, ext=-1), 1]49# ]50# domain = union([domain_1, domain_2, domain_3, domain_4], name = 'domain')51# domain = set_interfaces(domain, interfaces)52#53# return domain54def get_2D_rotation_mapping(name='no_name', c1=0., c2=0., alpha=np.pi/2):55 # AffineMapping:56 # _expressions = {'x': 'c1 + a11*x1 + a12*x2 + a13*x3',57 # 'y': 'c2 + a21*x1 + a22*x2 + a23*x3',58 # 'z': 'c3 + a31*x1 + a32*x2 + a33*x3'}59 return AffineMapping(60 name, 2, c1=c1, c2=c2,61 a11=np.cos(alpha), a12=-np.sin(alpha),62 a21=np.sin(alpha), a22=np.cos(alpha),63 )64def flip_axis(name='no_name', c1=0., c2=0.):65 # AffineMapping:66 # _expressions = {'x': 'c1 + a11*x1 + a12*x2 + a13*x3',67 # 'y': 'c2 + a21*x1 + a22*x2 + a23*x3',68 # 'z': 'c3 + a31*x1 + a32*x2 + a33*x3'}69 return AffineMapping(70 name, 2, c1=c1, c2=c2,71 a11=0, a12=1,72 a21=1, a22=0,73 )74def build_multipatch_domain(domain_name='square_2', r_min=None, r_max=None):75 """76 Create a 2D multipatch domain among the many available.77 These include fairly complex pretzel-like shapes.78 Parameters79 ----------80 domain_name: <str>81 The name of the chosen domain, which can be one of the following:82 'square_2', 'square_6', 'square_8', 'square_9', 'annulus_3', 'annulus_4',83 'curved_L_shape', 'pretzel', 'pretzel_f', 'pretzel_annulus', 'pretzel_debug'84 Returns85 -------86 domain : <Sympde.topology.Domain>87 The symbolic multipatch domain88 """89 if domain_name == 'square_2':90 # reference square [0,pi]x[0,pi] with 2 patches91 # mp structure:92 # 293 # 194 OmegaLog1 = Square('OmegaLog1',bounds1=(0., np.pi), bounds2=(0., np.pi/2))95 mapping_1 = IdentityMapping('M1',2)96 domain_1 = mapping_1(OmegaLog1)97 OmegaLog2 = Square('OmegaLog2',bounds1=(0., np.pi), bounds2=(np.pi/2, np.pi))98 mapping_2 = IdentityMapping('M2',2)99 domain_2 = mapping_2(OmegaLog2)100 domain = union([domain_1,101 domain_2], name = 'domain')102 interfaces = [103 [domain_1.get_boundary(axis=1, ext=+1), domain_2.get_boundary(axis=1, ext=-1),1]104 ]105 elif domain_name == 'square_6':106 # mp structure:107 # 5 6108 # 3 4109 # 1 2110 OmegaLog1 = Square('OmegaLog1',bounds1=(0., np.pi/2), bounds2=(0., np.pi/3))111 mapping_1 = IdentityMapping('M1',2)112 domain_1 = mapping_1(OmegaLog1)113 OmegaLog2 = Square('OmegaLog2',bounds1=(np.pi/2, np.pi), bounds2=(0., np.pi/3))114 mapping_2 = IdentityMapping('M2',2)115 domain_2 = mapping_2(OmegaLog2)116 OmegaLog3 = Square('OmegaLog3',bounds1=(0., np.pi/2), bounds2=(np.pi/3, np.pi*2/3))117 mapping_3 = IdentityMapping('M3',2)118 domain_3 = mapping_3(OmegaLog3)119 OmegaLog4 = Square('OmegaLog4',bounds1=(np.pi/2, np.pi), bounds2=(np.pi/3, np.pi*2/3))120 mapping_4 = IdentityMapping('M4',2)121 domain_4 = mapping_4(OmegaLog4)122 OmegaLog5 = Square('OmegaLog5',bounds1=(0., np.pi/2), bounds2=(np.pi*2/3, np.pi))123 mapping_5 = IdentityMapping('M5',2)124 domain_5 = mapping_5(OmegaLog5)125 OmegaLog6 = Square('OmegaLog6',bounds1=(np.pi/2, np.pi), bounds2=(np.pi*2/3, np.pi))126 mapping_6 = IdentityMapping('M6',2)127 domain_6 = mapping_6(OmegaLog6)128 domain = union([domain_1, domain_2, domain_3, domain_4, domain_5, domain_6], name = 'domain')129 interfaces = [130 [domain_1.get_boundary(axis=0, ext=+1), domain_2.get_boundary(axis=0, ext=-1),1],131 [domain_3.get_boundary(axis=0, ext=+1), domain_4.get_boundary(axis=0, ext=-1),1],132 [domain_5.get_boundary(axis=0, ext=+1), domain_6.get_boundary(axis=0, ext=-1),1],133 [domain_1.get_boundary(axis=1, ext=+1), domain_3.get_boundary(axis=1, ext=-1),1],134 [domain_3.get_boundary(axis=1, ext=+1), domain_5.get_boundary(axis=1, ext=-1),1],135 [domain_2.get_boundary(axis=1, ext=+1), domain_4.get_boundary(axis=1, ext=-1),1],136 [domain_4.get_boundary(axis=1, ext=+1), domain_6.get_boundary(axis=1, ext=-1),1],137 ]138 elif domain_name in ['square_8', 'square_9']:139 # square with third-length patches, with or without a hole:140 OmegaLog1 = Square('OmegaLog1',bounds1=(0., np.pi/3), bounds2=(0., np.pi/3))141 mapping_1 = IdentityMapping('M1',2)142 domain_1 = mapping_1(OmegaLog1)143 OmegaLog2 = Square('OmegaLog2',bounds1=(np.pi/3, np.pi*2/3), bounds2=(0., np.pi/3))144 mapping_2 = IdentityMapping('M2',2)145 domain_2 = mapping_2(OmegaLog2)146 OmegaLog3 = Square('OmegaLog3',bounds1=(np.pi*2/3, np.pi), bounds2=(0., np.pi/3))147 mapping_3 = IdentityMapping('M3',2)148 domain_3 = mapping_3(OmegaLog3)149 OmegaLog4 = Square('OmegaLog4',bounds1=(0., np.pi/3), bounds2=(np.pi/3, np.pi*2/3))150 mapping_4 = IdentityMapping('M4',2)151 domain_4 = mapping_4(OmegaLog4)152 OmegaLog5 = Square('OmegaLog5',bounds1=(np.pi*2/3, np.pi), bounds2=(np.pi/3, np.pi*2/3))153 mapping_5 = IdentityMapping('M5',2)154 domain_5 = mapping_5(OmegaLog5)155 OmegaLog6 = Square('OmegaLog6',bounds1=(0., np.pi/3), bounds2=(np.pi*2/3, np.pi))156 mapping_6 = IdentityMapping('M6',2)157 domain_6 = mapping_6(OmegaLog6)158 OmegaLog7 = Square('OmegaLog7',bounds1=(np.pi/3, np.pi*2/3), bounds2=(np.pi*2/3, np.pi))159 mapping_7 = IdentityMapping('M7',2)160 domain_7 = mapping_7(OmegaLog7)161 OmegaLog8 = Square('OmegaLog8',bounds1=(np.pi*2/3, np.pi), bounds2=(np.pi*2/3, np.pi))162 mapping_8 = IdentityMapping('M8',2)163 domain_8 = mapping_8(OmegaLog8)164 # center domain165 OmegaLog9 = Square('OmegaLog9',bounds1=(np.pi/3, np.pi*2/3), bounds2=(np.pi/3, np.pi*2/3))166 mapping_9 = IdentityMapping('M9',2)167 domain_9 = mapping_9(OmegaLog9)168 if domain_name == 'square_8':169 # square domain with a hole:170 # 6 7 8171 # 4 * 5172 # 1 2 3173 domain = union([domain_1, domain_2, domain_3, domain_4, domain_5, domain_6, domain_7, domain_8], name = 'domain')174 interfaces = [175 [domain_1.get_boundary(axis=0, ext=+1), domain_2.get_boundary(axis=0, ext=-1),1],176 [domain_2.get_boundary(axis=0, ext=+1), domain_3.get_boundary(axis=0, ext=-1),1],177 [domain_6.get_boundary(axis=0, ext=+1), domain_7.get_boundary(axis=0, ext=-1),1],178 [domain_7.get_boundary(axis=0, ext=+1), domain_8.get_boundary(axis=0, ext=-1),1],179 [domain_1.get_boundary(axis=1, ext=+1), domain_4.get_boundary(axis=1, ext=-1),1],180 [domain_4.get_boundary(axis=1, ext=+1), domain_6.get_boundary(axis=1, ext=-1),1],181 [domain_3.get_boundary(axis=1, ext=+1), domain_5.get_boundary(axis=1, ext=-1),1],182 [domain_5.get_boundary(axis=1, ext=+1), domain_8.get_boundary(axis=1, ext=-1),1],183 ]184 elif domain_name == 'square_9':185 # square domain with no hole:186 # 6 7 8187 # 4 9 5188 # 1 2 3189 domain = union([domain_1, domain_2, domain_3, domain_4, domain_5, domain_6, domain_7, domain_8, domain_9], name = 'domain')190 interfaces = [191 [domain_1.get_boundary(axis=0, ext=+1), domain_2.get_boundary(axis=0, ext=-1),1],192 [domain_2.get_boundary(axis=0, ext=+1), domain_3.get_boundary(axis=0, ext=-1),1],193 [domain_4.get_boundary(axis=0, ext=+1), domain_9.get_boundary(axis=0, ext=-1),1],194 [domain_9.get_boundary(axis=0, ext=+1), domain_5.get_boundary(axis=0, ext=-1),1],195 [domain_6.get_boundary(axis=0, ext=+1), domain_7.get_boundary(axis=0, ext=-1),1],196 [domain_7.get_boundary(axis=0, ext=+1), domain_8.get_boundary(axis=0, ext=-1),1],197 [domain_1.get_boundary(axis=1, ext=+1), domain_4.get_boundary(axis=1, ext=-1),1],198 [domain_4.get_boundary(axis=1, ext=+1), domain_6.get_boundary(axis=1, ext=-1),1],199 [domain_2.get_boundary(axis=1, ext=+1), domain_9.get_boundary(axis=1, ext=-1),1],200 [domain_9.get_boundary(axis=1, ext=+1), domain_7.get_boundary(axis=1, ext=-1),1],201 [domain_3.get_boundary(axis=1, ext=+1), domain_5.get_boundary(axis=1, ext=-1),1],202 [domain_5.get_boundary(axis=1, ext=+1), domain_8.get_boundary(axis=1, ext=-1),1],203 ]204 else:205 raise ValueError(domain_name)206 elif domain_name in ['pretzel', 'pretzel_f', 'pretzel_annulus', 'pretzel_debug']:207 # pretzel-shaped domain with quarter-annuli and quadrangles -- setting parameters208 # note: 'pretzel_f' is a bit finer than 'pretzel', to have a roughly uniform resolution (patches of approx same size)209 if r_min is None:210 r_min=1 # smaller radius of quarter-annuli211 if r_max is None:212 r_max=2 # larger radius of quarter-annuli213 assert 0 < r_min214 assert r_min < r_max215 dr = r_max - r_min216 h = dr # offset from axes of quarter-annuli217 hr = dr/2218 cr = h +(r_max+r_min)/2219 dom_log_1 = Square('dom1',bounds1=(r_min, r_max), bounds2=(0, np.pi/2))220 mapping_1 = PolarMapping('M1',2, c1= h, c2= h, rmin = 0., rmax=1.)221 domain_1 = mapping_1(dom_log_1)222 dom_log_1_1 = Square('dom1_1',bounds1=(r_min, r_max), bounds2=(0, np.pi/4))223 mapping_1_1 = PolarMapping('M1_1',2, c1= h, c2= h, rmin = 0., rmax=1.)224 domain_1_1 = mapping_1_1(dom_log_1_1)225 dom_log_1_2 = Square('dom1_2',bounds1=(r_min, r_max), bounds2=(np.pi/4, np.pi/2))226 mapping_1_2 = PolarMapping('M1_2',2, c1= h, c2= h, rmin = 0., rmax=1.)227 domain_1_2 = mapping_1_2(dom_log_1_2)228 dom_log_2 = Square('dom2',bounds1=(r_min, r_max), bounds2=(np.pi/2, np.pi))229 mapping_2 = PolarMapping('M2',2, c1= -h, c2= h, rmin = 0., rmax=1.)230 domain_2 = mapping_2(dom_log_2)231 dom_log_2_1 = Square('dom2_1',bounds1=(r_min, r_max), bounds2=(np.pi/2, np.pi*3/4))232 mapping_2_1 = PolarMapping('M2_1',2, c1= -h, c2= h, rmin = 0., rmax=1.)233 domain_2_1 = mapping_2_1(dom_log_2_1)234 dom_log_2_2 = Square('dom2_2',bounds1=(r_min, r_max), bounds2=(np.pi*3/4, np.pi))235 mapping_2_2 = PolarMapping('M2_2',2, c1= -h, c2= h, rmin = 0., rmax=1.)236 domain_2_2 = mapping_2_2(dom_log_2_2)237 # for debug:238 dom_log_10 = Square('dom10',bounds1=(r_min, r_max), bounds2=(np.pi/2, np.pi))239 mapping_10 = PolarMapping('M10',2, c1= h, c2= h, rmin = 0., rmax=1.)240 domain_10 = mapping_10(dom_log_10)241 dom_log_3 = Square('dom3',bounds1=(r_min, r_max), bounds2=(np.pi, np.pi*3/2))242 mapping_3 = PolarMapping('M3',2, c1= -h, c2= 0, rmin = 0., rmax=1.)243 domain_3 = mapping_3(dom_log_3)244 dom_log_3_1 = Square('dom3_1',bounds1=(r_min, r_max), bounds2=(np.pi, np.pi*5/4))245 mapping_3_1 = PolarMapping('M3_1',2, c1= -h, c2= 0, rmin = 0., rmax=1.)246 domain_3_1 = mapping_3_1(dom_log_3_1)247 dom_log_3_2 = Square('dom3_2',bounds1=(r_min, r_max), bounds2=(np.pi*5/4, np.pi*3/2))248 mapping_3_2 = PolarMapping('M3_2',2, c1= -h, c2= 0, rmin = 0., rmax=1.)249 domain_3_2 = mapping_3_2(dom_log_3_2)250 dom_log_4 = Square('dom4',bounds1=(r_min, r_max), bounds2=(np.pi*3/2, np.pi*2))251 mapping_4 = PolarMapping('M4',2, c1= h, c2= 0, rmin = 0., rmax=1.)252 domain_4 = mapping_4(dom_log_4)253 dom_log_4_1 = Square('dom4_1',bounds1=(r_min, r_max), bounds2=(np.pi*3/2, np.pi*7/4))254 mapping_4_1 = PolarMapping('M4_1',2, c1= h, c2= 0, rmin = 0., rmax=1.)255 domain_4_1 = mapping_4_1(dom_log_4_1)256 dom_log_4_2 = Square('dom4_2',bounds1=(r_min, r_max), bounds2=(np.pi*7/4, np.pi*2))257 mapping_4_2 = PolarMapping('M4_2',2, c1= h, c2= 0, rmin = 0., rmax=1.)258 domain_4_2 = mapping_4_2(dom_log_4_2)259 dom_log_5 = Square('dom5',bounds1=(-hr,hr) , bounds2=(-h/2, h/2))260 mapping_5 = get_2D_rotation_mapping('M5', c1=h/2, c2=cr , alpha=np.pi/2)261 domain_5 = mapping_5(dom_log_5)262 dom_log_6 = Square('dom6',bounds1=(-hr,hr) , bounds2=(-h/2, h/2))263 mapping_6 = flip_axis('M6', c1=-h/2, c2=cr)264 domain_6 = mapping_6(dom_log_6)265 dom_log_7 = Square('dom7',bounds1=(-hr, hr), bounds2=(-h/2, h/2))266 mapping_7 = get_2D_rotation_mapping('M7', c1=-cr, c2=h/2 , alpha=np.pi)267 domain_7 = mapping_7(dom_log_7)268 # dom_log_8 = Square('dom8',bounds1=(-hr, hr), bounds2=(-h/2, h/2))269 # mapping_8 = get_2D_rotation_mapping('M8', c1=-cr, c2=-h/2 , alpha=np.pi)270 # domain_8 = mapping_8(dom_log_8)271 dom_log_9 = Square('dom9',bounds1=(-hr,hr) , bounds2=(-h, h))272 mapping_9 = get_2D_rotation_mapping('M9', c1=0, c2=h-cr , alpha=np.pi*3/2)273 domain_9 = mapping_9(dom_log_9)274 dom_log_9_1 = Square('dom9_1',bounds1=(-hr,hr) , bounds2=(-h, 0))275 mapping_9_1 = get_2D_rotation_mapping('M9_1', c1=0, c2=h-cr , alpha=np.pi*3/2)276 domain_9_1 = mapping_9_1(dom_log_9_1)277 dom_log_9_2 = Square('dom9_2',bounds1=(-hr,hr) , bounds2=(0, h))278 mapping_9_2 = get_2D_rotation_mapping('M9_2', c1=0, c2=h-cr , alpha=np.pi*3/2)279 domain_9_2 = mapping_9_2(dom_log_9_2)280 # dom_log_10 = Square('dom10',bounds1=(-hr,hr) , bounds2=(-h/2, h/2))281 # mapping_10 = get_2D_rotation_mapping('M10', c1=h/2, c2=h-cr , alpha=np.pi*3/2)282 # domain_10 = mapping_10(dom_log_10)283 #284 # dom_log_11 = Square('dom11',bounds1=(-hr, hr), bounds2=(-h/2, h/2))285 # mapping_11 = get_2D_rotation_mapping('M11', c1=cr, c2=-h/2 , alpha=0)286 # domain_11 = mapping_11(dom_log_11)287 dom_log_12 = Square('dom12',bounds1=(-hr, hr), bounds2=(-h/2, h/2))288# mapping_12 = get_2D_rotation_mapping('M12', c1=cr, c2=h/2 , alpha=0)289 mapping_12 = AffineMapping('M12', 2, c1=cr, c2=h/2, a11=1, a22=-1, a21=0, a12=0)290 domain_12 = mapping_12(dom_log_12)291 dom_log_13 = Square('dom13',bounds1=(np.pi*3/2, np.pi*2), bounds2=(r_min, r_max))292 mapping_13 = TransposedPolarMapping('M13',2, c1= -r_min-h, c2= r_min+h, rmin = 0., rmax=1.)293 domain_13 = mapping_13(dom_log_13)294 dom_log_13_1 = Square('dom13_1',bounds1=(np.pi*3/2, np.pi*7/4), bounds2=(r_min, r_max))295 mapping_13_1 = TransposedPolarMapping('M13_1',2, c1= -r_min-h, c2= r_min+h, rmin = 0., rmax=1.)296 domain_13_1 = mapping_13_1(dom_log_13_1)297 dom_log_13_2 = Square('dom13_2',bounds1=(np.pi*7/4, np.pi*2), bounds2=(r_min, r_max))298 mapping_13_2 = TransposedPolarMapping('M13_2',2, c1= -r_min-h, c2= r_min+h, rmin = 0., rmax=1.)299 domain_13_2 = mapping_13_2(dom_log_13_2)300 dom_log_14 = Square('dom14',bounds1=(np.pi, np.pi*3/2), bounds2=(r_min, r_max))301 mapping_14 = TransposedPolarMapping('M14',2, c1= r_min+h, c2= r_min+h, rmin = 0., rmax=1.)302 domain_14 = mapping_14(dom_log_14)303 dom_log_14_1 = Square('dom14_1',bounds1=(np.pi, np.pi*5/4), bounds2=(r_min, r_max)) # STOP ICI: check domain304 mapping_14_1 = TransposedPolarMapping('M14_1',2, c1= r_min+h, c2= r_min+h, rmin = 0., rmax=1.)305 domain_14_1 = mapping_14_1(dom_log_14_1)306 dom_log_14_2 = Square('dom14_2',bounds1=(np.pi*5/4, np.pi*3/2), bounds2=(r_min, r_max))307 mapping_14_2 = TransposedPolarMapping('M14_2',2, c1= r_min+h, c2= r_min+h, rmin = 0., rmax=1.)308 domain_14_2 = mapping_14_2(dom_log_14_2)309 # dom_log_15 = Square('dom15', bounds1=(-r_min-h, r_min+h), bounds2=(0, h))310 # mapping_15 = IdentityMapping('M15', 2)311 # domain_15 = mapping_15(dom_log_15)312 if domain_name == 'pretzel':313 domain = union([314 domain_1,315 domain_2,316 domain_3,317 domain_4,318 domain_5,319 domain_6,320 domain_7,321 domain_9,322 domain_12,323 domain_13,324 domain_14,325 ], name = 'domain')326 interfaces = [327 [domain_1.get_boundary(axis=1, ext=+1), domain_5.get_boundary(axis=1, ext=-1), 1],328 [domain_5.get_boundary(axis=1, ext=+1), domain_6.get_boundary(axis=1, ext=1), 1],329 [domain_6.get_boundary(axis=1, ext=-1), domain_2.get_boundary(axis=1, ext=-1), 1],330 [domain_2.get_boundary(axis=1, ext=+1), domain_7.get_boundary(axis=1, ext=-1), 1],331 [domain_7.get_boundary(axis=1, ext=+1), domain_3.get_boundary(axis=1, ext=-1), 1],332 [domain_3.get_boundary(axis=1, ext=+1), domain_9.get_boundary(axis=1, ext=-1), 1],333 [domain_9.get_boundary(axis=1, ext=+1), domain_4.get_boundary(axis=1, ext=-1), 1],334 [domain_4.get_boundary(axis=1, ext=+1), domain_12.get_boundary(axis=1, ext=1), 1],335 [domain_12.get_boundary(axis=1, ext=-1), domain_1.get_boundary(axis=1, ext=-1), 1],336 [domain_6.get_boundary(axis=0, ext=-1), domain_13.get_boundary(axis=0, ext=1), 1],337 [domain_7.get_boundary(axis=0, ext=-1), domain_13.get_boundary(axis=0, ext=-1), 1],338 [domain_5.get_boundary(axis=0, ext=-1), domain_14.get_boundary(axis=0, ext=-1), 1],339 [domain_12.get_boundary(axis=0, ext=-1), domain_14.get_boundary(axis=0, ext=+1),1],340 ]341 elif domain_name == 'pretzel_f':342 domain = union([343 domain_1_1,344 domain_1_2,345 domain_2_1,346 domain_2_2,347 domain_3_1,348 domain_3_2,349 domain_4_1,350 domain_4_2,351 domain_5,352 domain_6,353 domain_7,354 domain_9_1,355 domain_9_2,356 domain_12,357 domain_13_1,358 domain_13_2,359 domain_14_1,360 domain_14_2,361 ], name = 'domain')362 interfaces = [363 [domain_1_1.get_boundary(axis=1, ext=+1), domain_1_2.get_boundary(axis=1, ext=-1), 1],364 [domain_1_2.get_boundary(axis=1, ext=+1), domain_5.get_boundary(axis=1, ext=-1), 1],365 [domain_5.get_boundary(axis=1, ext=+1), domain_6.get_boundary(axis=1, ext=1), 1],366 [domain_6.get_boundary(axis=1, ext=-1), domain_2_1.get_boundary(axis=1, ext=-1), 1],367 [domain_2_1.get_boundary(axis=1, ext=+1), domain_2_2.get_boundary(axis=1, ext=-1), 1],368 [domain_2_2.get_boundary(axis=1, ext=+1), domain_7.get_boundary(axis=1, ext=-1), 1],369 [domain_7.get_boundary(axis=1, ext=+1), domain_3_1.get_boundary(axis=1, ext=-1), 1],370 [domain_3_1.get_boundary(axis=1, ext=+1), domain_3_2.get_boundary(axis=1, ext=-1), 1],371 [domain_3_2.get_boundary(axis=1, ext=+1), domain_9_1.get_boundary(axis=1, ext=-1), 1],372 [domain_9_1.get_boundary(axis=1, ext=+1), domain_9_2.get_boundary(axis=1, ext=-1), 1],373 [domain_9_2.get_boundary(axis=1, ext=+1), domain_4_1.get_boundary(axis=1, ext=-1), 1],374 [domain_4_1.get_boundary(axis=1, ext=+1), domain_4_2.get_boundary(axis=1, ext=-1), 1],375 [domain_4_2.get_boundary(axis=1, ext=+1), domain_12.get_boundary(axis=1, ext=1), 1],376 [domain_12.get_boundary(axis=1, ext=-1), domain_1_1.get_boundary(axis=1, ext=-1), 1],377 [domain_6.get_boundary(axis=0, ext=-1), domain_13_2.get_boundary(axis=0, ext=1), 1],378 [domain_13_2.get_boundary(axis=0, ext=-1), domain_13_1.get_boundary(axis=0, ext=1), 1],379 [domain_7.get_boundary(axis=0, ext=-1), domain_13_1.get_boundary(axis=0, ext=-1), 1],380 [domain_5.get_boundary(axis=0, ext=-1), domain_14_1.get_boundary(axis=0, ext=-1), 1],381 [domain_14_1.get_boundary(axis=0, ext=+1), domain_14_2.get_boundary(axis=0, ext=-1), 1],382 [domain_12.get_boundary(axis=0, ext=-1), domain_14_2.get_boundary(axis=0, ext=+1),1],383 ]384 # reste: 13 et 14385 elif domain_name == 'pretzel_annulus':386 # only the annulus part of the pretzel (not the inner arcs)387 domain = union([388 domain_1,389 domain_5,390 domain_6,391 domain_2,392 domain_7,393 domain_3,394 domain_9,395 domain_4,396 domain_12,397 ], name = 'domain')398 interfaces = [399 [domain_1.get_boundary(axis=1, ext=+1), domain_5.get_boundary(axis=1, ext=-1),1],400 [domain_5.get_boundary(axis=1, ext=+1), domain_6.get_boundary(axis=1, ext=-1),1],401 [domain_6.get_boundary(axis=1, ext=+1), domain_2.get_boundary(axis=1, ext=-1),1],402 [domain_2.get_boundary(axis=1, ext=+1), domain_7.get_boundary(axis=1, ext=-1),1],403 [domain_7.get_boundary(axis=1, ext=+1), domain_3.get_boundary(axis=1, ext=-1),1],404 [domain_3.get_boundary(axis=1, ext=+1), domain_9.get_boundary(axis=1, ext=-1),1],405 [domain_9.get_boundary(axis=1, ext=+1), domain_4.get_boundary(axis=1, ext=-1),1],406 [domain_4.get_boundary(axis=1, ext=+1), domain_12.get_boundary(axis=1, ext=-1),1],407 [domain_12.get_boundary(axis=1, ext=+1), domain_1.get_boundary(axis=1, ext=-1),1],408 ]409 elif domain_name == 'pretzel_debug':410 domain = union([411 domain_1,412 domain_10,413 ], name = 'domain')414 interfaces = [415 [domain_1.get_boundary(axis=1, ext=+1), domain_10.get_boundary(axis=1, ext=-1),1],416 ]417 else:418 raise NotImplementedError419 elif domain_name == 'curved_L_shape':420 # Curved L-shape benchmark domain of Monique Dauge, see 2DomD in https://perso.univ-rennes1.fr/monique.dauge/core/index.html421 # here with 3 patches422 dom_log_1 = Square('dom1',bounds1=(2, 3), bounds2=(0., np.pi/8))423 mapping_1 = PolarMapping('M1',2, c1= 0., c2= 0., rmin = 0., rmax=1.)424 domain_1 = mapping_1(dom_log_1)425 dom_log_2 = Square('dom2',bounds1=(2, 3), bounds2=(np.pi/8, np.pi/4))426 mapping_2 = PolarMapping('M2',2, c1= 0., c2= 0., rmin = 0., rmax=1.)427 domain_2 = mapping_2(dom_log_2)428 dom_log_3 = Square('dom3',bounds1=(1, 2), bounds2=(np.pi/8, np.pi/4))429 mapping_3 = PolarMapping('M3',2, c1= 0., c2= 0., rmin = 0., rmax=1.)430 domain_3 = mapping_3(dom_log_3)431 domain = union([432 domain_1,433 domain_2,434 domain_3,435 ], name = 'domain')436 interfaces = [437 [domain_1.get_boundary(axis=1, ext=+1), domain_2.get_boundary(axis=1, ext=-1),1],438 [domain_3.get_boundary(axis=0, ext=+1), domain_2.get_boundary(axis=0, ext=-1),1],439 ]440 elif domain_name in ['annulus_3', 'annulus_4']:441 # regular annulus442 if r_min is None:443 r_min=0.5 # smaller radius444 if r_max is None:445 r_max=1. # larger radius446 if domain_name == 'annulus_3':447 OmegaLog1 = Square('OmegaLog1',bounds1=(r_min, r_max), bounds2=(0., np.pi/2))448 mapping_1 = PolarMapping('M1',2, c1= 0., c2= 0., rmin = 0., rmax=1.)449 domain_1 = mapping_1(OmegaLog1)450 OmegaLog2 = Square('OmegaLog2',bounds1=(r_min, r_max), bounds2=(np.pi/2, np.pi))451 mapping_2 = PolarMapping('M2',2, c1= 0., c2= 0., rmin = 0., rmax=1.)452 domain_2 = mapping_2(OmegaLog2)453 OmegaLog3 = Square('OmegaLog3',bounds1=(r_min, r_max), bounds2=(np.pi, 2*np.pi))454 mapping_3 = PolarMapping('M3',2, c1= 0., c2= 0., rmin = 0., rmax=1.)455 domain_3 = mapping_3(OmegaLog3)456 domain = union([domain_1, domain_2, domain_3], name = 'domain')457 interfaces = [458 [domain_1.get_boundary(axis=1, ext=+1), domain_2.get_boundary(axis=1, ext=-1),1],459 [domain_2.get_boundary(axis=1, ext=+1), domain_3.get_boundary(axis=1, ext=-1),1],460 [domain_3.get_boundary(axis=1, ext=+1), domain_1.get_boundary(axis=1, ext=-1),1],461 ]462 elif domain_name == 'annulus_4':463 OmegaLog1 = Square('OmegaLog1',bounds1=(r_min, r_max), bounds2=(0., np.pi/2))464 mapping_1 = PolarMapping('M1',2, c1= 0., c2= 0., rmin = 0., rmax=1.)465 domain_1 = mapping_1(OmegaLog1)466 OmegaLog2 = Square('OmegaLog2',bounds1=(r_min, r_max), bounds2=(np.pi/2, np.pi))467 mapping_2 = PolarMapping('M2',2, c1= 0., c2= 0., rmin = 0., rmax=1.)468 domain_2 = mapping_2(OmegaLog2)469 OmegaLog3 = Square('OmegaLog3',bounds1=(r_min, r_max), bounds2=(np.pi, np.pi*3/2))470 mapping_3 = PolarMapping('M3',2, c1= 0., c2= 0., rmin = 0., rmax=1.)471 domain_3 = mapping_3(OmegaLog3)472 OmegaLog4 = Square('OmegaLog4',bounds1=(r_min, r_max), bounds2=(np.pi*3/2, np.pi*2))473 mapping_4 = PolarMapping('M4',2, c1= 0., c2= 0., rmin = 0., rmax=1.)474 domain_4 = mapping_4(OmegaLog4)475 domain = union([domain_1, domain_2, domain_3, domain_4], name = 'domain')476 interfaces = [477 [domain_1.get_boundary(axis=1, ext=+1), domain_2.get_boundary(axis=1, ext=-1),1],478 [domain_2.get_boundary(axis=1, ext=+1), domain_3.get_boundary(axis=1, ext=-1),1],479 [domain_3.get_boundary(axis=1, ext=+1), domain_4.get_boundary(axis=1, ext=-1),1],480 [domain_4.get_boundary(axis=1, ext=+1), domain_1.get_boundary(axis=1, ext=-1),1],481 ]482 else:483 raise NotImplementedError484 else:485 raise NotImplementedError486 domain = set_interfaces(domain, interfaces)487 # print("int: ", domain.interior)488 # print("bound: ", domain.boundary)489 # print("len(bound): ", len(domain.boundary))490 # print("interfaces: ", domain.interfaces)491 return domain492def get_ref_eigenvalues(domain_name, operator):493 # return ref_eigenvalues for the given operator and domain494 # and 'sigma' value, around which discrete eigenvalues will be searched by eigenvalue solver such as eigsh...

Full Screen

Full Screen

script_3.py

Source:script_3.py Github

copy

Full Screen

1#!/usr/bin/env python2'''3This script plots GHI_S2S, IMERG, CHIRPS, and USAF precipitation anomalies on their native grids for a given month.41) GHI_S2S precip anomalies are read from s2smetric outputs {yyyy}{mm}/ metrics_cf/AFRICOM/NOAHMP/{model}_Precip_ANOM_init_monthly_{mm}_{yyyy}.nc files52) CHIRPS:6 7Variable Name, Dimensions and units:8 precip(time, latitude, longitude), "mm/day"93) IMERG:104) USAF raw 11Variable Names, Dimensions and units:12Clim file: APCP(time, lat, lon), lon, lat, "kg m-2" -> mm/3hrs13monthly file: var61 (time, lat, lon), lat, lon14'''15import numpy as np16import xarray as xr17import netCDF4 as nc418import os19import glob20import sys21from datetime import date, datetime22from dateutil.relativedelta import relativedelta23import matplotlib.pyplot as plt24import matplotlib as mpl25import matplotlib.gridspec as gridspec26import matplotlib.colors as colors27import cartopy28import cartopy.crs as ccrs29import cartopy.feature as cfeature30import cartopy.io.shapereader as shpreader31obs_precip_path = '/discover/nobackup/projects/usaf_lis/smahanam/observed_precip/'32s2smetric_temp = '/discover/nobackup/projects/usaf_lis/smahanam/s2smetric/{:04d}{:02d}/metrics_cf/AFRICOM/NOAHMP/{}_Precip_ANOM_init_monthly_{:02d}_{:04d}.nc'33figure_template = '{}/OBS_precip_anom_{}.png'34clim_file = {35 'IMERG': '3B-MO.MS.MRG.3IMERG.YYYYMM01-S000000-E235959.01.V06B_monthly_clim_2008-2020.nc4',36 'CHIRPS': 'chirps-v2.0.days_p05_monthly_clim_2008-2020.nc4',37 'USAF': 'PS.AFWA_SC.U_DI.C_DC.ANLYS_GP.LIS_GR.C0P09DEG_AR.GLOBAL_PA_monthly_clim_2008-2020.nc'38}39metforc_dir = {40 'IMERG': '/discover/nobackup/projects/lis/MET_FORCING/IMERG/Late_V06B/',41 'CHIRPS': '/discover/nobackup/projects/lis/MET_FORCING/CHIRPSv2/daily_p05/prelim/',42 'USAF': obs_precip_path + 'USAF_monthly/'43}44figwidth = 2545nrows = 246ncols = 547add_land = True48add_rivers = True49resol = '50m' # use data at this scale50bodr = cartopy.feature.NaturalEarthFeature(category='cultural',51 name='admin_0_boundary_lines_land',52 scale=resol, facecolor='none', alpha=0.7)53coastlines = cartopy.feature.NaturalEarthFeature('physical', 'coastline',54 scale=resol, edgecolor='black', facecolor='none')55land = cartopy.feature.NaturalEarthFeature('physical', 'land', scale=resol, edgecolor='k',56 facecolor=cfeature.COLORS['land'])57ocean = cartopy.feature.NaturalEarthFeature('physical', 'ocean', scale=resol, edgecolor='none',58 facecolor=cfeature.COLORS['water'])59lakes = cartopy.feature.NaturalEarthFeature('physical', 'lakes', scale=resol, edgecolor='b',60 facecolor=cfeature.COLORS['water'])61rivers = cartopy.feature.NaturalEarthFeature('physical', 'rivers_lake_centerlines',62 scale=resol, edgecolor='b', facecolor='none')63units = 'mm/d'64levels = [-10, -6, -4, -2, -1, -0.25, 0.25, 1., 2., 4., 6., 10.]65cmap, col_under, col_higher, extend = plt.cm.RdYlGn, 'black', '#B404AE', 'both'66cmap.set_under(col_under)67cmap.set_over(col_higher)68mpl.style.use('bmh')69cbar_axes = [0.2, 0.04, 0.6, 0.03]70 71class Climatology (object):72 def chirps_clim ():73 chirp_template = '/discover/nobackup/projects/lis/MET_FORCING/CHIRPSv2/daily_p05/chirps-v2.0.{:04d}.days_p05.nc'74 prcp_a = []75 for year in range (2008,2021):76 # read annual files77 print (chirp_template.format(year))78 chirp = xr.open_dataset(chirp_template.format(year))79 # construct the list of annual datasets80 prcp_a.append (chirp.precip.groupby('time.month').mean(dim='time'))81 prcp_all = xr.concat(prcp_a, dim='month')82 clim = prcp_all.groupby('month').mean(dim='month')83 clim.to_netcdf(obs_precip_path + clim_file("CHIRPS"), format="NETCDF4", engine="netcdf4")84 return85 def imerg_clim ():86 imerg_template = '/discover/nobackup/projects/lis/MET_FORCING/IMERG/Monthly_V06B/{:04d}/'87 prcp_a = []88 for year in range (2008,2021):89 this_year = []90 files = sorted(os.listdir (imerg_template.format(year)))91 for file in files:92 # read monthly files93 print (file)94 ncf = nc4.Dataset(imerg_template.format(year)+ file, format='NETCDF4', diskless=True, persist=False)95 nch = ncf.groups.get('Grid')96 imerg = xr.open_dataset(xr.backends.NetCDF4DataStore(nch))97 # construct the list for the year in question98 this_year.append(imerg.precipitation)99 # construct the list of annual datasets100 prcp_a.append (xr.concat(this_year, dim='time'))101 102 prcp_all = xr.concat(prcp_a, dim='time')103 clim = prcp_all.groupby('time.month').mean(dim='time')104 clim.to_netcdf(obs_precip_path + clim_file("IMERG"), format="NETCDF4", engine="netcdf4")105 return106class PlotMaps (object):107 def crop (limits,lon, lat, xrin):108 xr_lon = (lon >= limits[0]) & (lon <= limits[1])109 xr_lat = (lat >= limits[2]) & (lat <= limits[3])110 crop_xcm = xrin.where(xr_lon & xr_lat, drop=True)111 return crop_xcm112 113 def subplot (gs_,count_plot,ctitle,limits,plotdir,region,anom,longitude,latitude,figure):114 add_land,add_rivers,resol115 ax_ = fig.add_subplot(gs_[count_plot], projection=ccrs.PlateCarree()) 116 ax_.set_extent(limits, ccrs.PlateCarree())117 cs_ = plt.contourf(longitude, latitude, anom,levels, cmap=cmap,118 extend=extend, transform=ccrs.PlateCarree())119 gl_ = ax_.gridlines(draw_labels=True)120 gl_.xlabels_top = False121 gl_.xlabels_bottom = False122 gl_.ylabels_right = False123 gl_.ylabels_left = False124 plt.title(ctitle, fontsize=25)125 if count_plot + 1> ncols:126 gl_.xlabels_bottom = True127 if count_plot % ncols == 0:128 gl_.ylabels_left = True129 ax_.coastlines()130 ax_.add_feature(cfeature.BORDERS)131 ax_.add_feature(cfeature.OCEAN, zorder=100, edgecolor='k')132 cax = fig.add_axes(cbar_axes)133 cbar = fig.colorbar(cs_, cax=cax, orientation='horizontal', ticks=levels)134 cbar.set_label('Anomaly (mm/d)', fontsize=30)135 cbar.ax.tick_params(labelsize=20)136 print(ctitle)137 print(figure)138 plt.savefig(figure, dpi=150, format='png', bbox_inches='tight')139 140if __name__ == '__main__':141 ''' 142 NOTE:143 To compute CHIRPS and IMERG climatology on their native grids, run below 2 functions:144 Climatology.chirps_clim()145 Climatology.imerg_clim()146 '''147 148 proc_month = date(int(sys.argv[1]), int(sys.argv[2]), 1) - relativedelta(months=1)149 yyyy = str(proc_month.year)150 mm = str(proc_month.month).zfill(2)151 year = proc_month.year152 month = proc_month.month153 plotdir_template = sys.argv[3] + '/NOAHMP_PLOTS/{:04d}{:02d}'154 plotdir = plotdir_template.format(int(sys.argv[1]), int(sys.argv[2]))155 156 get_boundary = {157 'EA': (22, 55, -12, 23),158 'WA': (-19, 26, -5, 25),159 'SA': (8, 52, -37, 6),160 'SA1':(24, 33, -31, -24),161 'FAME':(-20, 55, -40, 40)162 }163 164 # compute yyyymm monthly precip anomaly165 # -------------------------------------166 # generate USAF monthly precip file167 # ----------------------------------168 command = './preproc_usaf_precip.csh ' + yyyy + ' ' + mm169 #res = os.system(command)170 #assert res == 0,"USAF precipitation not ready."171 usaf_monthly = nc4.Dataset(metforc_dir.get('USAF') + yyyy + mm + '.nc')172 # (2) CHIRPS173 chirp = xr.open_dataset(metforc_dir.get('CHIRPS') + 'chirps-v2.0.' + yyyy + '.days_p05.nc')174 175 # Plotting anomalies176 # ------------------177 region = 'FAME'178 figure = figure_template.format(plotdir, yyyy+mm) 179 count_plot = 0180 181 fig = plt.figure(figsize=(figwidth,182 figwidth*(nrows*(get_boundary.get(region)[3]183 - get_boundary.get(region)[2]))184 /(ncols*(get_boundary.get(region)[1]185 - get_boundary.get(region)[0]))))186 gs_ = gridspec.GridSpec(nrows, ncols, wspace=0.1, hspace=0.1)187 # (1) CHIRPS188 # ----------189 cfile = obs_precip_path + clim_file.get('CHIRPS')190 xc = xr.open_dataset(cfile)191 xcm = xc.isel(month=[month-1])192 crop_xcm = PlotMaps.crop (get_boundary.get(region),xcm.longitude, xcm.latitude, xcm)193 194 mfile = metforc_dir.get('CHIRPS') + 'chirps-v2.0.' + yyyy + '.days_p05.nc' 195 xm = xr.open_dataset(mfile)196 xmy = xm.precip.groupby('time.month').mean(dim='time')197 xmm = xmy.isel(month=[month-1])198 crop_xmm = PlotMaps.crop (get_boundary.get(region),xmm.longitude, xmm.latitude, xmm)199 anom = crop_xmm.values - crop_xcm.precip.values200 PlotMaps.subplot(gs_,count_plot,'CHIRPS: '+ yyyy + mm, get_boundary.get(region),plotdir, region, anom[0,], crop_xcm.longitude, crop_xcm.latitude,figure) 201 count_plot += 1202 203 # (2) USAF raw204 cfile = obs_precip_path + clim_file.get('USAF')205 xc = xr.open_dataset(cfile)206 xcm = xc.isel(time=[month-1])207 crop_xcm = PlotMaps.crop (get_boundary.get(region),xcm.lon, xcm.lat, xcm)208 mfile = metforc_dir.get('USAF') + yyyy + mm + '.nc'209 xmm = xr.open_dataset(mfile)210 crop_xmm = PlotMaps.crop (get_boundary.get(region),xmm.lon, xmm.lat, xmm)211 anom = 8.*(crop_xmm.var61.values - crop_xcm.APCP.values) # coverted from mm/3hr to mm/day212 PlotMaps.subplot(gs_,count_plot,'USAF: '+ yyyy + mm, get_boundary.get(region),plotdir, region, anom[0,], crop_xcm.lon, crop_xcm.lat,figure) 213 count_plot += 1214 215 # (3) IMERG216 cfile = obs_precip_path + clim_file.get('IMERG')217 xc = xr.open_dataset(cfile)218 xcm = xc.isel(month=[month-1])219 crop_xcm = PlotMaps.crop (get_boundary.get(region),xcm.lon, xcm.lat, xcm)220 mdir = metforc_dir.get('IMERG') + yyyy + mm + '/' 221 mfiles = sorted(os.listdir (mdir))222 this_month = []223 this_day = []224 file_count = 0225 # generate monthly mean IMERG file226 for file in mfiles:227 # read 30min files228 ncf = nc4.Dataset(mdir + file, format='NETCDF4', diskless=True, persist=False)229 nch = ncf.groups.get('Grid')230 imerg = xr.open_dataset(xr.backends.NetCDF4DataStore(nch)) 231 this_day.append(imerg.precipitationCal)232 file_count += 1233 if file_count == 48:234 file_count = 0235 xr_tmp = xr.concat(this_day, dim='time')236 this_month.append(xr_tmp.groupby('time.day').mean(dim='time'))237 this_day = 0238 this_day = []239 prcp_m = xr.concat(this_month, dim='day')240 xtmf = np.mean(prcp_m, axis =0)241 xtmf.to_netcdf(obs_precip_path + 'IMERG_monthly/' + yyyy+ mm+ '.nc4', format="NETCDF4", engine="netcdf4")242 prcp_m =0243 xtmf = 0244 245 xmm = xr.open_dataset(obs_precip_path + 'IMERG_monthly/' + yyyy+ mm+ '.nc4')246 crop_xmm = PlotMaps.crop (get_boundary.get(region),xmm.lon, xmm.lat, xmm)247 anom = 24.*(crop_xmm.precipitationCal.values - crop_xcm.precipitation.values) # coverted from mm/hr to mm/day248 PlotMaps.subplot(gs_,count_plot,'IMERG: '+ yyyy + mm, get_boundary.get(region),plotdir, region, np.transpose(anom[0,]), crop_xcm.lon, crop_xcm.lat,figure) 249 count_plot += 1250 # (4) GHI S2S251 infile = s2smetric_temp.format(year,month, '*', month, year)252 anom = xr.open_mfdataset(infile, concat_dim='ens')253 median_anom = np.median(anom.anom.values, axis=0)254 PlotMaps.subplot(gs_,count_plot,'GHI S2S: '+ yyyy + mm, get_boundary.get(region),plotdir, region, median_anom[0, ], anom.longitude, anom.latitude,figure) 255 count_plot += 1256 257 # (5) CCM4258 infile = s2smetric_temp.format(year,month, 'CCM4', month, year)259 anom = xr.open_dataset(infile)260 ens_mean = np.mean(anom.anom.values, axis=0)261 PlotMaps.subplot(gs_,count_plot,'CCM4: '+ yyyy + mm, get_boundary.get(region),plotdir, region, ens_mean[0, ], anom.longitude, anom.latitude,figure) 262 count_plot += 1263 264 # (6) CCSM4265 infile = s2smetric_temp.format(year,month, 'CCSM4', month, year)266 anom = xr.open_dataset(infile)267 ens_mean = np.mean(anom.anom.values, axis=0)268 PlotMaps.subplot(gs_,count_plot,'CCSM4: '+ yyyy + mm, get_boundary.get(region),plotdir, region, ens_mean[0, ], anom.longitude, anom.latitude,figure) 269 count_plot += 1270 271 # (7) CFSv2272 infile = s2smetric_temp.format(year,month, 'CFSv2', month, year)273 anom = xr.open_dataset(infile)274 ens_mean = np.mean(anom.anom.values, axis=0)275 PlotMaps.subplot(gs_,count_plot,'CFSv2: '+ yyyy + mm, get_boundary.get(region),plotdir, region, ens_mean[0, ], anom.longitude, anom.latitude,figure) 276 count_plot += 1277 278 # (8) GEOSv2279 infile = s2smetric_temp.format(year,month, 'GEOSv2', month, year)280 anom = xr.open_dataset(infile)281 ens_mean = np.mean(anom.anom.values, axis=0)282 PlotMaps.subplot(gs_,count_plot,'GEOSv2: '+ yyyy + mm, get_boundary.get(region),plotdir, region, ens_mean[0, ], anom.longitude, anom.latitude,figure) 283 count_plot += 1284 285 # (9) GFDL286 infile = s2smetric_temp.format(year,month, 'GFDL', month, year)287 anom = xr.open_dataset(infile)288 ens_mean = np.mean(anom.anom.values, axis=0)289 PlotMaps.subplot(gs_,count_plot,'GFDL: '+ yyyy + mm, get_boundary.get(region),plotdir, region, ens_mean[0, ], anom.longitude, anom.latitude,figure) 290 count_plot += 1291 292 #(10) GNEMO5293 infile = s2smetric_temp.format(year,month, 'GNEMO5', month, year)294 anom = xr.open_dataset(infile)295 ens_mean = np.mean(anom.anom.values, axis=0)296 PlotMaps.subplot(gs_,count_plot,'GNEMO5: '+ yyyy + mm, get_boundary.get(region),plotdir, region, ens_mean[0, ], anom.longitude, anom.latitude,figure) 297 count_plot += 1...

Full Screen

Full Screen

build_domain.py

Source:build_domain.py Github

copy

Full Screen

...150 domain_13,151 domain_14,152 ], name = domain_name)153 interfaces = [154 [domain_1.get_boundary(axis=1, ext=+1), domain_5.get_boundary(axis=1, ext=-1), 1],155 [domain_5.get_boundary(axis=1, ext=+1), domain_6.get_boundary(axis=1, ext=1), 1],156 [domain_6.get_boundary(axis=1, ext=-1), domain_2.get_boundary(axis=1, ext=-1), 1],157 [domain_2.get_boundary(axis=1, ext=+1), domain_7.get_boundary(axis=1, ext=-1), 1],158 [domain_7.get_boundary(axis=1, ext=+1), domain_3.get_boundary(axis=1, ext=-1), 1],159 [domain_3.get_boundary(axis=1, ext=+1), domain_9.get_boundary(axis=1, ext=-1), 1],160 [domain_9.get_boundary(axis=1, ext=+1), domain_4.get_boundary(axis=1, ext=-1), 1],161 [domain_4.get_boundary(axis=1, ext=+1), domain_12.get_boundary(axis=1, ext=1), 1],162 [domain_12.get_boundary(axis=1, ext=-1), domain_1.get_boundary(axis=1, ext=-1), 1],163 [domain_6.get_boundary(axis=0, ext=-1), domain_13.get_boundary(axis=0, ext=1), 1],164 [domain_7.get_boundary(axis=0, ext=-1), domain_13.get_boundary(axis=0, ext=-1), 1],165 [domain_5.get_boundary(axis=0, ext=-1), domain_14.get_boundary(axis=0, ext=-1), 1],166 [domain_12.get_boundary(axis=0, ext=-1), domain_14.get_boundary(axis=0, ext=+1),1],167 ]168 domain = set_interfaces(domain, interfaces)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run responses automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful