Legacy survey cutouts

Hi,

I am currently trying to retrieve legacy survey cutouts for a list of source coordinates. They’re all low redshift galaxy coordinates which means very few of the cutouts have quite big sizes (around 1000 x 1000 pixels).

Currently I’m getting cutouts using the example on the legacy survey page which is to use a url of the form: https://www.legacysurvey.org/viewer/fits-cutout”f"?ra={ra}&dec={dec}&layer=ls-dr10&bands=g&pixscale=0.262&size=1024&invvar"
)

this works fine (though it does take a while) when getting an image cutout of the galaxy and I am doing one band at a time (instead of multiple bands in a single FITS file). However, I also need the inverse variance maps and adding &invvar to the above, for only the largest cutouts in my sample), causes the request to time out resulting in an image thats fine but a corrupt inverse variance map extension in the FITS file.

sometimes rerunning the code again helps to fix this issue (again, however, taking a slow download time). But I was wondering if there was a better option to do the above? i.e get the image and weight maps in another way that is quicker/avoids the download crashing. For example, is there a way to adapt the url so I can simply pull only the weight maps for the same object coords above? then I can get images and weight maps separately instead of loading the url to do both at once?

any advice would be appreciated.

on a separate note, could it be possible to confirm that using DR10 in the above still pulls images for things in the northern part of the sky but under the hood this is defaulting to DR9? (instead of just not finding an image without having to physically change the version to DR9 in the url).

Thank you

sorry for my slow reply - super busy week. I will try to address your questions on Friday! Apologies

Thank you!! no rush at all!

Yes, DR10 pulls in DR9-north.

Do you know what is timing out, and how long the timeout is? ie, is it your downloading client that is giving up, or is the server closing the connection?

Typically, it’s a good idea to download stuff to a .tmp file and then only rename it to its final filename if the download succeeds. Then you know that if the file has the right name that it’s complete.

Currently there isn’t a way to get the invvar separate from the image pixels.

It sounds like you are not getting HTTP error codes, you are getting downloads timing out. We do have rate limiting, but that should give you an HTTP 429 error.

cheers,

dustin