org.astrogrid.acr.astrogrid
Interface Stap

All Superinterfaces:
Dal

public interface Stap
extends Dal

AR Service: Query for Time series data from Simple Time Access Protocol (STAP) services (DAL).

Note:

This class provides functions to construct a DAL query. To execute that query, see the examples and methods in the Dal class.

Example

The following example constructs a queryURL, performs the query, and then downloads the first of the resulting datasets. See Dal for other things that can be done with a query URL.

Query a Stap service and download a subset of the data (Python)

# connect to the AR
from xmlrpc import Server, DateTime
from os.path import expanduser
ar = Server(file(expanduser('~/.astrogrid-desktop')).next().strip() +'xmlrpc')        
stap = ar.ivoa.stap #take a reference to the AR STAP component

#the STAP service to query (selected using voexplorer)
service = "ivo://mssl.ucl.ac.uk/stap-lasco"

#build a query
start = DateTime('20000101T00:00:00')
end = DateTime('20000102T00:00:00')
query = stap.constructQuery(service,start,end)
print "QueryURL",query

#execute the query
rows = stap.execute(query)

#inspect what we've got.
print "Rows Returned",len(rows)
import pprint
pprint.pprint(rows[0])


#download first datasets into current directory
#compute url for current directory
from urlparse import urlunsplit
from os import getcwd
currentDirURL = urlunsplit(['file','',getcwd(),'',''])
print "Downloading data to",currentDirURL
stap.saveDatasetsSubset(query,currentDirURL,[0])
The output from this script is shown below.
 QueryURL http://msslxx.mssl.ucl.ac.uk:8080/stap-lasco/StapSearch?service=astrogrid_stap&START=2000-01-01T00%3A00%3A00&END=2000-01-02T00%3A00%3A00
Rows Returned 3
{'Concept': ' Coronal Mass Ejection',
 'Contact Email': ' eca@mssl.ucl.ac.uk',
 'Contact Name': ' Elizabeth Auden',
 'INST_ID': 'SOHO_LASCO',
 'IVORN': 'ivo://mssl.ucl.ac.uk/LASCO#LASCO20000101T065405_21',
 'Name': ' LASCO_20000101T065405_21',
 'Parameters': '  Central Position Angle=21 deg, Angular Width=76 deg, Linear Speed=337 km/s, Acceleration=8.8 m/s^2, Mass=5.0e+15 g, Kinetic Energy=2.8e+30 erg, Measurement Position Angle=11 deg',
 'References': '  C2 movie=http://lasco-www.nrl.navy.mil/daily_mpg/2000_01/000101_c2.mpg, C3 movie=http://lasco-www.nrl.navy.mil/daily_mpg/2000_01/000101_c3.mpg, SXT movie=http://cdaw.gsfc.nasa.gov/CME_list/daily_mpg/2000_01/sxt_almg.20000101.mpg, PHTX movie=http://cdaw.gsfc.nasa.gov/CME_list/daily_plots/sephtx/2000_01/sephtx.20000101.png, Java movie=http://cdaw.gsfc.nasa.gov/CME_list/daily_movies/2000/01/01, C2 movie / GOES light curve=http://cdaw.gsfc.nasa.gov/CME_list/UNIVERSAL/2000_01/jsmovies/2000_01/20000',
 'VOX:AccessReference': ' http://msslxx.mssl.ucl.ac.uk:8080/voevent/xml/LASCO/LASCO_20000101T065405_21.xml',
 'VOX:Format': 'VOEVENT',
 'meta': 'LASCO CME VOEvents',
 'meta.curation': 'CDAW (NASA/Goddard), via MSSL query',
 'meta.ref.url': 'http://cdaw.gsfc.nasa.gov/CME_list/',
 'meta.title': 'LASCO CMEs',
 'time.obs.end': '2000-01-01T06:54:05',
 'time.obs.start': '2000-01-01T06:54:05'}
Downloading data to file:///Users/noel/Documents/workspace/python
 

See Also:
Proposed STAP Standard, Dal, Sesame - resolves object names to RA,Dec positions, getRegistryXQuery() - a query to list all STAP Services.
Service Name
astrogrid.stap

Method Summary
 URL constructQuery(URI service, Date start, Date end)
          Construct a STAP Query on Time.
 URL constructQueryF(URI service, Date start, Date end, String format)
          Construct a STAP Query on Time and Format.
 URL constructQueryP(URI service, Date start, Date end, double ra, double dec, double size)
          Construct a STAP Query on Time and Position
 URL constructQueryPF(URI service, Date start, Date end, double ra, double dec, double size, String format)
          Construct a STAP Query on Time, Position and Format
 URL constructQueryS(URI service, Date start, Date end, double ra, double dec, double ra_size, double dec_size)
          Construct a STAP Query on Time and full Position
 URL constructQuerySF(URI service, Date start, Date end, double ra, double dec, double ra_size, double dec_size, String format)
          Construct a STAP Query on Time, full Position, and Format
 
Methods inherited from interface org.astrogrid.acr.ivoa.Dal
addOption, execute, executeAndSave, executeVotable, getRegistryQuery, getRegistryXQuery, saveDatasets, saveDatasetsSubset
 

Method Detail

constructQuery

URL constructQuery(URI service,
                   Date start,
                   Date end)
                   throws InvalidArgumentException,
                          NotFoundException
Construct a STAP Query on Time.

Parameters:
service - Resource Identifier or URL of the Service to query. Prefer providing a Resource Identifier, as this insulates against changes in service endpoint.
Resource Identifier
The resource ID of the STAP service to query, as returned by Resource.getId(). Example: ivo://mssl.ucl.ac.uk/stap-hinode-eis_2
The Registry will be queried to resolve the resource ID into a Resource object, from which the StapCapability will be found, from which in turn the first AccessURL will be used.
URL of the Service
The endpoint URL. Can be any http:// URL.
start - start date and time
end - end date and time
Returns:
A query URL. The query can then be performed by either
Throws:
InvalidArgumentException - if service is not a http:// or ivo:// reference
NotFoundException - if the service does not exist (i.e. cannot be resolved in registry)

constructQueryF

URL constructQueryF(URI service,
                    Date start,
                    Date end,
                    String format)
                    throws InvalidArgumentException,
                           NotFoundException
Construct a STAP Query on Time and Format.

Parameters:
service - Resource Identifier or URL of the Service to query. Prefer providing a Resource Identifier, as this insulates against changes in service endpoint.
Resource Identifier
The resource ID of the STAP service to query, as returned by Resource.getId(). Example: ivo://mssl.ucl.ac.uk/stap-hinode-eis_2
The Registry will be queried to resolve the resource ID into a Resource object, from which the StapCapability will be found, from which in turn the first AccessURL will be used.
URL of the Service
The endpoint URL. Can be any http:// URL.
start - start date and time
end - end date and time
format - format of images or time series data e.g. ALL
Returns:
A query URL. The query can then be performed by either
Throws:
InvalidArgumentException - if service is not a http:// or ivo:// reference
NotFoundException - if the service does not exist (i.e. cannot be resolved in registry)

constructQueryP

URL constructQueryP(URI service,
                    Date start,
                    Date end,
                    double ra,
                    double dec,
                    double size)
                    throws InvalidArgumentException,
                           NotFoundException
Construct a STAP Query on Time and Position

Parameters:
service - Resource Identifier or URL of the Service to query. Prefer providing a Resource Identifier, as this insulates against changes in service endpoint.
Resource Identifier
The resource ID of the STAP service to query, as returned by Resource.getId(). Example: ivo://mssl.ucl.ac.uk/stap-hinode-eis_2
The Registry will be queried to resolve the resource ID into a Resource object, from which the StapCapability will be found, from which in turn the first AccessURL will be used.
URL of the Service
The endpoint URL. Can be any http:// URL.
start - start date and time
end - end date and time
ra - right ascension e.g 6.950
dec - declination e.g. -1.6
size - radius of cone e.g. 0.1
Returns:
A query URL. The query can then be performed by either
Throws:
InvalidArgumentException - if service is not a http:// or ivo:// reference
NotFoundException - if the service does not exist (i.e. cannot be resolved in registry)

constructQueryPF

URL constructQueryPF(URI service,
                     Date start,
                     Date end,
                     double ra,
                     double dec,
                     double size,
                     String format)
                     throws InvalidArgumentException,
                            NotFoundException
Construct a STAP Query on Time, Position and Format

Parameters:
service - Resource Identifier or URL of the Service to query. Prefer providing a Resource Identifier, as this insulates against changes in service endpoint.
Resource Identifier
The resource ID of the STAP service to query, as returned by Resource.getId(). Example: ivo://mssl.ucl.ac.uk/stap-hinode-eis_2
The Registry will be queried to resolve the resource ID into a Resource object, from which the StapCapability will be found, from which in turn the first AccessURL will be used.
URL of the Service
The endpoint URL. Can be any http:// URL.
start - start date and time
end - end date and time
ra - right ascension e.g 6.950
dec - declination e.g. -1.6
size - radius of cone e.g. 0.1
format - format of images or time series data e.g. ALL
Returns:
A query URL. The query can then be performed by either
Throws:
InvalidArgumentException - if service is not a http:// or ivo:// reference
NotFoundException - if the service does not exist (i.e. cannot be resolved in registry)

constructQueryS

URL constructQueryS(URI service,
                    Date start,
                    Date end,
                    double ra,
                    double dec,
                    double ra_size,
                    double dec_size)
                    throws InvalidArgumentException,
                           NotFoundException
Construct a STAP Query on Time and full Position

Parameters:
service - Resource Identifier or URL of the Service to query. Prefer providing a Resource Identifier, as this insulates against changes in service endpoint.
Resource Identifier
The resource ID of the STAP service to query, as returned by Resource.getId(). Example: ivo://mssl.ucl.ac.uk/stap-hinode-eis_2
The Registry will be queried to resolve the resource ID into a Resource object, from which the StapCapability will be found, from which in turn the first AccessURL will be used.
URL of the Service
The endpoint URL. Can be any http:// URL.
start - start date and time
end - end date and time
ra - right ascension e.g 6.950
dec - declination e.g. -1.6
ra_size - size of ra e.g. 0.1
dec_size - size of dec e.g. 0.2
Returns:
A query URL. The query can then be performed by either
Throws:
InvalidArgumentException - if service is not a http:// or ivo:// reference
NotFoundException - if the service does not exist (i.e. cannot be resolved in registry)

constructQuerySF

URL constructQuerySF(URI service,
                     Date start,
                     Date end,
                     double ra,
                     double dec,
                     double ra_size,
                     double dec_size,
                     String format)
                     throws InvalidArgumentException,
                            NotFoundException
Construct a STAP Query on Time, full Position, and Format

Parameters:
service - Resource Identifier or URL of the Service to query. Prefer providing a Resource Identifier, as this insulates against changes in service endpoint.
Resource Identifier
The resource ID of the STAP service to query, as returned by Resource.getId(). Example: ivo://mssl.ucl.ac.uk/stap-hinode-eis_2
The Registry will be queried to resolve the resource ID into a Resource object, from which the StapCapability will be found, from which in turn the first AccessURL will be used.
URL of the Service
The endpoint URL. Can be any http:// URL.
start - start date and time
end - end date and time
ra - right ascension e.g 6.950
dec - declination e.g. -1.6
ra_size - size of ra e.g. 0.1
dec_size - size of dec e.g. 0.2
format - format of images or time series data e.g. ALL
Returns:
A query URL. The query can then be performed by either
Throws:
InvalidArgumentException - if service is not a http:// or ivo:// reference
NotFoundException - if the service does not exist (i.e. cannot be resolved in registry)


Copyright © 2002-2010 AstroGrid. All Rights Reserved.