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

Create arrays that represent the dimension of each grid axis #40

Merged
merged 3 commits into from
Apr 24, 2018

Conversation

RemiLehe
Copy link
Member

@RemiLehe RemiLehe commented Apr 23, 2018

This implements the changes proposed in openPMD/openPMD-standard#193

See this PR for more details.

@RemiLehe RemiLehe changed the base branch from 1.1.X to 2.0.X April 23, 2018 14:43
@RemiLehe RemiLehe force-pushed the per_component_unitSI branch from f713669 to 6cf7cfd Compare April 23, 2018 15:50
@RemiLehe RemiLehe requested a review from ax3l April 23, 2018 15:51
@RemiLehe RemiLehe changed the title [WIP] Create arrays that represent the dimension of each grid axis Create arrays that represent the dimension of each grid axis Apr 23, 2018
@ax3l
Copy link
Member

ax3l commented Apr 24, 2018

@RemiLehe can you please rebase? It collides with your previous whitespace changes :)

@@ -599,7 +599,7 @@ def check_meshes(f, iteration, v, extensionStates):
result_array += test_attr(field, v, "required",
"gridGlobalOffset", np.ndarray, [np.float32, np.float64])
result_array += test_attr(field, v, "required",
"gridUnitSI", np.float64)
"gridUnitSI", np.ndarray, np.float64)
Copy link
Member

Choose a reason for hiding this comment

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

gridUnitDimension needs to be verified now as well

rho.attrs["position"] = np.array([0.0, 0.0], dtype=np.float32)
rho.attrs["gridUnitSI"] = np.float64(1.0)
rho.attrs["gridUnitSI"] = np.array([1.0]*2, dtype=np.float64)
Copy link
Member

Choose a reason for hiding this comment

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

Wow, interesting syntax...

maybe we can write [1.0, 1.0] for clarity?
or define a variable named dataDim = 2 for 2 so it's not a magic number?

rho.attrs["gridUnitSI"] = np.float64(1.0)
rho.attrs["gridUnitSI"] = np.array([1.0]*2, dtype=np.float64)
rho.attrs["gridUnitDimension"] = \
np.array( [1.,0.,0.,0.,0.,0.,0.]*2, dtype=np.float64 )
Copy link
Member

Choose a reason for hiding this comment

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

maybe add comment behind: # x: spatial (L), y: spatial (L)

E.attrs["gridGlobalOffset"] = np.array([0.0, 0.0], dtype=np.float32)
E.attrs["gridUnitSI"] = np.float64(1.0)
E.attrs["gridGlobalOffset"] = np.array([0.0, 0.0], dtype=np.float32)
E.attrs["gridUnitSI"] = np.array([1.0]*3, dtype=np.float64 )
Copy link
Member

Choose a reason for hiding this comment

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

this is 2D as well

E.attrs["gridGlobalOffset"] = np.array([0.0, 0.0], dtype=np.float32)
E.attrs["gridUnitSI"] = np.array([1.0]*3, dtype=np.float64 )
E.attrs["gridUnitDimension"] = \
np.array( [1.,0.,0.,0.,0.,0.,0.]*3, dtype=np.float64 )
Copy link
Member

Choose a reason for hiding this comment

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

this is 2D as well

@RemiLehe RemiLehe force-pushed the per_component_unitSI branch from 6cf7cfd to 5d297d5 Compare April 24, 2018 15:26
@ax3l
Copy link
Member

ax3l commented Apr 24, 2018

thank you so much! :)

@ax3l ax3l merged commit f382ac9 into openPMD:2.0.X Apr 24, 2018
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.

2 participants