Skip to content

Commit 82ac140

Browse files
brittonsmithcphyc
authored andcommitted
Refactor to allow create_field_info to only be executed once.
1 parent bb2babd commit 82ac140

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

yt/data_objects/static_output.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,15 +658,21 @@ def field_list(self):
658658
@property
659659
def field_info(self):
660660
if self._field_info is None:
661-
self.create_field_info()
661+
self.index
662662
return self._field_info
663663

664664
@field_info.setter
665665
def field_info(self, value):
666666
self._field_info = value
667667

668668
def create_field_info(self):
669-
self.index
669+
# create_field_info will be called at the end of instantiating
670+
# the index object. This will trigger index creation, which will
671+
# call this function again.
672+
if self._instantiated_index is None:
673+
self.index
674+
return
675+
670676
self.field_dependencies = {}
671677
self.derived_field_list = []
672678
self.filtered_particle_types = []

0 commit comments

Comments
 (0)