boutproject / xBOUT

Collects BOUT++ data from parallelized simulations into xarray.
https://xbout.readthedocs.io/en/latest/
Apache License 2.0
22 stars 10 forks source link

Check that splittings aren't negative values #127

Closed TomNicholas closed 4 years ago

TomNicholas commented 4 years ago

A simple error check, which turns this unhelpful error

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-1-9ab194b06ef4> in <module>
----> 1 ds = open_boutdataset('./BOUT.dmp.*.nc')

/marconi_work/FUA33_SOLBOUT3/tnichola/pycode/xBOUT/xbout/load.py in open_boutdataset(datapath, inputfilepath, geometry, gridfilepath, chunks, keep_xboundaries, keep_yboundaries, run_name, info, pre_squashed, **kwargs)
    115                                           keep_xboundaries=keep_xboundaries,
    116                                           keep_yboundaries=keep_yboundaries,
--> 117                                           **kwargs)
    118         else:
    119             # Its a grid file

/marconi_work/FUA33_SOLBOUT3/tnichola/pycode/xBOUT/xbout/load.py in _auto_open_mfboutdataset(datapath, chunks, info, keep_xboundaries, keep_yboundaries, **kwargs)
    392                            data_vars=_BOUT_TIME_DEPENDENT_META_VARS,
    393                            preprocess=_preprocess, engine=filetype,
--> 394                            chunks=chunks, **kwargs)
    395 
    396     # Remove any duplicate time values from concatenation

/marconi_work/FUA33_SOLBOUT3/tnichola/pycode/xarray/xarray/backends/api.py in open_mfdataset(paths, chunks, concat_dim, compat, preprocess, engine, lock, data_vars, coords, combine, autoclose, parallel, join, attrs_file, **kwargs)
    993         combined.attrs = datasets[paths.index(attrs_file)].attrs
    994     else:
--> 995         combined.attrs = datasets[0].attrs
    996 
    997     return combined

IndexError: list index out of range

into one that actual tells you what the problem is (that your files are messed up in some way that means NXPE or similar is negative).

pep8speaks commented 4 years ago

Hello @TomNicholas! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers:

Comment last updated at 2020-08-29 18:38:14 UTC
codecov-commenter commented 4 years ago

Codecov Report

Merging #127 into master will decrease coverage by 0.15%. The diff coverage is 64.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #127      +/-   ##
==========================================
- Coverage   71.30%   71.15%   -0.16%     
==========================================
  Files          14       14              
  Lines        1697     1702       +5     
  Branches      359      361       +2     
==========================================
+ Hits         1210     1211       +1     
- Misses        382      385       +3     
- Partials      105      106       +1     
Impacted Files Coverage Δ
xbout/load.py 80.39% <64.28%> (-1.01%) :arrow_down:

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 2c8ae2a...8672c92. Read the comment docs.