Документ взят из кэша поисковой машины. Адрес оригинального документа : http://vo.astronet.ru/cas/access.php
Дата изменения: Unknown
Дата индексирования: Mon Oct 1 19:44:07 2012
Кодировка:

Поисковые слова: seawifs
SAI CAS: Accessing SAI CAS from scripts

How to access the SAI CAS services

Contents

ConeSearch - searching the system catalogues by coordinates

Access via HTTP GET

SAI CAS ConeSearch may be accessed by a simple HTTP GET request using URL of the form

http://vo.astronet.ru/sai_cas/conesearch?RA=$RA&DEC=$DEC&SR=$radius&cat=$catalog&tab=$table&format=$format
http://vo.astronet.ru/sai_cas/conesearch?RA=$RA&DEC=$DEC&SR=$radius&cat=$catalog&tab=$table&format=$format&columns=$columns
http://vo.astronet.ru/sai_cas/conesearch?RA=$RA&DEC=$DEC&SR=$radius&cat=$catalog&tab=$table&format=$format&withdist=$withdist&NULLS=$nulls
where
  • $RA, $DEC and $radius are the coordinates of the center of field and the search radius in degrees
  • $catalog and $table are the system names of the catalogue and table you wish to search
  • $format is the output format - votable (XML-based astronomical catalogue standard) and csv (comma-separated values) formats are supported.
  • Optional arguments are
    • $columns - comma-separated list of table columns to fetch
    • $withdist - binary flag controlling whether to add the new column with distance from the center of the field to the table.
    • $nulls - If the CSV format is used then the NULL values in the output will be replaced by the value of this parameter.

System names of catalogues and their tables, as well as column names, may be fetched from the catalogue browser on our ConeSearch page.

Example code in various scripting languages are below.

Shell script :

#!/bin/sh

# M31 is at 00 42 44.31 +41 16 09.4
RA=10.684625
DEC=41.26927778

# 10 arcmin radius
radius=0.1666666667

# USNO-B1.0 Catalog
catalog=usnob1
table=main

# VOTable format
format=votable

# File to store the results
output=m31.xml

# Fetch the data using Wget downloader (http://www.gnu.org/software/wget/)
wget "http://vo.astronet.ru/sai_cas/conesearch?RA=$RA&DEC=$DEC&SR=$radius&cat=$catalog&tab=$table&format=$format" -O $output

# The same using Curl downloader (http://curl.haxx.se/)
curl "http://vo.astronet.ru/sai_cas/conesearch?RA=$RA&DEC=$DEC&SR=$radius&cat=$catalog&tab=$table&format=$format" -o $output

# The same using Lynx web browser (http://lynx.isc.org/)
lynx -dump "http://vo.astronet.ru/sai_cas/conesearch?RA=$RA&DEC=$DEC&SR=$radius&cat=$catalog&tab=$table&format=$format" > $output

Perl with LWP::Simple :

#!/usr/bin/perl -w

use LWP::Simple;

# M31 is at 00 42 44.31 +41 16 09.4
$RA = 10.684625;
$DEC = 41.26927778;

# 10 arcmin radius
$radius = 0.1666666667;

# USNO-B1.0 Catalog
$catalog = 'usnob1';
$table = 'main';

# VOTable format
$format = 'votable';

# File to store the results
$output = 'm31.xml';

# Prepare URL string
$url = "http://vo.astronet.ru/sai_cas/conesearch?RA=$RA&DEC=$DEC&SR=$radius&cat=$catalog&tab=$table&format=$format";

# Fetch data into memory
$data = LWP::Simple::get($url) or die "Can't connect SAI CAS!\n";

# Store it to local file
open FILE, ">".$output;

print FILE $data;

close FILE;

PHP with Curl module :

<?php

# M31 is at 00 42 44.31 +41 16 09.4
$RA = 10.684625;
$DEC = 41.26927778;

# 10 arcmin radius
$radius = 0.1666666667;

# USNO-B1.0 Catalog
$catalog = 'usnob1';
$table = 'main';

# VOTable format
$format = 'votable';

# File to store the results
$output = 'm31.xml';

# Prepare URL string
$url = "http://vo.astronet.ru/sai_cas/conesearch?RA=$RA&DEC=$DEC&SR=$radius&cat=$catalog&tab=$table&format=$format";

# Fetch data into memory

$handle = curl_init($url);

curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);

$data = curl_exec($handle);

curl_close($handle);

# Store it to local file
file_put_contents($output, $data);

?>

Access via Web Services

SAI CAS provides a set of web services, with WSDL description available at

http://vo.astronet.ru/axis/services/sai_cas?wsdl
The ones for performing the ConeSearch are
string getConeSearchAsString(string cat, string tab, double ra, double dec, double sr, string format)
string getConeSearchAsString(string cat, string tab, double ra, double dec, double sr, string format, int verbosity)
string getConeSearchAsString(string cat, string tab, double ra, double dec, double sr, string format, string[] columnList)
where
  • cat and tab are the system names of the catalogue and its tableto search
  • ra and dec are the coordinates of the center
  • sr is the search radius in degrees
  • format is the output format. Currently, has to be either votable or csv
  • columnList is the array of column names you wish to receive
  • verbosity is the ???

Example scripts using these services are presented below.

Bash via wsdlpull :

#!/bin/sh

# M31 is at 00 42 44.31 +41 16 09.4
RA=10.684625
DEC=41.26927778

# 10 arcmin radius
radius=0.1666666667

# USNO-B1.0 Catalog
catalog=usnob1
table=main

# VOTable format
format=votable

# File to store the results
output=m31.xml

# Fetch the data using WSDLPULL (http://wsdlpull.sourceforge.net/)
wsdl "http://vo.astronet.ru/axis/services/sai_cas?wsdl" getConeSearchAsString $catalog $table $RA $DEC $radius $format "" > $output

Perl with SOAP::Lite :

#!/usr/bin/perl -w

use SOAP::Lite;

# M31 is at 00 42 44.31 +41 16 09.4
$RA = 10.684625;
$DEC = 41.26927778;

# 10 arcmin radius
$radius = 0.1666666667;

# USNO-B1.0 Catalog
$catalog = 'usnob1';
$table = 'main';

# VOTable format
$format = 'votable';

# File to store the results
$output = 'm31.xml';

# Create client for the web service
my $service = SOAP::Lite->service("http://vo.astronet.ru/axis/services/sai_cas?wsdl");

# Request data
$data = $service->getConeSearchAsString($catalog, $table, $RA, $DEC, $radius, $format);

# Store it to local file
open FILE, ">".$output;

print FILE $data;

close FILE;

PHP with SOAP module :

<?php

# M31 is at 00 42 44.31 +41 16 09.4
$RA = 10.684625;
$DEC = 41.26927778;

# 10 arcmin radius
$radius = 0.1666666667;

# USNO-B1.0 Catalog
$catalog = 'usnob1';
$table = 'main';

# VOTable format
$format = 'votable';

# File to store the results
$output = 'm31.xml';

# Create client for the web service

$service = new SoapClient("http://vo.astronet.ru/axis/services/sai_cas?wsdl");

# Fetch the data

$data = $service->getConeSearchAsString($catalog, $table, $RA, $DEC, $radius, $format);

# Store it to local file
file_put_contents($output, $data);

?>

CrossMatch - matching user-supplied table with the system catalogue

Access via HTTP POST

SAI CAS CrossMatch may be accesses by a simple HTTP POST request at URL
http://vo.astronet.ru/sai_cas/crossmatch
with the following parameters:
  • file - file with user table to match
  • format - format of the input catalogue. Currently, has to be either VOTABLE or CSV
  • cat - system name of the catalogue to match with
  • tab - system name of the catalogue table
  • rad - cross-match radius in degrees
  • racol - name of the input table column with RA coordinate (only required for CSV format)
  • deccol - name of the input table column with Dec coordinate (only required for CSV format)

Example code in various scripting languages are below.

Perl with LWP::UserAgent and HTTP::Request::Common :

#!/usr/bin/perl

require LWP::UserAgent;
use HTTP::Request::Common;

# Filename of a table to upload
my $FILENAME = 'm31.xml';
my $FORMAT = 'VOTABLE';

# Catalogue to match with
my $CATALOG = 'xmm2p';
my $TABLE = 'main';

# Cross-match radius
my $SR = 10/3600;

# Output file
my $output = 'm31-crossmatch.xml';

my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;

# Fetch data into memory
my $response = $ua->request(POST 'http://vo.astronet.ru/sai_cas/crossmatch',
Content_Type => 'form-data',
Content => [file => [$FILENAME],
format => $FORMAT,
cat => $CATALOG,
tab => $TABLE,
rad => $SR,
]
);

if ($response->is_success) {
# Store it to local file
open FILE, ">".$output;

print FILE $response->content;

close FILE;
}
else {
die $response->status_line;
}