Giter VIP home page Giter VIP logo

Comments (3)

MarkWieczorek avatar MarkWieczorek commented on September 26, 2024 1

It would be great to validate all the input parameters. I've tried to do this as much as possible with the various classes that we define, but the routine you are referring to is a fortran function that is called from python. That doesn't mean that its not possible to do, its just a little more complicated and would probably involve writing some kind of decorator that is applied to the wrapped function.

If anyone wants to try doing this, that would be great! The first step would probably first come up with a generic approach that works with all the various legendre function routines, as the parameters are all the same.

from shtools.

abbyazari avatar abbyazari commented on September 26, 2024

e.g. possibly something of the style of the following for now.

if not isinstance(z, (np.floating, float)):
        raise TypeError(
            "z must be a float type")
            )            

from shtools.

abbyazari avatar abbyazari commented on September 26, 2024

Thank you @MarkWieczorek! I can only think of specific fixes (e.g. check length once passed to fortran) but this is less generic than an ideal solution.

For anyone who finds this issue in the future:

  • this 'user bug' is simple to identify in hindsight (user input mistake of entering an array vs a float and expecting a matrix return rather than an array) but it can masquerade as a downstream calculation error (e.g. why is my code not predicting the right value?). Hope that saves some time for folks! :)

from shtools.

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.