Skip to content

Commit 91a1a2e

Browse files
Making CESM return a non-tuple
1 parent 84b7cc6 commit 91a1a2e

1 file changed

Lines changed: 81 additions & 83 deletions

File tree

parcels/_datasets/structured/circulation_models.py

Lines changed: 81 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -363,89 +363,87 @@ def _NEMO_MOI_V():
363363

364364
def _CESM():
365365
"""CESM model dataset"""
366-
return (
367-
xr.Dataset(
368-
{
369-
"UVEL": (
370-
["time", "z_t", "nlat", "nlon"],
371-
np.random.rand(T, Z, Y, X).astype("float32"),
372-
{
373-
"long_name": "Velocity in grid-x direction",
374-
"units": "centimeter/s",
375-
"grid_loc": 3221,
376-
"cell_methods": "time:mean",
377-
},
378-
),
379-
"VVEL": (
380-
["time", "z_t", "nlat", "nlon"],
381-
np.random.rand(T, Z, Y, X).astype("float32"),
382-
{
383-
"long_name": "Velocity in grid-y direction",
384-
"units": "centimeter/s",
385-
"grid_loc": 3221,
386-
"cell_methods": "time:mean",
387-
},
388-
),
389-
"WVEL": (
390-
["time", "z_w_top", "nlat", "nlon"],
391-
np.random.rand(T, Z, Y, X).astype("float32"),
392-
{
393-
"long_name": "Vertical Velocity",
394-
"units": "centimeter/s",
395-
"grid_loc": 3112,
396-
"cell_methods": "time:mean",
397-
},
398-
),
399-
},
400-
coords={
401-
"time": (
402-
["time"],
403-
TIME,
404-
{
405-
"long_name": "time",
406-
"bounds": "time_bounds",
407-
},
408-
),
409-
"z_t": (
410-
["z_t"],
411-
np.linspace(0, 5000, Z, dtype="float32"),
412-
{
413-
"long_name": "depth from surface to midpoint of layer",
414-
"units": "centimeters",
415-
"positive": "down",
416-
"valid_min": 500.0,
417-
"valid_max": 537500.0,
418-
},
419-
),
420-
"z_w_top": (
421-
["z_w_top"],
422-
np.linspace(0, 5000, Z, dtype="float32"),
423-
{
424-
"long_name": "depth from surface to top of layer",
425-
"units": "centimeters",
426-
"positive": "down",
427-
"valid_min": 0.0,
428-
"valid_max": 525000.94,
429-
},
430-
),
431-
"ULONG": (
432-
["nlat", "nlon"],
433-
np.tile(np.linspace(-179, 179, X, endpoint=False), (Y, 1)), # note that this is not curvilinear
434-
{
435-
"long_name": "array of u-grid longitudes",
436-
"units": "degrees_east",
437-
},
438-
),
439-
"ULAT": (
440-
["nlat", "nlon"],
441-
np.tile(np.linspace(-75, 85, Y).reshape(-1, 1), (1, X)), # note that this is not curvilinear
442-
{
443-
"long_name": "array of u-grid latitudes",
444-
"units": "degrees_north",
445-
},
446-
),
447-
},
448-
),
366+
return xr.Dataset(
367+
{
368+
"UVEL": (
369+
["time", "z_t", "nlat", "nlon"],
370+
np.random.rand(T, Z, Y, X).astype("float32"),
371+
{
372+
"long_name": "Velocity in grid-x direction",
373+
"units": "centimeter/s",
374+
"grid_loc": "3221",
375+
"cell_methods": "time: mean",
376+
},
377+
),
378+
"VVEL": (
379+
["time", "z_t", "nlat", "nlon"],
380+
np.random.rand(T, Z, Y, X).astype("float32"),
381+
{
382+
"long_name": "Velocity in grid-y direction",
383+
"units": "centimeter/s",
384+
"grid_loc": "3221",
385+
"cell_methods": "time: mean",
386+
},
387+
),
388+
"WVEL": (
389+
["time", "z_w_top", "nlat", "nlon"],
390+
np.random.rand(T, Z, Y, X).astype("float32"),
391+
{
392+
"long_name": "Vertical Velocity",
393+
"units": "centimeter/s",
394+
"grid_loc": "3112",
395+
"cell_methods": "time: mean",
396+
},
397+
),
398+
},
399+
coords={
400+
"time": (
401+
["time"],
402+
np.linspace(0, 5000, T),
403+
{
404+
"long_name": "time",
405+
"bounds": "time_bound",
406+
},
407+
),
408+
"z_t": (
409+
["z_t"],
410+
np.linspace(0, 5000, Z, dtype="float32"),
411+
{
412+
"long_name": "depth from surface to midpoint of layer",
413+
"units": "centimeters",
414+
"positive": "down",
415+
"valid_min": 500.0,
416+
"valid_max": 537500.0,
417+
},
418+
),
419+
"z_w_top": (
420+
["z_w_top"],
421+
np.linspace(0, 5000, Z, dtype="float32"),
422+
{
423+
"long_name": "depth from surface to top of layer",
424+
"units": "centimeters",
425+
"positive": "down",
426+
"valid_min": 0.0,
427+
"valid_max": 525000.9375,
428+
},
429+
),
430+
"ULONG": (
431+
["nlat", "nlon"],
432+
np.tile(np.linspace(-179, 179, X, endpoint=False), (Y, 1)), # note that this is not curvilinear
433+
{
434+
"long_name": "array of u-grid longitudes",
435+
"units": "degrees_east",
436+
},
437+
),
438+
"ULAT": (
439+
["nlat", "nlon"],
440+
np.tile(np.linspace(-75, 85, Y).reshape(-1, 1), (1, X)), # note that this is not curvilinear
441+
{
442+
"long_name": "array of u-grid latitudes",
443+
"units": "degrees_north",
444+
},
445+
),
446+
},
449447
)
450448

451449

0 commit comments

Comments
 (0)