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

SpatialGrid read_variable sorted output and associated issues #276

Open
alhom opened this issue Sep 12, 2024 · 2 comments
Open

SpatialGrid read_variable sorted output and associated issues #276

alhom opened this issue Sep 12, 2024 · 2 comments

Comments

@alhom
Copy link
Contributor

alhom commented Sep 12, 2024

VlsvReader.read_variable, when called with cids=-1 (all CellIDs), returns data in the file layout, which can change between files. This keeps causing issues with users. Non-disruptive fixes to be done:

  • investigate if we can warn when using read_variable from outside analysator vs. from within analysator -> warning to remind about sorting. __name__ doesn't really work though.

  • Pass coordinates to read_variable -> use 0th-order read_interpolated_variable instead

    • this is piling extra tasks on read_variable, though.
  • ✔️ read_interpolated_variable to have a 0th-order interp.

  • read_variable_info to maybe sort by default? Returns VariableInfo. It is not a drop-in replacement for numpy ndarray, which is a bit unfortunate. Likely useful in any case, and non-disruptive (as long as sorting it doesn't break anything...)

    • this will need edits to most plotting scripts to account for not having to sort anymore. Will make for cleaner code, though!

What should be the user-facing function? Likely read_interpolated_variable (0th order), or read_variable with coords parameter.

@JonasSuni
Copy link
Contributor

https://stackoverflow.com/questions/3711184/how-to-use-inspect-to-get-the-callers-info-from-callee-in-python

This discussion describes how to get the info of the function that is calling the current function. This way you should be able to implement a warning that triggers when the user is calling read_variable but not when other analysator functions are calling it

@alhom
Copy link
Contributor Author

alhom commented Sep 18, 2024

Piecewise constant read_intepolated_variable in here: #278

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