[yt-svn] commit/yt: MatthewTurk: Adding conversion factors for lingering translated fields in FLASH

Bitbucket commits-noreply at bitbucket.org
Tue Sep 11 15:36:00 PDT 2012


1 new commit in yt:


https://bitbucket.org/yt_analysis/yt/changeset/0856364b1b31/
changeset:   0856364b1b31
branch:      yt
user:        MatthewTurk
date:        2012-09-12 00:35:47
summary:     Adding conversion factors for lingering translated fields in FLASH
affected #:  1 file

diff -r b8446e7a4fcccae084f13b29e7be2c5b7060133c -r 0856364b1b31fd275c861019f3912e79cc7cb51f yt/frontends/flash/data_structures.py
--- a/yt/frontends/flash/data_structures.py
+++ b/yt/frontends/flash/data_structures.py
@@ -42,7 +42,7 @@
 from yt.utilities.physical_constants import cm_per_mpc
 from .fields import FLASHFieldInfo, add_flash_field, KnownFLASHFields
 from yt.data_objects.field_info_container import FieldInfoContainer, NullFunc, \
-     ValidateDataField
+     ValidateDataField, TranslationFunc
 
 class FLASHGrid(AMRGridPatch):
     _id_offset = 1
@@ -184,11 +184,16 @@
                 self.derived_field_list.append(field)
             if (field not in KnownFLASHFields and
                 field.startswith("particle")) :
-                self.parameter_file.field_info.add_field(field,
-                                                         function=NullFunc,
-                                                         take_log=False,
-                                                         validators = [ValidateDataField(field)],
-                                                         particle_type=True)
+                self.parameter_file.field_info.add_field(
+                        field, function=NullFunc, take_log=False,
+                        validators = [ValidateDataField(field)],
+                        particle_type=True)
+
+        for field in self.derived_field_list:
+            f = self.parameter_file.field_info[field]
+            if f._function.func_name == "_TranslationFunc":
+                # Translating an already-converted field
+                self.parameter_file.conversion_factors[field] = 1.0 
                 
     def _setup_data_io(self):
         self.io = io_registry[self.data_style](self.parameter_file)

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