@@ -184,7 +184,7 @@ def _parse_extensions(infile_exts, infile_name, user_exts):
184184
185185def fits_cut (input_files , coordinates , cutout_size , correct_wcs = False , extension = None ,
186186 single_outfile = True , cutout_prefix = "cutout" , output_dir = '.' ,
187- memory_only = False , verbose = False , fsspec_kwargs = { "anon" : True } ):
187+ memory_only = False , verbose = False ):
188188 """
189189 Takes one or more fits files with the same WCS/pointing, makes the same cutout in each file,
190190 and returns the result either in a single FITS file with one cutout per extension or in
@@ -270,19 +270,16 @@ def fits_cut(input_files, coordinates, cutout_size, correct_wcs=False, extension
270270 cutout_hdu_dict = {}
271271 num_empty = 0
272272 num_cutouts = 0
273+ fsspec_kwargs = None
273274 for in_fle in input_files :
274275 if verbose :
275276 print ("\n Cutting out {}" .format (in_fle ))
276277
277- u_fsspec = None
278- fsspec_kw = None
279-
280- if "s3://" or "gs://" in in_fle :
281- u_fsspec = True
282- fsspec_kw = fsspec_kwargs
278+ if "s3://" in in_fle :
279+ fsspec_kwargs = {"anon" : True }
283280
284281 warnings .filterwarnings ("ignore" , category = wcs .FITSFixedWarning )
285- with fits .open (in_fle , mode = 'denywrite' , memmap = True , use_fsspec = u_fsspec , fsspec_kwargs = fsspec_kw ) as hdulist :
282+ with fits .open (in_fle , mode = 'denywrite' , memmap = True , fsspec_kwargs = fsspec_kwargs ) as hdulist :
286283
287284 # Sorting out which extension(s) to cutout
288285 all_inds = np .where ([x .is_image and (x .data is not None ) for x in hdulist ])[0 ]
0 commit comments