aboutsummaryrefslogtreecommitdiff
path: root/noao/imred/quadred/src/quad/quaddelete.x
diff options
context:
space:
mode:
Diffstat (limited to 'noao/imred/quadred/src/quad/quaddelete.x')
-rw-r--r--noao/imred/quadred/src/quad/quaddelete.x39
1 files changed, 39 insertions, 0 deletions
diff --git a/noao/imred/quadred/src/quad/quaddelete.x b/noao/imred/quadred/src/quad/quaddelete.x
new file mode 100644
index 00000000..bdee65b2
--- /dev/null
+++ b/noao/imred/quadred/src/quad/quaddelete.x
@@ -0,0 +1,39 @@
+include "quadgeom.h"
+
+# QUADDELETE -- Delete subimages, one for each readout.
+
+procedure quaddelete (qg, rootname)
+
+pointer qg #I Pointer to open quadgeom structure
+char rootname[ARB] #I Root name for subimages.
+
+int amp
+pointer fullname
+
+pointer sp
+int imaccess()
+
+begin
+ call smark (sp)
+ call salloc (fullname, SZ_LINE, TY_CHAR)
+
+ # Loop over active readouts
+ do amp = 1, QG_NAMPS(qg) {
+
+ # The sub-section image will only exist if this is not a phantom
+ if (QG_PHANTOM (qg, amp) == NO) {
+
+ # Make sub-image name
+ call sprintf (Memc[fullname], SZ_LINE, "%s.%s")
+ call pargstr (rootname)
+ call pargstr (Memc[QG_AMPID(qg, amp)])
+
+ # Delete the sub-image (if it exists)
+ if (imaccess (Memc[fullname], READ_ONLY) == YES) {
+ call imdelete (Memc[fullname])
+ }
+ }
+ }
+
+ call sfree (sp)
+end