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

Ignore FieldPerps when loading datasets #37

Merged
merged 2 commits into from
Aug 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions xbout/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,12 @@ def _trim(ds, *, guards, keep_boundaries, nxpe, nype):
selection[dim] = slice(lower, upper)
trimmed_ds = ds.isel(**selection)

# Ignore FieldPerps for now
for name in trimmed_ds:
if (trimmed_ds[name].dims == ('x', 'z')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do FieldPerps not have any identifying features other than their literal dimensions? Like an attributes flag?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

FieldPerps do have an attribute yindex_global which other fields don't have, but I think at the moment the convention for identifying Field3D, Field2D, FieldPerp in netCDF files is by their dimensions. In the current setup this is unambiguous; are you thinking it'll cause problems when adding 'physical' coordinates, etc.? It would be easy to add an attribute like bout_type - this is already done in BOUT++ for the HDF5 input/output because HDF5 variables don't have dimensions that we could use to identify them.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay that seems fine for now then

or trimmed_ds[name].dims == ('t', 'x', 'z')):
trimmed_ds = trimmed_ds.drop(name)

return trimmed_ds.drop(_BOUT_TIMING_VARIABLES, errors='ignore')


Expand Down