In previous sessions, we have learned about VO registry, Cone Search, Simple Image and Spectrum Access protocols. We have also seen web based and standalone applications that are VO-enabled. In this session, we will present an example combining different VO elements.
The Problem
Given a target, for example m8. Students can choose other targets.Retrieve optical or infrared images centered at the given target from all SIA services found in the VO registry. Image size should be 0.2x0.2 deg. Save images onto local disk.
Solution 1
Use DataScope.Solution 2
Use Python.
Step 1
Find RA/DEC for the given target using the Sesame name resolver service.$ python SesameEx.py resolve m8 m8,270.904167,-24.386667
Step 2
Query the VO registry to find all SIA services that provide optical or
infrared coverage.
For this step, we need to know the names of the columns in the database table
that we can use to build the query. Also we need to know what
the possible values for these columns are.
See http://nvo.stsci.edu/VORegistry/ListColumns.aspx for a list of column
names.
See http://nvo.stsci.edu/VORegistry/help/help.aspx#_Toc68083051
for a list of possible values.
$ python VORegistryEx.py queryResource "CoverageSpectral like '%optical%' and ResourceType like '%SIA%'" > providers
$ awk '{print $6}' providers
http://www-gsss.stsci.edu/gscvo/DSS1.jsp?FORMAT=image/fits
http://www-gsss.stsci.edu/gscvo/DSS2.jsp
http://www-gsss.stsci.edu/gscvo/DSS2B.jsp
...
Note: the awk command filters out the service URL.
Step 3
For each service URL, query the service with RA=270.904167, DEC=-24.386667 and SZ=0.2.
python SIAPEx.py siapCSV 'http://www-gsss.stsci.edu/gscvo/DSS1.jsp?FORMAT=image/fits' 270.904167 -24.386667 0.2In general, a SIA service can return any number of images that meet the request. The last command returns 2 or more lines. The first line contains the name of the columns. The remaining lines contain entries that match the query.
Since services can return columns in different orders, we need to find which columns represent the image format type and the URL to retrieve the image. For example in the last example, column 10 is the URL of the requested image.
Step 4
Once we have the URL of the images we can download them. Alternatively, we can perform the query and download the images in one step.
$ python SIAPEx.py siapImages 'http://www-gsss.stsci.edu/gscvo/DSS1.jsp?FORMAT=image/fits' 270.904167 -24.386667 0.2 0 image/fits Number of records: 1 Saving image 0 as image0.fitsThe siapImages method is similar to siapCSV, except that siapImage also retrieves the images after the query.
Alternatively, we could build a web page with URLs found in step 3. The web browser will act as the download agent. The only problem is that that fits images cannot be displayed directly with the browser. Requesting and retrieving images in JPEG format could be a solution. Unfortunately, not all SIA services offer images in JPEG.
Solution 3
Using the sample code provided in the python/samples directory
we can write a Python program combining all the steps mentioned earlier.
Alternatively, we can also use any other programming language.
In any case the steps are the same.
Variations
- Given a list of targets and the short name of a SIA service, retrieve all matching images from that service.
- Given a target and a UCD, find all catalogs that provide a column for the given UCD, and perform a cone search with each catalog.
Shui Hung Kwok
NVO Summer School 2005
