Accessing GSA Data from Scripts
Gemini files (as well as data from other CADC collections) can be retrieved directly from your
scripts by using a URL of the form "http://www.cadc.hia.nrc.gc.ca/data/pub".
If files are proprietary this URL is redirected to one of the form "http://www.cadc.hia.nrc.gc.ca/data/auth" and
you will be prompted for your CADC user ID and password if you use such a URL
from a web browser. Alternatively, you will need to include authentication in a curl command.
Note that Gemini files are stored in gzipped format
so this URL will return a compressed file.
For example, below is a simple PERL script that retrieves three public files
from the GSA. Note that files are identified by their original FITS file name,
not the Gemini 'OBSID' contained in the FITS header:
#!/usr/bin/env perl
use strict;
my @files = ( "S20070408S0107", "S20070408S0106", "S20070407S0066" );
my $baseUrl = "http://www.cadc.hia.nrc.gc.ca/data/pub";
my ( $fileId );
foreach $fileId (@files)
{
`curl --location-trusted -g -o $fileId.fits.gz "$baseUrl/GEMINI/$fileId"`;
}
exit();
You can also retrieve proprietary files (if you have authorization!) by
modifying this basic script as shown below. Note the use of your CADC
user account information.
#!/usr/bin/env perl
use strict;
my $baseUrl = "http://www.cadc.hia.nrc.gc.ca/data/pub";
my $cadcUserId = "dbohlender"; # Your CADC user ID
my $passWord = "????????"; # Your CADC account password
my @files = ( "N20081011S0191", "N20081011S0190", "N20081010S0545" );
my ( $fileId );
foreach $fileId (@files)
{
`curl --location-trusted -g -o $fileId.fits.gz -u $cadcUserId:$passWord "$baseUrl/GEMINI/$fileId"`;
}
exit();
You can find more details and other examples of the CADC Data Web Service
here.
|