Coder Social home page Coder Social logo

Comments (10)

jdnc avatar jdnc commented on July 19, 2024

I could take a shot at this. One point on which I am a bit confused is that when should the astroquery.utils.progressbar.chunk_read() be preferred over the generic astropy.utils.data.get_readable_fileobj() ?

from astroquery.

keflavich avatar keflavich commented on July 19, 2024

Unfortunately, that's not entirely clear right now. I think we should rebuild astroquery.utils.progressbar to use requests, then it will be preferred over get_readable_fileobj

from astroquery.

keflavich avatar keflavich commented on July 19, 2024

I should clarify: I think we should prefer astroquery.utils.get_file_from_url over aud.get_readable_fileobj in all astroquery tools, but astroquery.utils.download_file should probably use get_readable_fileobj internally for now, with a goal to shift to a requests-based cached download tool at a later date.

from astroquery.

keflavich avatar keflavich commented on July 19, 2024

get_file_from_url should be relatively easy: I think it should be a thin wrapper around get_readable_fileobj, ideally with an option to save the file to disk somewhere (but adding this feature would require changes upstream in get_readable_fileobj so that the tempfile that is created is not deleted).

from astroquery.

keflavich avatar keflavich commented on July 19, 2024

@jdnc - please do take a shot at this! I'm not sure we'll understand all of the possible issues until there's some code in place.

from astroquery.

jdnc avatar jdnc commented on July 19, 2024

Right I am working on this right now - i.e. a generic get_file_from_url. Should we leave it to the caller to decide whether the returned object is a fitsfile, votable, etc and parse/validate it in the caller (and not here)? This is because for instance in the ned.core, an additional workaround needs to be used before the votable can be parsed correctly by astropy.io.votable. Also what about services like ukidss in which we can retrieve the url via an authenticated session request only?.

from astroquery.

keflavich avatar keflavich commented on July 19, 2024

We'll make separate functions to parse downloaded data into table/fits form, so individual functions can work around it. As for authentication, we'll need to look at that more closely... maybe the current solution is best, but perhaps there's a better way. Don't worry about that case for now.

from astroquery.

jdnc avatar jdnc commented on July 19, 2024

so I have had a first shot at righting this function. It can be found here https://gist.github.com/jdnc/1b3b41657766a5ba0cc1. Is this what was required?

from astroquery.

keflavich avatar keflavich commented on July 19, 2024

Yes, pretty much, though line 88 should probably be unindented. I think it may also be wise to have some permissions checking - perhaps wrap the whole "save" block in a try/except so that if writing to disk fails, the data is still returned and accessible

from astroquery.

jdnc avatar jdnc commented on July 19, 2024

oh! yes of course - so updated the gist anyways

from astroquery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.