IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15677


Ignore:
Timestamp:
Nov 21, 2007, 2:33:39 PM (18 years ago)
Author:
Paul Price
Message:

Adding function to return the name of the skycell file.

Location:
trunk/PS-IPP-Config
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/PS-IPP-Config/Build.PL

    r14745 r15677  
    1313        'File::Spec'                => '0.87',
    1414        'Getopt::Long'              => '2.33',
     15        'IPC::Cmd'                  => '0.36',
    1516        'PS::IPP::Metadata::Config' => '1.00',
    1617        'Statistics::Descriptive'   => '2.6',
  • trunk/PS-IPP-Config/MANIFEST

    r14896 r15677  
    22LICENSE
    33lib/PS/IPP/Config.pm
     4lib/PS/IPP/Operations.pm
    45lib/PS/IPP/Metadata/List.pm
    56lib/PS/IPP/Metadata/Stats.pm
  • trunk/PS-IPP-Config/lib/PS/IPP/Operations.pm

    r15645 r15677  
    11# Copyright (c) 2007  Paul Price
    22#
    3 # $Id: Operations.pm,v 1.1 2007-11-17 02:35:59 price Exp $
     3# $Id: Operations.pm,v 1.2 2007-11-22 00:33:39 price Exp $
    44
    55package PS::IPP::Operations;
     
    1212use Carp qw( carp );
    1313use IPC::Cmd 0.36 qw( can_run run );
     14use PS::IPP::Config qw( caturi );
    1415
    15 # Allow exporting of function
     16# Allow exporting of functions
    1617use base qw( Exporter );
    17 our @EXPORT_OK = qw( generate_skycells );
     18our @EXPORT_OK = qw(
     19                    skycell_file
     20                    generate_skycells
     21                    );
    1822
    1923#$::RD_TRACE = 1;
     
    2125#use Data::Dumper;
    2226
    23 # Extract skycells to images
    24 sub generate_skycells {
    25     my $ipprc = shift;          # Configuration object
    26     my $tess_ids = shift;       # List of tessellation ids
    27     my $skycell_ids = shift;    # List of skycell ids
     27sub skycell_file
     28{
     29    my $tess_id = shift;        # Tessellation identifier
     30    my $skycell_id = shift;     # Skycell identifier
    2831    my $workdir = shift;        # Working directory
    2932
    30     if (scalar @$tess_ids != scalar @$skycell_ids) {
    31         carp "Lengths of tess_id and skycell_id don't match";
     33    unless (defined $tess_id and defined $skycell_id and defined $workdir) {
     34        carp "Input parameters not defined";
     35        return 0;
     36    }
     37
     38    return caturi($workdir, "tess_" . $tess_id, "sky_" . $skycell_id, $skycell_id );
     39}
     40
     41
     42
     43# Extract skycells to images
     44sub generate_skycells
     45{
     46    my $ipprc = shift;          # Configuration object
     47    my $tess_id = shift;        # Tessellation identifier
     48    my $skycells = shift;       # List of skycell ids
     49    my $workdir = shift;        # Working directory
     50
     51    unless (defined $ipprc and defined $tess_id and defined $skycells and defined $workdir) {
     52        carp "Input parameters not defined.";
    3253        return 0;
    3354    }
     
    3859        (carp "Can't get list of tessellations." and return 0); # Hash of defined tessellations
    3960
    40     for (my $i = 0; $i < scalar @$tess_ids; $i++) {
    41         my $tess_id = $$tess_ids[$i]; # Tessellation identifier
    42         my $skycell_id = $$skycell_ids[$i]; # Skycell identifier
     61    ### Because DVO doesn't use psModules, it doesn't understand Nebulous --- check
     62    my $scheme = file_scheme($$tessellations{$tess_id}); # The scheme, e.g., file, path, neb
     63    if (defined $scheme and lc($scheme) eq 'neb') {
     64        carp "Tessellation $tess_id refers to a Nebulous path: $$tessellations{$tess_id}";
     65        return 0;
     66    }
     67   
     68    my $tess_dir = $ipprc->convert_filename_absolute( $$tessellations{$tess_id} ); # Catdir for DVO
    4369
    44         ### Because DVO doesn't use psModules, it doesn't understand Nebulous --- check
    45         my $scheme = file_scheme($$tessellations{$tess_id}); # The scheme, e.g., file, path, neb
    46         if (defined $scheme and lc($scheme) eq 'neb') {
    47             carp "Tessellation $tess_id refers to a Nebulous path: $$tessellations{$tess_id}";
    48             return 0;
    49         }
    50 
    51         my $tess_dir = $ipprc->convert_filename_absolute( $$tessellations{$tess_id} ); # Catdir for DVO
    52         my $skyDir = caturi($workdir, "tess_" . $tess_id, "sky_" . $skycell_id ); # Directory for output
    53 
     70    foreach my $skycell_id ( @$skycells ) {
    5471        # Extract the skycell to an image
    55         my $skyFile = $ipprc->file_prepare( $skycell_id, $skyDir );
     72        my $skyFile = skycell_file($tess_id, $skycell_id, $workdir);
    5673        unless ($ipprc->file_exists( $skyFile )) {
    5774            my $skyFileResolved = $ipprc->file_create( $skyFile ); # Resolved filename, for Nebulous
Note: See TracChangeset for help on using the changeset viewer.