Accessing GSA Data from Scripts
Gemini files can be retrieved directly from your scripts by using
a URL's of the form "http://www.cadc.hia.nrc.gc.ca/getData?"
for public data or "http://www.cadc.hia.nrc.gc.ca/getData/auth?"
for proprietary datasets (with the appropriate authorization passed as
parameters - see below). Note that Gemini files are stored in gzipped format
so either form of the getData URL will return a compressed file.
For example, below is a trivial PERL script that retrieves three public files
from the GSA:
#!/usr/bin/env perl
use strict;
my @files = ( "S20070408S0107", "S20070408S0106", "S20070407S0066" );
my $baseUrl = "http://www.cadc.hia.nrc.gc.ca/getData";
my ( $fileId );
foreach $fileId (@files)
{
`curl -g -o $fileId.fits.gz "$baseUrl?archive=GEMINI\&file_id=$fileId"`;
}
exit();
You can also retrieve proprietary files (if you have authorization!) by
modifying this basic script as shown below. Note the "auth"
appended to $baseURL as well as the use of your CADC user account
information.
#!/usr/bin/env perl
use strict;
my $baseUrl = "http://www.cadc.hia.nrc.gc.ca/getData/auth";
my $cadcUserId = "dbohlender"; # Your CADC user ID
my $passWord = "????????"; # Your CADC account password
my @files = ( "N20081011S0191", "N20081011S0190", "N20081010S0545" );
my ( $fileId );
foreach $fileId (@files)
{
`curl -g -o $fileId.fits.gz -u $cadcUserId:$passWord
"$baseUrl?archive=GEMINI\&file_id=$fileId\&user=$cadcUserId\&password=$passWord"`;
}
exit();
You can find more details and other examples of "getData" usage, including
retrieval of FITS header content, here.
|