Skip to content

Commit

Permalink
remove caching or disk fills up
Browse files Browse the repository at this point in the history
  • Loading branch information
djones1040 committed Nov 16, 2023
1 parent 2f16f36 commit 52d0373
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions app/host/cutouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def panstarrs_cutout(position, image_size=None, filter=None):
f"{service}ra={position.ra.degree}&dec={position.dec.degree}"
f"&size={image_size}&format=fits&red={filename}"
)
fits_image = fits.open(fits_url)
fits_image = fits.open(fits_url,cache=None)
else:
fits_image = None

Expand Down Expand Up @@ -240,7 +240,8 @@ def galex_cutout(position, image_size=None, filter=None):
.replace("-gsp.fits.gz", "-int.fits.gz")
.replace("-rr.fits.gz", "-int.fits.gz")
.replace("-cnt.fits.gz", "-int.fits.gz")
.replace("-xd-mcat.fits.gz", f"-{filter[0].lower()}d-int.fits.gz")
.replace("-xd-mcat.fits.gz", f"-{filter[0].lower()}d-int.fits.gz"),
cache=None
)

wcs = WCS(fits_image[0].header)
Expand Down Expand Up @@ -301,7 +302,7 @@ def WISE_cutout(position, image_size=None, filter=None):
exptime = data["t_exptime"][0]

if url is not None:
fits_image = fits.open(url)
fits_image = fits.open(url,cache=None)

wcs = WCS(fits_image[0].header)
cutout = Cutout2D(fits_image[0].data, position, image_size, wcs=wcs)
Expand Down Expand Up @@ -348,15 +349,15 @@ def DES_cutout(position, image_size=None, filter=None):
# we need both the depth and the image
time.sleep(1)
try:
fits_image = fits.open(valid_urls[0].replace("-depth-", "-image-"))
fits_image = fits.open(valid_urls[0].replace("-depth-", "-image-"),cache=None)
except:
### found some bad links...
return None
if np.shape(fits_image[0].data)[0] == 1 or np.shape(fits_image[0].data)[1] == 1:
# no idea what's happening here but this is a mess
return None

depth_image = fits.open(valid_urls[0])
depth_image = fits.open(valid_urls[0],cache=None)
wcs_depth = WCS(depth_image[0].header)
xc, yc = wcs_depth.wcs_world2pix(position.ra.deg, position.dec.deg, 0)

Expand Down Expand Up @@ -403,7 +404,7 @@ def TWOMASS_cutout(position, image_size=None, filter=None):
if re.match(f"https://irsa.*{filter.lower()}i.*fits", line.split("]]>")[0]):
fitsurl = line.split("]]")[0]

fits_image = fits.open(fitsurl)
fits_image = fits.open(fitsurl,cache=None)
wcs = WCS(fits_image[0].header)

if position.contained_by(wcs):
Expand Down Expand Up @@ -482,7 +483,7 @@ def SDSS_cutout(position, image_size=None, filter=None):
band=filter,
)

fits_image = fits.open(link)
fits_image = fits.open(link,cache=None)

wcs = WCS(fits_image[0].header)
cutout = Cutout2D(fits_image[0].data, position, image_size, wcs=wcs)
Expand Down

0 comments on commit 52d0373

Please sign in to comment.