The [web interface](https://vo-tap.oma.be/rob_spoca_ch/q/spoca_ch_dr/form) allows to do some simple search on the time of detection of the Coronal Hole.
For a programming interface, it is recommended to use the [TAP protocol](https://vo-tap.oma.be/tap). Below we give some examples on how to achieve this in Python using the [PyVO library](https://pyvo.readthedocs.io/en/latest/).
### Example 1 : Find the size of 10 random coronal holes
```
from pyvo.dal import tap
TAP_SERVICE_URL = 'https://vo-tap.oma.be/tap'
query = 'SELECT TOP 10 * FROM rob_spoca_ch.epn_core'
results = tap.search(TAP_SERVICE_URL, query)
# Print the number of results returned
print(len(results))
# Print the size of the CH in arcsec²
for result in results:
print(result['ch_area_projected'])
```
### Example 2: Find coronal holes between 2 dates
```
from pyvo.dal import tap
from astropy.time import Time
TAP_SERVICE_URL = 'https://vo-tap.oma.be/tap'
# The columns time_min and time_max are in Julian days, so we must convert the dates
start_date = Time('2020-01-01 00:00:00Z')
end_date = Time('2020-01-01 12:00:00Z')
query = 'SELECT time_min FROM rob_spoca_ch.epn_core WHERE time_min >= %s AND time_max < %s' % (start_date.to_value('jd'), end_date.to_value('jd'))
results = tap.search(TAP_SERVICE_URL, query)
# Print the time of detection of the CH
# In TAP, times are are specified in Julian Day, so convert it to datetime
for result in results:
print(Time(result['time_min'], format='jd').datetime)
```
### Example 3: Find the Carrington longitude of the centroid of a specific coronal hole through time
```
from pyvo.dal import tap
from astropy.time import Time
from astropy import units as u
from sunpy.coordinates import HeliographicStonyhurst, Helioprojective, frames
TAP_SERVICE_URL = 'https://vo-tap.oma.be/tap'
# Find all the detections for the Coronal hole with granule_gid 3770
query = "SELECT * from rob_spoca_ch.epn_core WHERE granule_gid = 'spoca_coronalhole_3770' ORDER BY time_min"
results = tap.search(TAP_SERVICE_URL, query)
# In TAP, the coordinates of the centroid are specified in Helioprojective
# so convert them to Heliographic coordinates
for result in results:
obstime = Time(result["time_min"], format="jd").to_datetime()
observer = HeliographicStonyhurst(
result["subobserver_longitude_min"] * u.deg,
result["subobserver_latitude_min"] * u.deg,
result["target_distance_min"] * u.km,
obstime=obstime,
)
centroid_in_helioprojective = Helioprojective(
result['ch_c1_centroid'] * u.deg,
result['ch_c2_centroid'] * u.deg,
observer=observer,
)
centroid_in_heliographic = centroid_in_helioprojective.transform_to(
frames.HeliographicCarrington(obstime=obstime, observer='earth')
)
print(centroid_in_heliographic.lon.deg)
```