Skip to content

Commit d604d46

Browse files
committed
Fix xarray dim issues and invalid rand dtype param
1 parent aeff736 commit d604d46

1 file changed

Lines changed: 27 additions & 27 deletions

File tree

parcels/_datasets/structured/circulation_models.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def _NEMO_MOI_U():
200200
},
201201
coords={
202202
"nav_lon": (
203-
["y, x"],
203+
["y", "x"],
204204
np.tile(np.linspace(-179, 179, X, endpoint=False), (Y, 1)), # note that this is not curvilinear
205205
{
206206
"units": "degrees_east",
@@ -212,7 +212,7 @@ def _NEMO_MOI_U():
212212
},
213213
),
214214
"nav_lat": (
215-
["y, x"],
215+
["y", "x"],
216216
np.tile(np.linspace(-75, 85, Y).reshape(-1, 1), (1, X)), # note that this is not curvilinear
217217
{
218218
"units": "degrees_north",
@@ -242,7 +242,7 @@ def _NEMO_MOI_U():
242242
},
243243
),
244244
"time_counter": (
245-
[],
245+
["time_counter"],
246246
np.empty(0, dtype="datetime64[ns]"),
247247
{
248248
"standard_name": "time",
@@ -292,7 +292,7 @@ def _NEMO_MOI_V():
292292
},
293293
coords={
294294
"nav_lon": (
295-
["y, x"],
295+
["y", "x"],
296296
np.tile(np.linspace(-179, 179, X, endpoint=False), (Y, 1)), # note that this is not curvilinear
297297
{
298298
"units": "degrees_east",
@@ -304,7 +304,7 @@ def _NEMO_MOI_V():
304304
},
305305
),
306306
"nav_lat": (
307-
["y, x"],
307+
["y", "x"],
308308
np.tile(np.linspace(-75, 85, Y).reshape(-1, 1), (1, X)), # note that this is not curvilinear
309309
{
310310
"units": "degrees_north",
@@ -334,7 +334,7 @@ def _NEMO_MOI_V():
334334
},
335335
),
336336
"time_counter": (
337-
[],
337+
["time_counter"],
338338
np.empty(0, dtype="datetime64[ns]"),
339339
{
340340
"standard_name": "time",
@@ -367,7 +367,7 @@ def _CESM():
367367
{
368368
"UVEL": (
369369
["time", "z_t", "nlat", "nlon"],
370-
np.random.rand(T, Z, Y, X, dtype="float32"),
370+
np.random.rand(T, Z, Y, X).astype("float32"),
371371
{
372372
"long_name": "Velocity in grid-x direction",
373373
"units": "centimeter/s",
@@ -377,7 +377,7 @@ def _CESM():
377377
),
378378
"VVEL": (
379379
["time", "z_t", "nlat", "nlon"],
380-
np.random.rand(T, Z, Y, X, dtype="float32"),
380+
np.random.rand(T, Z, Y, X).astype("float32"),
381381
{
382382
"long_name": "Velocity in grid-y direction",
383383
"units": "centimeter/s",
@@ -387,7 +387,7 @@ def _CESM():
387387
),
388388
"WVEL": (
389389
["time", "z_w_top", "nlat", "nlon"],
390-
np.random.rand(T, Z, Y, X, dtype="float32"),
390+
np.random.rand(T, Z, Y, X).astype("float32"),
391391
{
392392
"long_name": "Vertical Velocity",
393393
"units": "centimeter/s",
@@ -455,31 +455,31 @@ def _MITgcm_netcdf():
455455
{
456456
"U": (
457457
["T", "Z", "Y", "Xp1"],
458-
np.random.rand(T, Z, Y, X + 1, dtype="float32"),
458+
np.random.rand(T, Z, Y, X + 1).astype("float32"),
459459
{
460460
"units": "m/s",
461461
"coordinates": "XU YU RC iter",
462462
},
463463
),
464464
"V": (
465465
["T", "Z", "Yp1", "X"],
466-
np.random.rand(T, Z, Y + 1, X, dtype="float32"),
466+
np.random.rand(T, Z, Y + 1, X).astype("float32"),
467467
{
468468
"units": "m/s",
469469
"coordinates": "XV YV RC iter",
470470
},
471471
),
472472
"W": (
473473
["T", "Zl", "Y", "X"],
474-
np.random.rand(T, Z, Y, X, dtype="float32"),
474+
np.random.rand(T, Z, Y, X).astype("float32"),
475475
{
476476
"units": "m/s",
477477
"coordinates": "XC YC RC iter",
478478
},
479479
),
480480
"Temp": (
481481
["T", "Z", "Y", "X"],
482-
np.random.rand(T, Z, Y, X, dtype="float32"),
482+
np.random.rand(T, Z, Y, X).astype("float32"),
483483
{
484484
"units": "degC",
485485
"coordinates": "XC YC RC iter",
@@ -556,15 +556,15 @@ def _ERA5_wind():
556556
{
557557
"u10": (
558558
["time", "latitude", "longitude"],
559-
np.random.rand(T, Y, X, dtype="float32"),
559+
np.random.rand(T, Y, X).astype("float32"),
560560
{
561561
"long_name": "10 metre U wind component",
562562
"units": "m s**-1",
563563
},
564564
),
565565
"v10": (
566566
["time", "latitude", "longitude"],
567-
np.random.rand(T, Y, X, dtype="float32"),
567+
np.random.rand(T, Y, X).astype("float32"),
568568
{
569569
"long_name": "10 metre V wind component",
570570
"units": "m s**-1",
@@ -605,7 +605,7 @@ def _FES_tides():
605605
{
606606
"Ug": (
607607
["lat", "lon"],
608-
np.random.rand(Y, X, dtype="float32"),
608+
np.random.rand(Y, X).astype("float32"),
609609
{
610610
"long_name": "Eastward sea water velocity phaselag due to non equilibrium ocean tide at m2 frequency",
611611
"units": "degrees",
@@ -614,7 +614,7 @@ def _FES_tides():
614614
),
615615
"Ua": (
616616
["lat", "lon"],
617-
np.random.rand(Y, X, dtype="float32"),
617+
np.random.rand(Y, X).astype("float32"),
618618
{
619619
"long_name": "Eastward sea water velocity amplitude due to non equilibrium ocean tide at m2 frequency",
620620
"units": "cm/s",
@@ -657,7 +657,7 @@ def _hycom_espc():
657657
{
658658
"water_u": (
659659
["time", "depth", "lat", "lon"],
660-
np.random.rand(T, Z, Y, X, dtype="float32"),
660+
np.random.rand(T, Z, Y, X).astype("float32"),
661661
{
662662
"long_name": "Eastward Water Velocity",
663663
"standard_name": "eastward_sea_water_velocity",
@@ -739,7 +739,7 @@ def _ecco4():
739739
{
740740
"UVEL": (
741741
["time", "k", "tile", "j", "i_g"],
742-
np.random.rand(T, Z, 13, Y, X, dtype="float32"),
742+
np.random.rand(T, Z, 13, Y, X).astype("float32"),
743743
{
744744
"long_name": "Horizontal velocity in the model +x direction",
745745
"units": "m s-1",
@@ -754,7 +754,7 @@ def _ecco4():
754754
),
755755
"VVEL": (
756756
["time", "k", "tile", "j_g", "i"],
757-
np.random.rand(T, Z, 13, Y, X, dtype="float32"),
757+
np.random.rand(T, Z, 13, Y, X).astype("float32"),
758758
{
759759
"long_name": "Horizontal velocity in the model +y direction",
760760
"units": "m s-1",
@@ -769,7 +769,7 @@ def _ecco4():
769769
),
770770
"WVEL": (
771771
["time", "k_l", "tile", "j", "i"],
772-
np.random.rand(T, Z, 13, Y, X, dtype="float32"),
772+
np.random.rand(T, Z, 13, Y, X).astype("float32"),
773773
{
774774
"long_name": "Vertical velocity",
775775
"units": "m s-1",
@@ -964,7 +964,7 @@ def _CROCO_idealized():
964964
{
965965
"u": (
966966
["time", "s_rho", "eta_rho", "xi_u"],
967-
np.random.rand(T, Z, Y, X - 1, dtype="float32"),
967+
np.random.rand(T, Z, Y, X - 1).astype("float32"),
968968
{
969969
"long_name": "u-momentum component",
970970
"units": "meter second-1",
@@ -974,7 +974,7 @@ def _CROCO_idealized():
974974
),
975975
"v": (
976976
["time", "s_rho", "eta_v", "xi_rho"],
977-
np.random.rand(T, Z, Y - 1, X, dtype="float32"),
977+
np.random.rand(T, Z, Y - 1, X).astype("float32"),
978978
{
979979
"long_name": "v-momentum component",
980980
"units": "meter second-1",
@@ -984,7 +984,7 @@ def _CROCO_idealized():
984984
),
985985
"w": (
986986
["time", "s_rho", "eta_rho", "xi_rho"],
987-
np.random.rand(T, Z, Y, X, dtype="float32"),
987+
np.random.rand(T, Z, Y, X).astype("float32"),
988988
{
989989
"long_name": "vertical momentum component",
990990
"units": "meter second-1",
@@ -995,7 +995,7 @@ def _CROCO_idealized():
995995
),
996996
"h": (
997997
["eta_rho", "xi_rho"],
998-
np.random.rand(Y, X, dtype="float32"),
998+
np.random.rand(Y, X).astype("float32"),
999999
{
10001000
"long_name": "bathymetry at RHO-points",
10011001
"units": "meter",
@@ -1005,7 +1005,7 @@ def _CROCO_idealized():
10051005
),
10061006
"zeta": (
10071007
["time", "eta_rho", "xi_rho"],
1008-
np.random.rand(T, Y, X, dtype="float32"),
1008+
np.random.rand(T, Y, X).astype("float32"),
10091009
{
10101010
"long_name": "free-surface",
10111011
"units": "meter",
@@ -1015,7 +1015,7 @@ def _CROCO_idealized():
10151015
),
10161016
"Cs_w": (
10171017
["s_w"],
1018-
np.random.rand(Z + 1, dtype="float32"),
1018+
np.random.rand(Z + 1).astype("float32"),
10191019
{
10201020
"long_name": "S-coordinate stretching curves at W-points",
10211021
},

0 commit comments

Comments
 (0)