Skip to content
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

Conversions between cartesian and spherical, cylindrical coordinate systems #52

Open
nvaytet opened this issue Jan 25, 2022 · 0 comments

Comments

@nvaytet
Copy link
Collaborator

nvaytet commented Jan 25, 2022

@Adnan-Ali-Ahmad
Passing from Cartesian to other coordinate systems, like cylindrical or spherical for example, where you can also specify your basis. These are things that can simplify a lot of people's notebooks.

@nvaytet
We would probably need the option to provide a custom origin for the coordinate system.
Any good ideas for a name for such a module/function?
osyris.spatial.cartesian_to_spherical, osyris.spatial.cartesian_to_cylindrical?

@Adnan-Ali-Ahmad
I was thinking of having a single function wrap up everything, something like osyris.spatial.get_components(dataset, system="spherical", origin = [x,y,z], basis=[ux,uy,uz]). Keep in mind that by "basis" I mean how the unit vectors are oriented with respect to the base cartesian grid (eg. [0,0,1] means that the sphere's northern axis is aligned with the "z" axis, maybe you can find a better name for this).
One thing we might want to consider is what the user actually wants transformed (eg. does he want the velocity components to be expressed in spherical coordinates?, the B field? xyz? all?) and how we handle this in the call to the function. A clean way of doing this would be to make the coordinate system an intrinsic part of the dataset class, so a user can change coordinate systems by doing dataset.transform(system="spherical", origin=[0,0,0], basis=[0,0,1]) and the routine transforms all coordinate-dependent quantities in the dataset (position & vector quantities). Although this might be a bit too much work, it has the benefit of reduced memory usage.

@nvaytet nvaytet changed the title Conversions between cartesian and sperical, cylindrical coordinate systems Conversions between cartesian and spherical, cylindrical coordinate systems Feb 9, 2022
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

1 participant