| 1 | package Astro::FITS::HdrTrans::JAC; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | Astro::FITS::HdrTrans::JAC - Base class for translation of Joint | ||||||||||||||||||||||||||||||||||||||||||
| 6 | Astronomy Centre instruments. | ||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | use Astro::FITS::HdrTrans::JAC; | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | This class provides a generic set of translations that are common to | ||||||||||||||||||||||||||||||||||||||||||
| 15 | instrumentation from the Joint Astronomy Centre. It should not be used | ||||||||||||||||||||||||||||||||||||||||||
| 16 | directly for translation of instrument FITS headers. | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 27 | ▶ | use 5.006; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 27 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 27 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 27 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 27 | ▶ | use DateTime; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 27 | ▶ | use DateTime::TimeZone; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | # Cache UTC definition | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 27 | our $UTC = DateTime::TimeZone->new( name => 'UTC' ); | |||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | # Inherit from the Base translation class and not HdrTrans itself | ||||||||||||||||||||||||||||||||||||||||||
| 31 | # (which is just a class-less wrapper). | ||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 27 | ▶ | use base qw/ Astro::FITS::HdrTrans::FITS /; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 27 | our $VERSION = "1.66"; | |||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | # in each class we have three sets of data. | ||||||||||||||||||||||||||||||||||||||||||
| 38 | # - constant mappings | ||||||||||||||||||||||||||||||||||||||||||
| 39 | # - unit mappings | ||||||||||||||||||||||||||||||||||||||||||
| 40 | # - complex mappings | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | # For a constant mapping, there is no FITS header, just a generic | ||||||||||||||||||||||||||||||||||||||||||
| 43 | # header that is constant. | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 27 | my %CONST_MAP = ( | |||||||||||||||||||||||||||||||||||||||||
| 45 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | # Unit mapping implies that the value propagates directly | ||||||||||||||||||||||||||||||||||||||||||
| 48 | # to the output with only a keyword name change. | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 27 | my %UNIT_MAP = ( | |||||||||||||||||||||||||||||||||||||||||
| 51 | MSBID => 'MSBID', | ||||||||||||||||||||||||||||||||||||||||||
| 52 | MSB_TRANSACTION_ID => 'MSBTID', | ||||||||||||||||||||||||||||||||||||||||||
| 53 | SHIFT_TYPE => "OPER_SFT", | ||||||||||||||||||||||||||||||||||||||||||
| 54 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | # Create the translation methods. | ||||||||||||||||||||||||||||||||||||||||||
| 57 | 27 | __PACKAGE__->_generate_lookup_methods( \%CONST_MAP, \%UNIT_MAP ); | |||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | =item B<translate_from_FITS> | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | This routine overrides the base class implementation to enable the | ||||||||||||||||||||||||||||||||||||||||||
| 66 | caches to be cleared and for the location of the DATE-OBS/DATE-END field to | ||||||||||||||||||||||||||||||||||||||||||
| 67 | be found so that base class implementations will work correctly. | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | This means that some conversion methods (in particular those using time in | ||||||||||||||||||||||||||||||||||||||||||
| 70 | a base class) may not work properly outside the context of a full translation | ||||||||||||||||||||||||||||||||||||||||||
| 71 | unless they have been subclassed locally. | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 19 | ▶ | sub translate_from_FITS { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
translate_from_FITS: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 19 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 77 | 19 | my $headers = shift; | |||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | # sort out DATE-OBS and DATE-END | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 19 | $class->_fix_dates( $headers ); | |||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | # Go to the base class | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 19 | return $class->SUPER::translate_from_FITS( $headers, @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | =head1 COMPLEX CONVERSIONS | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | These methods are more complicated than a simple mapping. We have to | ||||||||||||||||||||||||||||||||||||||||||
| 91 | provide both from- and to-FITS conversions All these routines are | ||||||||||||||||||||||||||||||||||||||||||
| 92 | methods and the to_ routines all take a reference to a hash and return | ||||||||||||||||||||||||||||||||||||||||||
| 93 | the translated value (a many-to-one mapping). The from_ methods take | ||||||||||||||||||||||||||||||||||||||||||
| 94 | a reference to a generic hash and return a translated hash (sometimes | ||||||||||||||||||||||||||||||||||||||||||
| 95 | these are many-to-many). | ||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | =item B<to_OBSERVATION_ID> | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | Converts the C<OBSID> header directly into the C<OBSERVATION_ID> | ||||||||||||||||||||||||||||||||||||||||||
| 102 | generic header, or if that header does not exist, converts the | ||||||||||||||||||||||||||||||||||||||||||
| 103 | C<INSTRUME>, C<RUNNR>, and C<DATE-OBS> headers into C<OBSERVATION_ID>. | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | The form of the observation ID string is documented in | ||||||||||||||||||||||||||||||||||||||||||
| 106 | JSA/ANA/001 (http://docs.jach.hawaii.edu/JCMT/JSA/ANA/001/jsa_ana_001.pdf). | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 18 | ▶ | sub to_OBSERVATION_ID { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_OBSERVATION_ID: called CC=6 SCAR=18.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | 18 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 112 | 18 | my $FITS_headers = shift; | |||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | 18 | my $return; | |||||||||||||||||||||||||||||||||||||||||
| 115 | 18 | ▶ | if ( exists( $FITS_headers->{'OBSID'} ) && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $FITS_headers->{"OBSID"} and defined $FITS_headers->{"OBSID"}
MC/DC50%1/2
exists $FITS_headers->{"OBSID"} and defined $FITS_headers->{"OBSID"}
exists $FITS_headers->{"OBSID"}
defined $FITS_headers->{"OBSID"}
Truth table66%2/3
A and B
A= exists $FITS_headers->{"OBSID"}B= defined $FITS_headers->{"OBSID"}
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | defined( $FITS_headers->{'OBSID'} ) ) { | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 3 | $return = $FITS_headers->{'OBSID'}; | |||||||||||||||||||||||||||||||||||||||||
| 118 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | 15 | my $instrume = $self->to_INSTRUMENT( $FITS_headers ); | |||||||||||||||||||||||||||||||||||||||||
| 121 | 15 | my $obsnum = $self->to_OBSERVATION_NUMBER( $FITS_headers ); | |||||||||||||||||||||||||||||||||||||||||
| 122 | 15 | my $dateobs = $self->to_UTSTART( $FITS_headers ); | |||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | 15 | ▶ | if ( defined $dateobs && defined $obsnum && defined $instrume ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $dateobs and defined $obsnum and defined $instrume
defined $dateobs and defined $obsnum
MC/DC0%0/3
defined $dateobs and defined $obsnum and defined $instrume
defined $dateobs
defined $obsnum
defined $instrume
Truth table25%1/4
A and B and C
A= defined $dateobsB= defined $obsnumC= defined $instrume
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | 15 | my $datetime = $dateobs->datetime; | |||||||||||||||||||||||||||||||||||||||||
| 126 | 15 | $datetime =~ s/-//g; | |||||||||||||||||||||||||||||||||||||||||
| 127 | 15 | $datetime =~ s/://g; | |||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | 15 | $return = join '_', (lc $instrume), $obsnum, $datetime; | |||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 18 | return $return; | |||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | =item B<_fix_dates> | ||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | Sort out DATE-OBS and DATE-END in cases where they are not available directly. | ||||||||||||||||||||||||||||||||||||||||||
| 140 | This is mainly an issue with database retrievals where the date format is not | ||||||||||||||||||||||||||||||||||||||||||
| 141 | FITS compliant. | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | Astro::FITS::HdrTrans::JAC->_fix_dates( \%headers ); | ||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | 45 | ▶ | sub _fix_dates { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fix_dates: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | 45 | my ( $class, $FITS_headers ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | # DATE-OBS can be from DATE_OBS | ||||||||||||||||||||||||||||||||||||||||||
| 151 | # For compatability with Sybase database, also accept LONGDATEOBS LONGDATE | ||||||||||||||||||||||||||||||||||||||||||
| 152 | 45 | __PACKAGE__->_try_dates( $FITS_headers, 'DATE-OBS', qw/ DATE_OBS LONGDATEOBS LONGDATE / ); | |||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | # DATE-END can be from DATE_END | ||||||||||||||||||||||||||||||||||||||||||
| 155 | # For compatability with Sybase database, also accept LONGDATEEND | ||||||||||||||||||||||||||||||||||||||||||
| 156 | 45 | __PACKAGE__->_try_dates( $FITS_headers, 'DATE-END', qw/ DATE_END LONGDATEEND / ); | |||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | 45 | return; | |||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | # helper routine for _fix_dates | ||||||||||||||||||||||||||||||||||||||||||
| 162 | 90 | ▶ | sub _try_dates { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_try_dates: called CC=5 SCAR=20.2
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 90 | my ( $class, $FITS_headers, $outkey, @tests ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | 90 | ▶ | if (!exists $FITS_headers->{$outkey}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | 16 | for my $key (@tests) { | |||||||||||||||||||||||||||||||||||||||||
| 167 | 40 | ▶ | if ( exists( $FITS_headers->{$key} ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | my $date = _convert_mysql_date( $FITS_headers->{$key} ); | |||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | if( defined( $date ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | $FITS_headers->{$outkey} = $date->datetime; | |||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||
| 176 | 90 | return; | |||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | # Convert MySQL date string to DateTime object. | ||||||||||||||||||||||||||||||||||||||||||
| 180 | # For compatability, also accepts Sybase date strings. | ||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | ▶ | sub _convert_mysql_date { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_convert_mysql_date: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | my $date = shift; | |||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | $date =~ s/\s*$//; | |||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | if ($date =~ /\s*(\d\d\d\d)-(\d\d)-(\d\d)\s+(\d{1,2}):(\d\d):(\d\d)/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | my $return = DateTime->new( year => $1, | |||||||||||||||||||||||||||||||||||||||||
| 189 | month => $2, | ||||||||||||||||||||||||||||||||||||||||||
| 190 | day => $3, | ||||||||||||||||||||||||||||||||||||||||||
| 191 | hour => $4, | ||||||||||||||||||||||||||||||||||||||||||
| 192 | minute => $5, | ||||||||||||||||||||||||||||||||||||||||||
| 193 | second => $6, | ||||||||||||||||||||||||||||||||||||||||||
| 194 | time_zone => $UTC, | ||||||||||||||||||||||||||||||||||||||||||
| 195 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | return $return; | |||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | } elsif ($date =~ /\s*(\w+)\s+(\d{1,2})\s+(\d{4})\s+(\d{1,2}):(\d\d):(\d\d)(?::\d\d\d)?(AM|PM)/) { | ||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | my $hour = $4; | |||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | if (uc($7) eq 'AM' && $hour == 12) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
uc $7 eq "AM" and $hour == 12
MC/DC0%0/2
uc $7 eq "AM" and $hour == 12
uc $7 eq "AM"
$hour == 12
Truth table0%0/3
A and B
A= uc $7 eq "AM"B= $hour == 12
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | $hour = 0; | |||||||||||||||||||||||||||||||||||||||||
| 203 | ▶ | } elsif ( uc($7) eq 'PM' && $hour < 12 ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
uc $7 eq "PM" and $hour < 12
MC/DC0%0/2
uc $7 eq "PM" and $hour < 12
uc $7 eq "PM"
$hour < 12
Truth table0%0/3
A and B
A= uc $7 eq "PM"B= $hour < 12
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | $hour += 12; | |||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | my %mon_lookup = ( 'Jan' => 1, | |||||||||||||||||||||||||||||||||||||||||
| 208 | 'Feb' => 2, | ||||||||||||||||||||||||||||||||||||||||||
| 209 | 'Mar' => 3, | ||||||||||||||||||||||||||||||||||||||||||
| 210 | 'Apr' => 4, | ||||||||||||||||||||||||||||||||||||||||||
| 211 | 'May' => 5, | ||||||||||||||||||||||||||||||||||||||||||
| 212 | 'Jun' => 6, | ||||||||||||||||||||||||||||||||||||||||||
| 213 | 'Jul' => 7, | ||||||||||||||||||||||||||||||||||||||||||
| 214 | 'Aug' => 8, | ||||||||||||||||||||||||||||||||||||||||||
| 215 | 'Sep' => 9, | ||||||||||||||||||||||||||||||||||||||||||
| 216 | 'Oct' => 10, | ||||||||||||||||||||||||||||||||||||||||||
| 217 | 'Nov' => 11, | ||||||||||||||||||||||||||||||||||||||||||
| 218 | 'Dec' => 12 ); | ||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | my $month = $mon_lookup{$1}; | |||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | my $return = DateTime->new( year => $3, | |||||||||||||||||||||||||||||||||||||||||
| 222 | month => $month, | ||||||||||||||||||||||||||||||||||||||||||
| 223 | day => $2, | ||||||||||||||||||||||||||||||||||||||||||
| 224 | hour => $hour, | ||||||||||||||||||||||||||||||||||||||||||
| 225 | minute => $5, | ||||||||||||||||||||||||||||||||||||||||||
| 226 | second => $6, | ||||||||||||||||||||||||||||||||||||||||||
| 227 | time_zone => $UTC, | ||||||||||||||||||||||||||||||||||||||||||
| 228 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | return $return; | |||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | C<Astro::FITS::HdrTrans>, C<Astro::FITS::HdrTrans::Base>. | ||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | Brad Cavanagh E<lt>b.cavanagh@jach.hawaii.eduE<gt>. | ||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | Copyright (C) 2007 Science and Technology Facilities Council. | ||||||||||||||||||||||||||||||||||||||||||
| 249 | Copyright (C) 2006 Particle Physics and Astronomy Research Council. | ||||||||||||||||||||||||||||||||||||||||||
| 250 | All Rights Reserved. | ||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | This program is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||
| 253 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||||||||||||||||
| 254 | the Free Software Foundation; either Version 2 of the License, or (at | ||||||||||||||||||||||||||||||||||||||||||
| 255 | your option) any later version. | ||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | This program is distributed in the hope that it will be useful,but | ||||||||||||||||||||||||||||||||||||||||||
| 258 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||||||||||||||||||||
| 259 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||||||||||||||||||||||||||||||||||||||||
| 260 | General Public License for more details. | ||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | You should have received a copy of the GNU General Public License | ||||||||||||||||||||||||||||||||||||||||||
| 263 | along with this program; if not, write to the Free Software | ||||||||||||||||||||||||||||||||||||||||||
| 264 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, | ||||||||||||||||||||||||||||||||||||||||||
| 265 | USA. | ||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||
| 267 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | 27 | 1; | |||||||||||||||||||||||||||||||||||||||||