Giter Site home page Giter Site logo

Comments (6)

dbyrns avatar dbyrns commented on August 15, 2024

You should check this function written by Blaise : https://github.com/Ouranosinc/flyingpigeon/blob/master/flyingpigeon/utils.py#L59

from finch.

davidcaron avatar davidcaron commented on August 15, 2024

The problem with doing a try/except is that when the url is not an Opendap url, it takes a second or 2 to raise an IOError. Also, I tried it a while ago and when it's not an opendap url it crashed the interpreter without raising an error... It may have had to do with my installation of netcdf, I'm not sure.

But the netCDF4 library doesn't seem to support constraint expressions, as pointed out by #20.

Knowing the structure of a constraint expression, (it seems to be located only in query parameters) we can still use the technique of appending any standard opendap suffix to the url (.dds, .das, .ver, ...) by removing the query string. But that url will still be passed to xarray or netcdf4, and it won't work unless we implement #20. So these 2 issues are related.

from finch.

huard avatar huard commented on August 15, 2024

Got bit by this recently. Can it be dealt with client-side ? The client could then pass the mimetype of the input, and then we would not have to guess server-side.

from finch.

davidcaron avatar davidcaron commented on August 15, 2024

What was the url you sent to the server?

from finch.

davidcaron avatar davidcaron commented on August 15, 2024

I did a quick research, and I think that if we make a HEAD request to the url, the Content-Description header should always start with dods if it's an opendap url.

Check the section 7.1.1 at: https://www.opendap.org/pdf/ESE-RFC-004v1.2.pdf

Edit: I also found this:

Theres an ambiguity as to whether http://server/something is an OPeNDAP or an HTTP remote file using range requests. There will be more ambiguities in the future, as other HTTP based protocols are added. Currently we do a HEAD request on http://server/something.dds, and if it succeeds, and returns a header Content-Description="dods-dds" or "dods_dds", then we open as OPeNDAP, and if it fails we try opening as an HTTP file.

https://www.unidata.ucar.edu/software/netcdf-java/current/reference/DatasetUrls.html

So I think this is the way to go.

from finch.

huard avatar huard commented on August 15, 2024

It was a THREDDS DAP url but starting with http. I had to write href=http... for pywps to recognize it as URL and not as data, but that may be a quirk of pywps.

from finch.

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.