IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 16, 2008, 1:39:04 PM (17 years ago)
Author:
bills
Message:

fixed wrong dimensions from compressesd skyfiles

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/magic_tree.pl

    r20674 r20762  
    167167#    my $naxis1 = $$header{'NAXIS1'} or &my_die("Can't find NAXIS1", $magic_id, $PS_EXIT_SYS_ERROR);
    168168    my $naxis1 = $$header{'NAXIS1'};
    169     if (!$naxis1) {
    170         # XXX: if the skyfile is compressed then the WCS won't be in the primary header
     169    my $naxis2;
     170    if ($naxis1) {
     171        $naxis2 = $$header{'NAXIS2'} or &my_die("Can't find NAXIS2", $magic_id, $PS_EXIT_SYS_ERROR);
     172    } else {
     173        # if the skyfile is compressed then the WCS won't be in the primary header, move to the
     174        # extension
    171175        my $hdutype;
    172176        $fits->movrel_hdu(1, $hdutype, $status);
     
    175179        ($header, $status) = Astro::FITS::CFITSIO::fits_read_header( $fits );
    176180        &my_die("Unable to read extension header: $status", $magic_id, $PS_EXIT_SYS_ERROR) if $status;
    177         $naxis1 = $$header{'NAXIS1'} or &my_die("Can't find NAXIS1", $magic_id, $PS_EXIT_SYS_ERROR);
    178     }
    179     my $naxis2 = $$header{'NAXIS2'} or &my_die("Can't find NAXIS2", $magic_id, $PS_EXIT_SYS_ERROR);
     181        my $xtension = $$header{'XTENSION'} or &my_die("Can't find XTENSION", $magic_id, $PS_EXIT_SYS_ERROR);
     182        &my_die("XTENSION found: $xtension", $magic_id, $PS_EXIT_SYS_ERROR) if $xtension ne "'BINTABLE'";
     183        $naxis1 = $$header{'ZNAXIS1'} or &my_die("Can't find ZNAXIS1", $magic_id, $PS_EXIT_SYS_ERROR);
     184        $naxis2 = $$header{'ZNAXIS2'} or &my_die("Can't find ZNAXIS2", $magic_id, $PS_EXIT_SYS_ERROR);
     185    }
    180186    my $ctype1 = $$header{'CTYPE1'} or &my_die("Can't find CTYPE1", $magic_id, $PS_EXIT_SYS_ERROR);
    181187    my $ctype2 = $$header{'CTYPE2'} or &my_die("Can't find CTYPE2", $magic_id, $PS_EXIT_SYS_ERROR);
     
    347353    my $contents = $node->{contents} or die "Can't find contents of node."; # Contents of node
    348354
     355    if ($position eq 'root' and scalar @$contents <= 4) {
     356        # don't need to divide, but do we need to sort?
     357        return;
     358    }
     359
    349360    my ($lower, $upper) = divide_list($contents, 'xi');
    350361
Note: See TracChangeset for help on using the changeset viewer.