@@ -294,7 +294,8 @@ def _parse_result(self, response, *, verbose=False):
294
294
295
295
def get_species_table (self , * , catfile = 'partfunc.cat' , use_cached = True ,
296
296
catfile_url = conf .catfile_url ,
297
- catfile2 = 'catdir.cat' , catfile_url2 = conf .catfile_url2 ):
297
+ catfile2 = 'catdir.cat' , catfile_url2 = conf .catfile_url2 ,
298
+ write = True ):
298
299
"""
299
300
A directory of the catalog is found in a file called 'catdir.cat.'
300
301
@@ -304,6 +305,13 @@ def get_species_table(self, *, catfile='partfunc.cat', use_cached=True,
304
305
----------
305
306
catfile : str, name of file, default 'catdir.cat'
306
307
The catalog file, installed locally along with the package
308
+ use_cached : bool, optional
309
+ If True, use the cached file if it exists. If False, download the
310
+ 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.
307
315
308
316
Returns
309
317
-------
@@ -332,8 +340,9 @@ def get_species_table(self, *, catfile='partfunc.cat', use_cached=True,
332
340
else :
333
341
result = retrieve_catfile (catfile_url )
334
342
result2 = retrieve_catfile2 (catfile_url2 )
335
- result .write (data_path (catfile ), format = 'ascii.fixed_width' , delimiter = '|' , overwrite = True )
336
- result2 .write (data_path (catfile2 ), format = 'ascii.fixed_width' , delimiter = '|' , overwrite = True )
343
+ if write :
344
+ result .write (data_path (catfile ), format = 'ascii.fixed_width' , delimiter = '|' , overwrite = True )
345
+ result2 .write (data_path (catfile2 ), format = 'ascii.fixed_width' , delimiter = '|' , overwrite = True )
337
346
338
347
merged = table .join (result , result2 , keys = ['tag' ])
339
348
if not all (merged ['#lines' ] == merged ['# lines' ]):
0 commit comments