-
Notifications
You must be signed in to change notification settings - Fork 22
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
Ma2 file reader for nek5000 #47
Conversation
Function to read the binary ma2 files for nek5000
Adding readma2.py
Thanks a lot @Simkern. I will take a look soon. |
header = infile.read(132).split() | ||
nel = int(header[1]) | ||
nactive = int(header[2]) | ||
depth = int(header[3]) | ||
d2 = int(header[4]) | ||
npts = int(header[5]) | ||
nrnk = int(header[6]) | ||
noutflow = int(header[7]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't have to use cryptic variable names. Longer variable names would be nice to have here (and comments if it is still unclear).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of these are not really used, but since I started parsing the header I thought I'd add all data there. I have added comments but kept the naming since it's not as cryptic as you make it sound, especially regarding the values that are being used in this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. In that case leave a comment, so we know read more about it in Nek5000's code in the future.
file name | ||
ldim : int | ||
dimension of the mesh | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Describe the return values (type) and what it contains in the docstring here (just like you did for Parameters).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I have added the information about the return values.
I am taking a look at your function now @Simkern . Let me know if you are available to fix it. |
Does the user really have to specify the number of dimensions |
Co-authored-by: Ashwin V. Mohanan <9155111+ashwinvis@users.noreply.github.com>
I went through the function again and indeed it is not necessary to specify the mesh dimension although it is not saved in the header. It can be inferred from the auxiliary data and I have added this step. |
I am not sure I understand. Have you made the changes? Let me know when you pushed the new commits. |
Here's the function to read the ma2 file. The ordering is the same as in the elmap list from the re2 file iirc.