Skip to content

xy2ll error in solving for rho #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
SamKodama opened this issue Nov 5, 2021 · 1 comment
Open

xy2ll error in solving for rho #3

SamKodama opened this issue Nov 5, 2021 · 1 comment

Comments

@SamKodama
Copy link

SamKodama commented Nov 5, 2021

I attempted to use the xy2ll for both MATLAB and python. I used the x and y data from the BedMachine .nc file. In both instances of running the script I ran into the errors
For Python:
ufunc 'square' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

For MATLAB:
Check for incorrect argument data type or missing argument in call to function 'sqrt'.
rho=sqrt(x.^2+y.^2);

In Python I was able to fix the issue by importing the x and y values as a dtype='int64' numpy array. Some stackoverflow searchers made it seem like the error was an integer overflow issue. However the output longitude values only varied from -45 to 135 and not -180 to 180.

Any help would be much appreciated.

@rdPatmore
Copy link

rdPatmore commented May 19, 2022

I presume you got past your issue, but adding this in case it is helpful to others.

I had the same issue here with the data type. I added a simple check to deal with the int64 issue.

I believe you're latter issue was to do with the fact that you need to use a meshgrid of x,y:

xs, ys = np.meshgrid(x, y)

and input xs, ys into the xy2ll function. Using just x and y does not capture all the combinations of x and y.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants