Temporal¶
- class pyvo.registry.rtcons.Temporal(times, *, inclusive=False)[source]¶
Bases:
Constraint
A RegTAP constraint on the temporal coverage of resources.
This is a RegTAP 1.2 extension not yet available on all Registries (in 2022). Worse, not too many resources bother declaring this at this point. Until this changes, you will probably have a lot of false negatives (i.e., resources that should match but do not because they are not declaring their time coverage) if you use this constraint.
This constraint accepts astropy Time instances or pairs of Times when specifying intervals. Plain numbers will be interpreted as MJD. RegTAP uses TDB times at the solar system barycenter, and it is probably wise to relax constraints such that such details do not matter. This constraint does not attempt any conversions of time scales or reference positions.
To find resources claiming to have data for Jan 10, 2022:
>>> from pyvo import registry >>> from astropy.time import Time >>> resources = registry.Temporal(Time('2022-01-10'))
To find resources claiming to have data for some time between MJD 54130 and 54200:
>>> resources = registry.Temporal((54130, 54200))
- Parameters:
- specastropy.Time or a 2-tuple of astropy.Time-s
A point in time or time interval to cover. Plain numbers are interpreted as MJD. All resources overlapping the interval are returned.
- inclusivebool, optional
Normally, this constraint will remove all resources that do not declare their temproal coverage. Pass inclusive=True to retain these.
Attributes Summary
Methods Summary
get_search_condition
(service)Formats this constraint to an ADQL fragment.
Attributes Documentation
- takes_sequence = True¶
Methods Documentation
- get_search_condition(service)[source]¶
Formats this constraint to an ADQL fragment.
This takes the service the constraint is being executed on as an argument because constraints may be written differently depending on the service’s features or refuse to run altogether.
- Parameters:
- service
dal.tap.TAPService
The RegTAP service the query is supposed to be run on (that is relevant because we adapt to the features available on given services).
- service
- Returns:
- str
A string ready for inclusion into a WHERE clause.