Skip to content

New Attribute: speciesType#38

Merged
RemiLehe merged 3 commits into
openPMD:2.0.Xfrom
ax3l:topic-speciesTypeExtension
Apr 3, 2018
Merged

New Attribute: speciesType#38
RemiLehe merged 3 commits into
openPMD:2.0.Xfrom
ax3l:topic-speciesTypeExtension

Conversation

@ax3l
Copy link
Copy Markdown
Member

@ax3l ax3l commented Apr 3, 2018

Check if the optional speciesType attribute in the SpeciesType extension is a string and uses only allowed characters (e.g. no spaces).

Introduced in openPMD 2.0.0: openPMD/openPMD-standard#180

Check if the optional `speciesType` attribute in the `SpeciesType`
extension is a string and uses only allowed characters (e.g. no spaces).
@ax3l
Copy link
Copy Markdown
Member Author

ax3l commented Apr 3, 2018

@RemiLehe shall I push the updates to the example creator, writing the speciesType extension, as well?

update: pushed. I skipped adding photon to E and B but added it to the particle group and the density mesh record.

Add `speciesType` attributes to some records.
Comment thread openpmd_validator/check_h5.py Outdated

# optional but required for extensions
result_array += test_attr(f, v, "optional", "openPMDextension", np.string_, "^[a-zA-Z0-9-;]+$")
result_array += test_attr(f, v, "optional", "openPMDextension", np.string_, "^[a-zA-Z0-9\-;]+$")
Copy link
Copy Markdown
Member Author

@ax3l ax3l Apr 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: this is a bug-fix for extension names from the last PR. The - needs an escape, otherwise it's a regex range.
(\ is not allowed, would also need an escape.)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since regex can sometimes be cryptic, would you add a comment explaining what it does? Like

# Check that openPMDextension contains only letters, or digits, or the characters `-` and `;`

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, great point!

Comment thread openpmd_validator/check_h5.py Outdated

# optional but required for extensions
result_array += test_attr(f, v, "optional", "openPMDextension", np.string_, "^[a-zA-Z0-9-;]+$")
result_array += test_attr(f, v, "optional", "openPMDextension", np.string_, "^[a-zA-Z0-9\-;]+$")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since regex can sometimes be cryptic, would you add a comment explaining what it does? Like

# Check that openPMDextension contains only letters, or digits, or the characters `-` and `;`

@RemiLehe RemiLehe merged commit c85d574 into openPMD:2.0.X Apr 3, 2018
@ax3l ax3l deleted the topic-speciesTypeExtension branch April 3, 2018 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants