@@ -404,6 +404,7 @@ def _icon_square_delaunay_uniform_z_coordinate():
404404
405405 return ux .UxDataset ({"U" : u , "V" : v , "W" : w , "p" : p }, uxgrid = uxgrid )
406406
407+
407408def _ux_constant_flow_face_centered_2D ():
408409 NX = 10
409410 NT = 2
@@ -412,39 +413,51 @@ def _ux_constant_flow_face_centered_2D():
412413 np .linspace (0 , 20 , NX , dtype = np .float64 ),
413414 )
414415 lon_flat , lat_flat = lon .ravel (), lat .ravel ()
415- mask = (
416- np .isclose (lon_flat , 0 ) | np .isclose (lon_flat , 20 )
417- | np .isclose (lat_flat , 0 ) | np .isclose (lat_flat , 20 )
418- )
416+ mask = np .isclose (lon_flat , 0 ) | np .isclose (lon_flat , 20 ) | np .isclose (lat_flat , 0 ) | np .isclose (lat_flat , 20 )
419417 uxgrid = ux .Grid .from_points (
420418 (lon_flat , lat_flat ),
421419 method = "regional_delaunay" ,
422420 boundary_points = np .flatnonzero (mask ),
423421 )
424422 uxgrid .attrs ["Conventions" ] = "UGRID-1.0"
425-
423+
426424 # --- Uniform velocity field on face centers ---
427425 U0 = 0.001 # degrees/s
428426 V0 = 0.0
429427 TIME = xr .date_range ("2000-01-01" , periods = NT , freq = "1h" )
430428 zf = np .array ([0.0 , 1.0 ])
431429 zc = np .array ([0.5 ])
432-
430+
433431 U = np .full ((NT , 1 , uxgrid .n_face ), U0 )
434432 V = np .full ((NT , 1 , uxgrid .n_face ), V0 )
435433 W = np .zeros ((NT , 2 , uxgrid .n_node ))
436-
437- ds = ux .UxDataset ({
438- "U" : ux .UxDataArray (U , uxgrid = uxgrid , dims = ["time" , "zc" , "n_face" ],
439- coords = dict (time = (["time" ], TIME ), zc = (["zc" ], zc )),
440- attrs = dict (location = "face" , mesh = "delaunay" , Conventions = "UGRID-1.0" )),
441- "V" : ux .UxDataArray (V , uxgrid = uxgrid , dims = ["time" , "zc" , "n_face" ],
442- coords = dict (time = (["time" ], TIME ), zc = (["zc" ], zc )),
443- attrs = dict (location = "face" , mesh = "delaunay" , Conventions = "UGRID-1.0" )),
444- "W" : ux .UxDataArray (W , uxgrid = uxgrid , dims = ["time" , "zf" , "n_node" ],
445- coords = dict (time = (["time" ], TIME ), nz = (["zf" ], zf )),
446- attrs = dict (location = "node" , mesh = "delaunay" , Conventions = "UGRID-1.0" )),
447- }, uxgrid = uxgrid )
434+
435+ ds = ux .UxDataset (
436+ {
437+ "U" : ux .UxDataArray (
438+ U ,
439+ uxgrid = uxgrid ,
440+ dims = ["time" , "zc" , "n_face" ],
441+ coords = dict (time = (["time" ], TIME ), zc = (["zc" ], zc )),
442+ attrs = dict (location = "face" , mesh = "delaunay" , Conventions = "UGRID-1.0" ),
443+ ),
444+ "V" : ux .UxDataArray (
445+ V ,
446+ uxgrid = uxgrid ,
447+ dims = ["time" , "zc" , "n_face" ],
448+ coords = dict (time = (["time" ], TIME ), zc = (["zc" ], zc )),
449+ attrs = dict (location = "face" , mesh = "delaunay" , Conventions = "UGRID-1.0" ),
450+ ),
451+ "W" : ux .UxDataArray (
452+ W ,
453+ uxgrid = uxgrid ,
454+ dims = ["time" , "zf" , "n_node" ],
455+ coords = dict (time = (["time" ], TIME ), nz = (["zf" ], zf )),
456+ attrs = dict (location = "node" , mesh = "delaunay" , Conventions = "UGRID-1.0" ),
457+ ),
458+ },
459+ uxgrid = uxgrid ,
460+ )
448461 return ds
449462
450463
0 commit comments