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

Support on derived variables #10

Open
1 of 2 tasks
henry2004y opened this issue Apr 23, 2021 · 1 comment
Open
1 of 2 tasks

Support on derived variables #10

henry2004y opened this issue Apr 23, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@henry2004y
Copy link
Owner

Right now the derived quantity plots are not supported. In order to achieve this, I may need:

  • A new function getvar(data::Data, var::String) returning the derived variable
  • A new plotting function that understands the derived data type

The first one is achieved by a trick I found on discourse, which basically identifies symbols as names to members in a struct.
This test feature is not ideal and will be dropped in later versions. This looks like the Python Calculator in ParaView.
I don't know how ParaView achieve this, but in Python it is pretty easy to parse a string and execute it as some new codes using exec function, as Yuxi did in his interface to the yt library. Julia has equivalent metaprogramming capabilities, but there are many restrictions to apply it in practice so it is generally adviced to avoid evaluating expressions inside functions during runtime.
Another option is to create functions for derived variables. This is actually pretty good both in terms of performance and conciseness. The idea is to create a dictionary of derived variable names as keys and anonymous functions as values, and if the input string is found in the dictionary, call the corresponding function to obtain the value.

This has been successfully tested in my new scripts for processing Vlasiator outputs, and can be directly ported here for BATSRUS.

@henry2004y henry2004y added the enhancement New feature or request label Apr 23, 2021
@henry2004y
Copy link
Owner Author

A more complete variable list can be found from the IDL script. A similar implementation can be found at vslvvariables.jl

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

No branches or pull requests

1 participant