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

Fix whitespace in exception message #123

Merged
merged 1 commit into from
May 13, 2020
Merged

Conversation

ZedThree
Copy link
Member

Related question, is it loading a single dump file from a parallel run not supported?

@codecov-io
Copy link

codecov-io commented May 13, 2020

Codecov Report

Merging #123 into master will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #123   +/-   ##
=======================================
  Coverage   50.29%   50.29%           
=======================================
  Files          11       11           
  Lines        1175     1175           
  Branches      234      234           
=======================================
  Hits          591      591           
  Misses        512      512           
  Partials       72       72           
Impacted Files Coverage Δ
xbout/load.py 75.19% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d5f7af...e9dc174. Read the comment docs.

@johnomotani
Copy link
Collaborator

There's a workaround here

xBOUT/xbout/load.py

Lines 388 to 406 in e9dc174

if nx_file == nx or nx_file == nx - 2*mxg:
has_xboundaries = (nx_file == nx)
if not has_xboundaries:
mxg = 0
# Check if there are two divertor targets present
if ds['jyseps1_2'] > ds['jyseps2_1']:
upper_target_cells = myg
else:
upper_target_cells = 0
if ny_file == ny or ny_file == ny + 2*myg + 2*upper_target_cells:
# This file contains all the points, possibly including guard cells
has_yboundaries = not (ny_file == ny)
if not has_yboundaries:
myg = 0
nxpe = 1
nype = 1
to detect if there's a single output file (e.g. from parallel output, or from having squashed the output into a single file). It also works (I use it routinely) with a set of files containing consecutive time-chunks of a run, but with the spatial domain squashed. It feels a bit hacky to me, so more elegant suggestions welcome, but works (at least for what I've wanted it for).

@johnomotani
Copy link
Collaborator

Related to the fixing whitespace, I'd be in favour of running black over the whole project, also fixing anything flake8 complains about, and then adding them to the CI tests. Maybe we could merge #107, #108, #117 and this PR, and then have a one-shot update of the formatting?

@ZedThree
Copy link
Member Author

I did run black on this file, and was a bit surprised to find lots of changes! I thought black was getting run automatically already. Am I getting mixed up with hypnotoad maybe?

@ZedThree
Copy link
Member Author

Oh, sorry, the whitespace fixed here is inside the string, so wouldn't be touched by black. The printed error looked like:

ValueError: Each run directory does not contain an equal numberof output files. If the parallelization scheme of your simulation changed partway-through, then pleaseload each directory separately and concatenate themalong the time dimension with xarray.concat().

@ZedThree ZedThree merged commit 741c66a into master May 13, 2020
@ZedThree ZedThree deleted the fix-exception-whitespace branch May 13, 2020 15:01
@johnomotani
Copy link
Collaborator

I did run black on this file, and was a bit surprised to find lots of changes! I thought black was getting run automatically already. Am I getting mixed up with hypnotoad maybe?

Maybe! hypnotoad does have auto-checking with black, xBOUT does not (yet).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants