Skip to content

Commit

Permalink
Merge branch 'develop' into feature/fix-cube-detailed-error-report
Browse files Browse the repository at this point in the history
  • Loading branch information
sandorkertesz committed Sep 16, 2024
2 parents 9786aac + fe1a294 commit 342ac04
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/earthkit/data/sources/array_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,14 @@ def _values(self, dtype=None):
return self.array_backend.array_ns.astype(self._array, dtype, copy=False)

def __repr__(self):
return f"{self.__class__.__name__}()"
return self.__class__.__name__ + "(%s,%s,%s,%s,%s,%s)" % (
self._metadata.get("shortName", None),
self._metadata.get("levelist", None),
self._metadata.get("date", None),
self._metadata.get("time", None),
self._metadata.get("step", None),
self._metadata.get("number", None),
)

def write(self, f, **kwargs):
r"""Write the field to a file object.
Expand Down
7 changes: 7 additions & 0 deletions tests/array_fieldlist/test_numpy_fs_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
# See grib/test_grib_metadata.py


def test_array_fl_field_repr():
ds, _ = load_array_fl(1)

t = repr(ds[0])
assert t == "ArrayField(2t,None,20200513,1200,0,0)"


def test_array_fl_values_metadata_basic():
ds, _ = load_array_fl(1)

Expand Down

0 comments on commit 342ac04

Please sign in to comment.