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

New Attribute: speciesType #38

Merged
merged 3 commits into from
Apr 3, 2018

Conversation

ax3l
Copy link
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
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.
@@ -392,7 +397,7 @@ def check_root_attr(f, v):
result_array += test_attr(f, v, "required", "iterationFormat", np.string_)

# 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
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
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
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!

@@ -392,7 +397,7 @@ def check_root_attr(f, v):
result_array += test_attr(f, v, "required", "iterationFormat", np.string_)

# 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
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