13
13
from astroquery .linelists .cdms import conf
14
14
from astroquery .exceptions import InvalidQueryError , EmptyResponseError
15
15
16
+ import warnings
16
17
import re
17
18
import string
18
19
@@ -295,7 +296,7 @@ def _parse_result(self, response, *, verbose=False):
295
296
def get_species_table (self , * , catfile = 'partfunc.cat' , use_cached = True ,
296
297
catfile_url = conf .catfile_url ,
297
298
catfile2 = 'catdir.cat' , catfile_url2 = conf .catfile_url2 ,
298
- write = True ):
299
+ write_new_species_cache = True ):
299
300
"""
300
301
A directory of the catalog is found in a file called 'catdir.cat.'
301
302
@@ -308,10 +309,11 @@ def get_species_table(self, *, catfile='partfunc.cat', use_cached=True,
308
309
use_cached : bool, optional
309
310
If True, use the cached file if it exists. If False, download the
310
311
file from the CDMS server and save it to the cache (if ``write`` is set).
311
- write : bool, optional
312
- If True, and if ``use_cached`` is set, write the file to the cache. Use this
313
- option if you need to update the index from CDMS; this should be set to False
314
- for testing.
312
+ write_new_species_cache : bool, optional
313
+ If True, and if ``use_cached`` is False, write the species data
314
+ table files to the CDMS data directory. Use this option if you need
315
+ to update the index from CDMS; this should be set to False for
316
+ testing.
315
317
316
318
Returns
317
319
-------
@@ -325,6 +327,8 @@ def get_species_table(self, *, catfile='partfunc.cat', use_cached=True,
325
327
"""
326
328
327
329
if use_cached :
330
+ if write_new_species_cache :
331
+ warnings .warn ("use_cached and write_new_species_cache are both set to True; write_new_species_cache will be ignored. If you meant to update the cache, set use_cached to False." )
328
332
try :
329
333
result = ascii .read (data_path (catfile ), format = 'fixed_width' , delimiter = '|' )
330
334
result2 = ascii .read (data_path (catfile2 ), format = 'fixed_width' , delimiter = '|' )
@@ -340,7 +344,7 @@ def get_species_table(self, *, catfile='partfunc.cat', use_cached=True,
340
344
else :
341
345
result = retrieve_catfile (catfile_url )
342
346
result2 = retrieve_catfile2 (catfile_url2 )
343
- if write :
347
+ if write_new_species_cache :
344
348
result .write (data_path (catfile ), format = 'ascii.fixed_width' , delimiter = '|' , overwrite = True )
345
349
result2 .write (data_path (catfile2 ), format = 'ascii.fixed_width' , delimiter = '|' , overwrite = True )
346
350
0 commit comments