[yt-svn] commit/yt: atmyers: move the code that gets the simulation time into _parse_parameter_file
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Sun Oct 5 15:17:36 PDT 2014
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/65fe85b62630/
Changeset: 65fe85b62630
Branch: yt
User: atmyers
Date: 2014-10-05 01:13:21+00:00
Summary: move the code that gets the simulation time into _parse_parameter_file
Affected #: 1 file
diff -r 2134d6d5144bddae97431fdf417768888281de02 -r 65fe85b6263082743e728c3ef6666addfa48897f yt/frontends/chombo/data_structures.py
--- a/yt/frontends/chombo/data_structures.py
+++ b/yt/frontends/chombo/data_structures.py
@@ -255,18 +255,6 @@
if D == 2:
self.dataset_type = 'chombo2d_hdf5'
- # some datasets will not be time-dependent, and to make
- # matters worse, the simulation time is not always
- # stored in the same place in the hdf file! Make
- # sure we handle that here.
- try:
- self.current_time = self._handle.attrs['time']
- except KeyError:
- try:
- self.current_time = self._handle['/level_0'].attrs['time']
- except KeyError:
- self.current_time = 0.0
-
self.geometry = "cartesian"
self.ini_filename = ini_filename
self.fullplotdir = os.path.abspath(filename)
@@ -315,6 +303,20 @@
self.refine_by = self._handle['/level_0'].attrs['ref_ratio']
self._determine_periodic()
+ self._determine_current_time()
+
+ def _determine_current_time(self):
+ # some datasets will not be time-dependent, and to make
+ # matters worse, the simulation time is not always
+ # stored in the same place in the hdf file! Make
+ # sure we handle that here.
+ try:
+ self.current_time = self._handle.attrs['time']
+ except KeyError:
+ try:
+ self.current_time = self._handle['/level_0'].attrs['time']
+ except KeyError:
+ self.current_time = 0.0
def _determine_periodic(self):
# we default to true unless the HDF5 file says otherwise
@@ -498,6 +500,7 @@
self.domain_right_edge = np.concatenate((self.domain_right_edge, [1.0]))
self.domain_dimensions = np.concatenate((self.domain_dimensions, [1]))
+ self._determine_current_time()
@classmethod
def _is_valid(self, *args, **kwargs):
@@ -601,6 +604,7 @@
self.domain_dimensions = self._calc_domain_dimensions()
self.refine_by = self._handle['/level_0'].attrs['ref_ratio']
self._determine_periodic()
+ self._determine_current_time()
def _parse_inputs_file(self, ini_filename):
self.fullplotdir = os.path.abspath(self.parameter_filename)
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list