Skip to content

Commit 1a6a5f3

Browse files
committed
Replace arange with linspace
1 parent d604d46 commit 1a6a5f3

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

parcels/_datasets/structured/circulation_models.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ def _hycom_espc():
669669
),
670670
"tau": (
671671
["time"],
672-
np.arange(0, 24, T, dtype="float64"),
672+
np.linspace(0, 24, T, dtype="float64"),
673673
{
674674
"long_name": "Tau",
675675
"units": "hours since analysis",
@@ -735,11 +735,12 @@ def _hycom_espc():
735735

736736
def _ecco4():
737737
"""ECCO V4r4 model dataset (from https://podaac.jpl.nasa.gov/dataset/ECCO_L4_OCEAN_VEL_LLC0090GRID_DAILY_V4R4#capability-modal-download)"""
738+
tiles = 13
738739
return xr.Dataset(
739740
{
740741
"UVEL": (
741742
["time", "k", "tile", "j", "i_g"],
742-
np.random.rand(T, Z, 13, Y, X).astype("float32"),
743+
np.random.rand(T, Z, tiles, Y, X).astype("float32"),
743744
{
744745
"long_name": "Horizontal velocity in the model +x direction",
745746
"units": "m s-1",
@@ -754,7 +755,7 @@ def _ecco4():
754755
),
755756
"VVEL": (
756757
["time", "k", "tile", "j_g", "i"],
757-
np.random.rand(T, Z, 13, Y, X).astype("float32"),
758+
np.random.rand(T, Z, tiles, Y, X).astype("float32"),
758759
{
759760
"long_name": "Horizontal velocity in the model +y direction",
760761
"units": "m s-1",
@@ -769,7 +770,7 @@ def _ecco4():
769770
),
770771
"WVEL": (
771772
["time", "k_l", "tile", "j", "i"],
772-
np.random.rand(T, Z, 13, Y, X).astype("float32"),
773+
np.random.rand(T, Z, tiles, Y, X).astype("float32"),
773774
{
774775
"long_name": "Vertical velocity",
775776
"units": "m s-1",
@@ -796,7 +797,7 @@ def _ecco4():
796797
),
797798
"tile": (
798799
["tile"],
799-
np.arange(13, dtype="int32"),
800+
np.arange(tiles, dtype="int32"),
800801
{
801802
"long_name": "lat-lon-cap tile index",
802803
"coverage_content_type": "coordinate",
@@ -899,7 +900,7 @@ def _ecco4():
899900
"YC": (
900901
["tile", "j", "i"],
901902
np.tile(
902-
np.tile(np.linspace(-89, 89, Y), (X, 1)).T, (13, 1, 1)
903+
np.tile(np.linspace(-89, 89, Y), (X, 1)).T, (tiles, 1, 1)
903904
), # NOTE this grid is not correct, as duplicates for each tile
904905
{
905906
"long_name": "latitude of tracer grid cell center",
@@ -914,7 +915,7 @@ def _ecco4():
914915
"YG": (
915916
["tile", "j_g", "i_g"],
916917
np.tile(
917-
np.tile(np.linspace(-89, 89, Y), (X, 1)).T, (13, 1, 1)
918+
np.tile(np.linspace(-89, 89, Y), (X, 1)).T, (tiles, 1, 1)
918919
), # NOTE this grid is not correct, as duplicates for each tile
919920
{
920921
"long_name": "latitude of 'southwest' corner of tracer grid cell",
@@ -928,7 +929,7 @@ def _ecco4():
928929
"XC": (
929930
["tile", "j", "i"],
930931
np.tile(np.linspace(-179, 179, X, endpoint=False), (Y, 1)).reshape(
931-
13, Y, X
932+
tiles, Y, X
932933
), # NOTE this grid is not correct, as duplicates for each tile
933934
{
934935
"long_name": "longitude of tracer grid cell center",
@@ -943,7 +944,7 @@ def _ecco4():
943944
"XG": (
944945
["tile", "j_g", "i_g"],
945946
np.tile(np.linspace(-179, 179, X, endpoint=False), (Y, 1)).reshape(
946-
13, Y, X
947+
tiles, Y, X
947948
), # NOTE this grid is not correct, as duplicates for each tile
948949
{
949950
"long_name": "longitude of 'southwest' corner of tracer grid cell",

0 commit comments

Comments
 (0)