-
Notifications
You must be signed in to change notification settings - Fork 416
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
cast angle_to_direction to input array type #3444
Comments
My two cents on how I would like this function to be written if I were to modernize angle_to_direction. Function can take a single value (str, int, float e.g. "90", 90, 90.), a list, list of lists, numpy array, dask array or xarray dataarray. Internally the input gets cast to an xarray dataarray. There are functions that are called using a look up of n categorial (4, 8, 16 directions) and short text ("E") or full text ("East"). The function is vectorized and passed to Lastly it returns same dtype as input I ended up doing something like below for my need:
|
How can it return the same dtype as input if it's going from numeric to str? There's definitely a nice world where lots of MetPy functions work as callables for
So right now, we are the opposite, instead of "internally the input gets cast to an xarray dataarray", we take dataarrays and cast them to numpy + units, and translate on the way out. Now, as far as I can tell, that should still accomplish what you're looking for, so I'm curious what problem you saw that made your solution in #3445 unworkable? |
Now at #3448 |
Fixed by #3448. |
What should we add?
angle_to_direction
returns the same dtype as the input argReference
I think other metpy functions do this.
Goal would be to have the code work below
Currently gives
The text was updated successfully, but these errors were encountered: