Skip to content

Commit 213a0cd

Browse files
committed
the warning approach didn't really make sense, it was just 'extra security' to prevent overwriting, but that's not needed
1 parent 650e2eb commit 213a0cd

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

astroquery/linelists/cdms/core.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from astroquery.linelists.cdms import conf
1414
from astroquery.exceptions import InvalidQueryError, EmptyResponseError
1515

16-
import warnings
1716
import re
1817
import string
1918

@@ -296,7 +295,7 @@ def _parse_result(self, response, *, verbose=False):
296295
def get_species_table(self, *, catfile='partfunc.cat', use_cached=True,
297296
catfile_url=conf.catfile_url,
298297
catfile2='catdir.cat', catfile_url2=conf.catfile_url2,
299-
write_new_species_cache=True):
298+
write_new_species_cache=False):
300299
"""
301300
A directory of the catalog is found in a file called 'catdir.cat.'
302301
@@ -308,12 +307,13 @@ def get_species_table(self, *, catfile='partfunc.cat', use_cached=True,
308307
The catalog file, installed locally along with the package
309308
use_cached : bool, optional
310309
If True, use the cached file if it exists. If False, download the
311-
file from the CDMS server and save it to the cache (if ``write`` is set).
310+
file from the CDMS server and save it to the cache if
311+
``write_new_species_cache`` is set.
312312
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.
313+
*Overrides ``use_cached=True``*.
314+
If True, write the species data table files to the CDMS data
315+
directory. Use this option if you need to update the index from
316+
CDMS; this should be set to False for testing.
317317
318318
Returns
319319
-------
@@ -326,9 +326,7 @@ def get_species_table(self, *, catfile='partfunc.cat', use_cached=True,
326326
327327
"""
328328

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.")
329+
if use_cached and not write_new_species_cache:
332330
try:
333331
result = ascii.read(data_path(catfile), format='fixed_width', delimiter='|')
334332
result2 = ascii.read(data_path(catfile2), format='fixed_width', delimiter='|')

astroquery/linelists/cdms/tests/test_cdms_remote.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def test_complex_molecule_remote():
113113

114114
@pytest.mark.remote_data
115115
def test_retrieve_species_table():
116-
species_table = CDMS.get_species_table(use_cached=False, write=False)
116+
species_table = CDMS.get_species_table(use_cached=False, write_new_species_cache=False)
117117
# as of 2025/01/16
118118
assert len(species_table) >= 1293
119119
assert 'int' in species_table['tag'].dtype.name
@@ -127,7 +127,7 @@ def test_regression_allcats():
127127
"""
128128
Expensive test - try all the molecules
129129
"""
130-
species_table = CDMS.get_species_table(write=False)
130+
species_table = CDMS.get_species_table(write_new_species_cache=False)
131131
for row in species_table:
132132
tag = f"{row['tag']:06d}"
133133
result = CDMS.get_molecule(tag)

0 commit comments

Comments
 (0)