[Yt-svn] yt-commit r1393 - trunk/yt/raven

skillman at wrangler.dreamhost.com skillman at wrangler.dreamhost.com
Wed Aug 5 12:11:28 PDT 2009


Author: skillman
Date: Wed Aug  5 12:11:25 2009
New Revision: 1393
URL: http://yt.spacepope.org/changeset/1393

Log:
Updated FixedResolution to accept clobber=True/False(default) in the
export_fits call.  If set to true, any existing FITS files of the same
name will be replaced without causing errors.



Modified:
   trunk/yt/raven/FixedResolution.py

Modified: trunk/yt/raven/FixedResolution.py
==============================================================================
--- trunk/yt/raven/FixedResolution.py	(original)
+++ trunk/yt/raven/FixedResolution.py	Wed Aug  5 12:11:25 2009
@@ -81,11 +81,12 @@
             output.create_dataset(field,data=self[field])
         output.close()
 
-    def export_fits(self, filename_prefix, fields = None):
+    def export_fits(self, filename_prefix, fields = None, clobber=False):
         """
         This will export a set of FITS images of either the fields specified
         or all the fields already in the object.  The output filenames are
-        *filename_prefix* plus an underscore plus the name of the field.
+        *filename_prefix* plus an underscore plus the name of the field. If 
+        clobber is set to True, this will overwrite any existing FITS file.
 
         This requires the *pyfits* module, which is a standalone module
         provided by STSci to interface with FITS-format files.
@@ -102,7 +103,7 @@
                 weightname = self.data_source._weight
                 if weightname is None: weightname = 'None'
                 field = field +'_'+weightname
-            hdu.writeto("%s_%s.fits" % (filename_prefix, field))
+            hdu.writeto("%s_%s.fits" % (filename_prefix, field),clobber=clobber)
 
     def open_in_ds9(self, field, take_log=True):
         """



More information about the yt-svn mailing list