Skip to content

Commit a59f8da

Browse files
committed
Optional Paths: Fix Validation
1 parent 1d38ddd commit a59f8da

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

openpmd_validator/check_h5.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -554,12 +554,13 @@ def check_meshes(f, iteration, v, extensionStates):
554554
# Find the path to the data
555555
base_path = "/data/%s/" % iteration
556556
valid, meshes_path = get_attr(f, "meshesPath")
557-
if not valid and v:
558-
print("`meshesPath` attribute is missing in '/' "
559-
"(will not search for mesh records)")
560-
meshes_path = None
561-
else:
557+
if valid:
562558
meshes_path = meshes_path.decode()
559+
else:
560+
meshes_path = None
561+
if v:
562+
print("`meshesPath` attribute is missing in '/' "
563+
"(will not search for mesh records)")
563564

564565
if meshes_path:
565566
if os.path.join( base_path, meshes_path) != ( base_path + meshes_path ):
@@ -717,12 +718,13 @@ def check_particles(f, iteration, v, extensionStates) :
717718
base_path = "/data/%s/" % iteration
718719
valid, particles_path = get_attr(f, "particlesPath")
719720

720-
if not valid and v:
721-
print("`particlesPath` attribute is missing in '/' "
722-
"(will not search for particle records)")
723-
particles_path = None
724-
else:
721+
if valid:
725722
particles_path = particles_path.decode()
723+
else:
724+
particles_path = None
725+
if v:
726+
print("`particlesPath` attribute is missing in '/' "
727+
"(will not search for particle records)")
726728

727729
if particles_path:
728730
if os.path.join( base_path, particles_path) != \

0 commit comments

Comments
 (0)