Index: /trunk/psLib/src/fits/psFits.c
===================================================================
--- /trunk/psLib/src/fits/psFits.c	(revision 14867)
+++ /trunk/psLib/src/fits/psFits.c	(revision 14868)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-04-11 17:01:50 $
+ *  @version $Revision: 1.66 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-09-17 21:35:35 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -562,4 +562,68 @@
 
 
+bool psFitsSetCompression(
+    psFits* fits,                       ///< psFits object to close
+    psFitsCompressionType type,         ///< type of compression
+    int ndim,                           ///< number of dim in tile size array
+    long *tilesize,                     ///< pointer to an array defining compression tile size
+    int noisebits,                      ///< noise bits
+    int scale,                          ///< hcompress scale
+    int smooth                          ///< hcompress smothing
+)
+{
+    // convert psFitsCompressionType to cfitsio compression types
+    int comptype;
+    switch (type) {
+        case PS_FITS_COMPRESS_NONE:
+            comptype = 0x0;
+            break;
+        case PS_FITS_COMPRESS_GZIP:
+            comptype = GZIP_1;
+            break;
+        case PS_FITS_COMPRESS_RICE:
+            comptype = RICE_1;
+            break;
+        case PS_FITS_COMPRESS_HCOMPRESS:
+            comptype = HCOMPRESS_1;
+            break;
+        case PS_FITS_COMPRESS_PLIO:
+            comptype = PLIO_1;
+            break;
+        default:
+            psError(PS_ERR_UNKNOWN, true, "invalid psFitsCompressionType");
+            return false;
+    }
+
+    int status = false;
+    fits_set_compression_type(fits->fd, comptype, &status);
+    if (!status) {
+        goto ERROR;
+    }
+    fits_set_tile_dim(fits->fd, ndim, tilesize, &status);
+    if (!status) {
+        goto ERROR;
+    }
+    fits_set_noise_bits(fits->fd, noisebits, &status);
+    if (!status) {
+        goto ERROR;
+    }
+#if FITS_HCOMP
+    fits_set_hcomp_scale(fits->fd, scale, &status);
+    if (!status) {
+        goto ERROR;
+    }
+    fits_set_hcomp_smooth(fits->fd, smooth, &status);
+    if (!status) {
+        goto ERROR;
+    }
+#endif // FITS_HCOMP
+
+ERROR:
+    fits_set_compression_type(fits->fd, 0x0, &status);
+    psError(PS_ERR_UNKNOWN, true, "failed to configure compression - disabling");
+    return false;
+}
+
+
 psDataType p_psFitsTypeFromCfitsio(int datatype)
 {
Index: /trunk/psLib/src/fits/psFits.h
===================================================================
--- /trunk/psLib/src/fits/psFits.h	(revision 14867)
+++ /trunk/psLib/src/fits/psFits.h	(revision 14868)
@@ -4,6 +4,6 @@
  * @author Robert DeSonia, MHPCC
  *
- * @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
- * @date $Date: 2007-03-23 00:34:40 $
+ * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2007-09-17 21:35:35 $
  * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
  */
@@ -34,4 +34,12 @@
     PS_FITS_TYPE_ANY = ANY_HDU         ///< Any HDU type
 } psFitsType;
+
+typedef enum {
+    PS_FITS_COMPRESS_NONE = 0,
+    PS_FITS_COMPRESS_GZIP,
+    PS_FITS_COMPRESS_RICE,
+    PS_FITS_COMPRESS_HCOMPRESS,
+    PS_FITS_COMPRESS_PLIO
+} psFitsCompressionType;
 
 /** FITS file object.
@@ -73,4 +81,20 @@
 );
 
+/** Enables/configures FITS compression.
+ *
+ * Note that HCOMPRESS compression is not presently supported.
+ *
+ *  @return bool      TRUE if successfully configured, otherwise FALSE
+ */
+bool psFitsSetCompression(
+    psFits* fits,                       ///< psFits object to close
+    psFitsCompressionType type,         ///< type of compression
+    int ndim,                           ///< number of dim in tile size array
+    long *tilesize,                     ///< pointer to an array defining compression tile size
+    int noisebits,                      ///< noise bits
+    int scale,                          ///< hcompress scale
+    int smooth                          ///< hcompress smothing
+);
+
 /** Checks the type of a particular pointer.
  *
