-
Notifications
You must be signed in to change notification settings - Fork 8
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
meshesPath & particlesPath: optional #32
Conversation
4d0c6cb
to
3d1e69c
Compare
Implements that `meshesPath` and `particlesPath` are optional in openPMD 1.1.0+. But if they are set, the directories those attributes point to must exist.
3d1e69c
to
1d38ddd
Compare
I checked with the
|
Cool! And if you remove the |
openpmd_validator/check_h5.py
Outdated
if not valid and v: | ||
print("`particlesPath` attribute is missing in '/' " | ||
"(will not search for particle records)") | ||
particles_path = None |
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 think that this should be:
if not valid and v:
particles_path = None
if v:
print("`particlesPath` attribute is missing in '/' "
"(will not search for particle records)")
else:
particles_path = particles_path.decode()
(Same thing with meshes_path
)
Otherwise this raises an error when trying to decode
None
.
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.
oh yes!
Nope. It raises an error (see inline comments...) |
Thanks, pushed the fix! |
ea378dd
to
a59f8da
Compare
Thanks! This now works fine with the missing
|
openpmd_validator/check_h5.py
Outdated
try: | ||
list_meshes = list(f[full_meshes_path].keys()) | ||
except KeyError: | ||
list_meshes = [] |
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.
Could you remove the try / except KeyError
here? (Because you are basically testing for it above, with an if / return
statement)?
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.
True, we are testing it properly now! :)
@@ -702,20 +715,39 @@ def check_particles(f, iteration, v, extensionStates) : | |||
result_array = np.array([ 0, 0]) | |||
|
|||
# Find the path to the data | |||
base_path = ("/data/%s/" % iteration).encode('ascii') | |||
base_path = "/data/%s/" % iteration |
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.
Why is the previously-defined base_path
(used for the meshes) not kept here?
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.
it was inconsistent between meshesPath
and particlesPath
.
I unified both by just picking one.
openpmd_validator/check_h5.py
Outdated
try: | ||
list_species = list(f[full_particle_path].keys()) | ||
except KeyError: | ||
list_species = [] |
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.
Same remark on try / except KeyError
.
With the paths now properly checked, we don't need a try block anymore.
@RemiLehe thx for the review, I applied your suggested changes and explained the open question |
Implements that
meshesPath
andparticlesPath
are optional in openPMD1.1.0
+.But if they are set, the directories those attributes point to must exist.
See: openPMD/openPMD-standard#171