Skip to content

Commit c9fdaea

Browse files
committed
rm Fields.geom, Step.geom is the recommended accessor
1 parent a18ae5d commit c9fdaea

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

src/stagpy/step.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -367,15 +367,6 @@ def _get_raw_data(self, name: str) -> tuple[list[str], Any]:
367367
break
368368
return list_fvar, parsed_data
369369

370-
@cached_property
371-
def geom(self) -> Geometry:
372-
"""Geometry information.
373-
374-
[`Geometry`][stagpy.step.Geometry] instance holding geometry information.
375-
It is issued from binary files holding field information.
376-
"""
377-
return Geometry(self.step)
378-
379370

380371
@dataclass(frozen=True)
381372
class Tracers:
@@ -520,7 +511,7 @@ def walls(self) -> NDArray:
520511
"""Radial position of cell walls."""
521512
rbot, rtop = self.bounds
522513
try:
523-
walls = self.step.fields.geom.r_walls
514+
walls = self.step.geom.r_walls
524515
except error.StagpyError:
525516
# assume walls are mid-way between T-nodes
526517
# could be T-nodes at center between walls
@@ -572,7 +563,6 @@ class Step:
572563
assert(sdat.steps[n].sdat is sdat)
573564
assert(sdat.steps[n].istep == n)
574565
assert(sdat.snaps[n].isnap == n)
575-
assert(sdat.steps[n].geom is sdat.steps[n].fields.geom)
576566
assert(sdat.snaps[n] is sdat.snaps[n].fields.step)
577567
```
578568
@@ -634,15 +624,14 @@ def _header(self) -> dict[str, Any] | None:
634624
header = stagyyparsers.read_geom_h5(self.sdat._dataxmf, self.isnap)
635625
return header if header else None
636626

637-
@property
627+
@cached_property
638628
def geom(self) -> Geometry:
639629
"""Geometry information.
640630
641631
[`Geometry`][stagpy.step.Geometry] instance holding geometry information.
642-
It is issued from binary files holding field information. It is set to
643-
None if not available for this time step.
632+
It is issued from binary files holding field information.
644633
"""
645-
return self.fields.geom
634+
return Geometry(self)
646635

647636
@property
648637
def timeinfo(self) -> Series:

tests/test_stagyydata.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ def test_step_istep(sdat: StagyyData) -> None:
6161
assert all(s is sdat.steps[s.istep] for s in sdat.steps)
6262

6363

64-
def test_geom_refs(step: Step) -> None:
65-
assert step.geom is step.fields.geom
66-
67-
6864
def test_geom(step: Step) -> None:
6965
assert step.geom.twod
7066
assert not step.geom.threed

0 commit comments

Comments
 (0)