@@ -12,11 +12,11 @@ ESO Queries (`astroquery.eso`)
12
12
**The WDB (Web DataBase) API is being deprecated and replaced by TAP (Table Access Protocol) **,
13
13
a standardized interface for querying astronomical datasets using ADQL (Astronomical Data Query Language).
14
14
While the Python interface remains the same, the values accepted by the ``columns `` and ``column_filters ``
15
- parameters must reflect TAP's field names and ADQL syntax. This means that
15
+ parameters must reflect TAP field names and ADQL syntax. This means that,
16
16
although the structure of your code won't need to change, **the values you pass to the arguments **
17
17
``columns `` **and ** ``column_filters `` **must be revised ** to comply with the new format.
18
18
19
- In TAP, column_filters accepts SQL-like ADQL expressions. For example:
19
+ In TAP, `` column_filters `` accepts ADQL expressions. For example:
20
20
21
21
.. doctest-skip ::
22
22
@@ -29,6 +29,7 @@ ESO Queries (`astroquery.eso`)
29
29
}
30
30
31
31
Please review your queries carefully and update them accordingly to ensure compatibility with the new astroquery versions.
32
+ See section :ref: `column-filters-fix `
32
33
33
34
34
35
Getting started
@@ -223,12 +224,13 @@ return two columns: the date of observation and the name of the object.
223
224
224
225
.. doctest-remote-data ::
225
226
>>> table = eso.query_instrument(
226
- 'midi',
227
- column_filters={
228
- 'object':'NGC4151',
229
- 'exp_start': "between '2008-01-01' and '2009-05-12'"
230
- },
231
- columns=['object', 'date_obs'])
227
+ ... ' midi' ,
228
+ ... column_filters= {
229
+ ... ' object' :' NGC4151' ,
230
+ ... ' exp_start' : " between '2008-01-01' and '2009-05-12'"
231
+ ... },
232
+ ... columns= [' object' , ' date_obs' ]
233
+ ... )
232
234
>>> table
233
235
<Table length=196>
234
236
object date_obs
@@ -263,16 +265,13 @@ query all-sky images from APICAM with ``luminance`` filter.
263
265
264
266
>>> eso.maxrec = - 1 # Return all results
265
267
# (i.e. do not truncate the query even if it is slow)
266
- >>> table = eso.query_main(column_filters = {' instrument' : ' APICAM' ,
267
- 'filter_path': 'LUMINANCE'})
268
-
269
268
>>> table = eso.query_main(
270
- column_filters={
271
- 'instrument': 'APICAM',
272
- 'filter_path': 'LUMINANCE',
273
- 'exp_start': "between '2019-04-26' and '2019-04-27'"
274
- }
275
- )
269
+ ... column_filters= {
270
+ ... ' instrument' : ' APICAM' ,
271
+ ... ' filter_path' : ' LUMINANCE' ,
272
+ ... ' exp_start' : " between '2019-04-26' and '2019-04-27'"
273
+ ... }
274
+ ... )
276
275
>>> print (len (table))
277
276
215
278
277
>>> print (table.columns)
@@ -361,12 +360,11 @@ This method is detailed in the example below.
361
360
.. doctest-remote-data ::
362
361
363
362
>>> table = eso.query_instrument(' midi' ,
364
- column_filters={
365
- 'object': 'NGC4151',
366
- 'date_obs': "<='2008-01-01'"
367
- },
368
- columns=['object', 'date_obs', 'dp_id'])
369
-
363
+ ... column_filters= {
364
+ ... ' object' : ' NGC4151' ,
365
+ ... ' date_obs' : " <='2008-01-01'"
366
+ ... },
367
+ ... columns= [' object' , ' date_obs' , ' dp_id' ])
370
368
>>> table_headers = eso.get_headers(table[" dp_id" ])
371
369
>>> len (table_headers.columns)
372
370
336
@@ -431,6 +429,9 @@ in the call to :meth:`~astroquery.eso.EsoClass.retrieve_data`.
431
429
Troubleshooting
432
430
===============
433
431
432
+ Clearing the cache
433
+ ------------------
434
+
434
435
If you are repeatedly getting failed queries, or bad/out-of-date results, try clearing your cache:
435
436
436
437
.. code-block :: python
@@ -441,6 +442,52 @@ If you are repeatedly getting failed queries, or bad/out-of-date results, try cl
441
442
If this function is unavailable, upgrade your version of astroquery.
442
443
The ``clear_cache `` function was introduced in version 0.4.7.dev8479.
443
444
445
+ .. _column-filters-fix :
446
+
447
+ Using the correct ``column_filters ``
448
+ ------------------------------------
449
+
450
+ Two concrete and relevant examples of fields present in WDB but not present in TAP/ADQL
451
+ are ``stime `` and ``etime ``. The following snippet shows how to adapt the filters to
452
+ the TAP / ADQL syntax:
453
+
454
+ .. doctest-skip ::
455
+
456
+ # The following filters won't work:
457
+ column_filters = {
458
+ 'stime': '2024-01-01'
459
+ 'etime': '2024-12-31'
460
+ }
461
+
462
+ # Replace by:
463
+ column_filters = {
464
+ 'exp_start': "between '2024-01-01' and '2024-12-31'"
465
+ }
466
+
467
+ # --- #
468
+
469
+ # The following filters won't work:
470
+ column_filters = {
471
+ 'stime': '2024-01-01'
472
+ }
473
+
474
+ # Replace by:
475
+ column_filters = {
476
+ 'exp_start': "> '2024-01-01'"
477
+ }
478
+
479
+ # --- #
480
+
481
+ # The following filters won't work:
482
+ column_filters = {
483
+ 'etime': '2024-12-31'
484
+ }
485
+
486
+ # Replace by:
487
+ column_filters = {
488
+ 'exp_start': "< '2024-12-31'"
489
+ }
490
+
444
491
445
492
Reference/API
446
493
=============
0 commit comments