IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 10, 2010, 1:36:36 PM (16 years ago)
Author:
bills
Message:

Add an option to run funpack on fits files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataStore/scripts/dsgetfileset

    r27229 r27905  
    1717use File::Basename qw( basename );
    1818
    19 my ($uri, $outdir, $timeout, $skip_checks, $no_proxy, $verbose);
     19my ($uri, $outdir, $timeout, $skip_checks, $unpack, $no_proxy, $verbose);
    2020
    2121GetOptions(
     
    2424    'timeout|t=s'       => \$timeout,
    2525    'skip-checks'       => \$skip_checks,
     26    'unpack'            => \$unpack,
    2627    'no-proxy'          => \$no_proxy,
    2728    'verbose|v'         => \$verbose,
     
    8990        exit $status;
    9091    }
     92
     93    if ($unpack) {
     94        my $file_type = `file $outfile`;
     95        if ($file_type =~ /FITS/) {
     96            my $packed_file = "${outfile}.fz";
     97            rename $outfile, $packed_file
     98                or die "failed to rename $outfile $packed_file";
     99
     100            # unpack the fits file and delete the input
     101            # This works whether or not the file is compressed
     102            $command = "funpack -D $packed_file";
     103            print "$command\n" if $verbose;
     104            $rc = system $command;
     105            if ($rc) {
     106                my $status = $rc >> 8;
     107                print STDERR "failed to funpack $outfile: rc: $rc status: $status\n";
     108                exit $status;
     109            }
     110        }
     111    }
    91112}
    92113
     
    129150
    130151Do not load proxy environment variables.
     152
     153=item * --unpack
     154
     155Uncompress fits files if compressed
    131156
    132157Optional.
Note: See TracChangeset for help on using the changeset viewer.