Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
richardjgowers committed Sep 5, 2019
2 parents 7c468a4 + e5e4f5e commit ee47592
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 8 deletions.
10 changes: 10 additions & 0 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ The rules for this file:
* release numbers follow "Semantic Versioning" http://semver.org

------------------------------------------------------------------------------
09/05/19 IAlibay, richardjgowers

* 0.20.1

Fixes
* The NetCDF writer now writes `cell_angle` units as `degree` instead of
`degrees` in accordance with the AMBER NetCDF convention (Issue #2327).
* Fixed installation without Cython (Issue #2337)


08/28/19 micaela-matta, xiki-tempula, zemanj, mattwthompson, orbeckst, aliehlen,
dpadula85, jbarnoud, manuel.nuno.melo, richardjgowers, mattwthompson,
ayushsuhane, picocentauri, NinadBhat, bieniekmateusz, p-j-smith, Lp0lp,
Expand Down
9 changes: 6 additions & 3 deletions package/MDAnalysis/coordinates/TRJ.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,10 +847,13 @@ class NCDFWriter(base.WriterBase):
.. versionchanged:: 0.17.0
Use fast :mod:`netCDF4` for writing but fall back to slow
:mod:`scipy.io.netcdf` if :mod:`netCDF4` is not available.
.. versionchanged:: 0.20.1
Changes the `cell_angles` unit to the AMBER NetCDF convention standard
of `degree` instead of the `degrees` written in previous version of
MDAnalysis (Issue #2327).
.. TODO:
* Change the `cell_angles` units to `degree`, implement `scale_factor`
handling (Issue #2327).
* Implement `scale_factor` handling (Issue #2327).
"""

Expand Down Expand Up @@ -967,7 +970,7 @@ def _init_netcdf(self, periodic=True):

cell_angles = ncfile.createVariable('cell_angles', 'f8',
('frame', 'cell_angular'))
setattr(cell_angles, 'units', 'degrees')
setattr(cell_angles, 'units', 'degree')

cell_angular = ncfile.createVariable('cell_angular', 'c',
('cell_angular', 'label'))
Expand Down
2 changes: 1 addition & 1 deletion package/MDAnalysis/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@
# e.g. with lib.log

#: Release of MDAnalysis as a string, using `semantic versioning`_.
__version__ = "0.20.0" # NOTE: keep in sync with RELEASE in setup.py
__version__ = "0.20.1" # NOTE: keep in sync with RELEASE in setup.py
3 changes: 2 additions & 1 deletion package/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
from commands import getoutput

# NOTE: keep in sync with MDAnalysis.__version__ in version.py
RELEASE = "0.20.0"
RELEASE = "0.20.1"

is_release = 'dev' not in RELEASE

Expand Down Expand Up @@ -101,6 +101,7 @@
print("*** package: Cython not found ***")
print("MDAnalysis requires cython for development builds")
sys.exit(1)
cython_linetrace = False


class Config(object):
Expand Down
2 changes: 1 addition & 1 deletion testsuite/MDAnalysisTests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
logger = logging.getLogger("MDAnalysisTests.__init__")

# keep in sync with RELEASE in setup.py
__version__ = "0.20.0"
__version__ = "0.20.1"

# Do NOT import MDAnalysis at this level. Tests should do it themselves.
# If MDAnalysis is imported here coverage accounting might fail because all the import
Expand Down
29 changes: 28 additions & 1 deletion testsuite/MDAnalysisTests/coordinates/test_netcdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

from MDAnalysisTests.datafiles import (PFncdf_Top, PFncdf_Trj,
GRO, TRR, XYZ_mini,
PRM_NCBOX, TRJ_NCBOX)
PRM_NCBOX, TRJ_NCBOX, DLP_CONFIG)
from MDAnalysisTests.coordinates.test_trj import _TRJReaderTest
from MDAnalysisTests.coordinates.reference import (RefVGV, RefTZ2)
from MDAnalysisTests import make_Universe
Expand Down Expand Up @@ -875,6 +875,33 @@ def test_write_ts(self, pos, vel, force, tmpdir, ts1, ts2):
u.trajectory.close()


class TestNCDFWriterUnits(object):
"""Tests that the writer adheres to AMBER convention units"""
@pytest.fixture()
def outfile(self, tmpdir):
return str(tmpdir) + 'ncdf-writer-1.ncdf'

@pytest.mark.parametrize('var, expected', (
('coordinates', 'angstrom'),
('time', 'picosecond'),
('cell_lengths', 'angstrom'),
('cell_angles', 'degree'),
('velocities', 'angstrom/picosecond'),
('forces', 'kilocalorie/mole/angstrom')
))
def test_writer_units(self, outfile, var, expected):
trr = mda.Universe(DLP_CONFIG, format='CONFIG')

with mda.Writer(outfile, trr.trajectory.n_atoms, velocities=True,
forces=True, format='ncdf') as W:
for ts in trr.trajectory:
W.write_next_timestep(ts)

with netcdf.netcdf_file(outfile, mode='r') as ncdf:
unit = ncdf.variables[var].units.decode('utf-8')
assert_equal(unit, expected)


class TestNCDFWriterErrors(object):
@pytest.fixture()
def outfile(self, tmpdir):
Expand Down
2 changes: 1 addition & 1 deletion testsuite/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def run(self):

if __name__ == '__main__':
# this must be in-sync with MDAnalysis
RELEASE = "0.20.0"
RELEASE = "0.20.1"

with open("README") as summary:
LONG_DESCRIPTION = summary.read()
Expand Down

0 comments on commit ee47592

Please sign in to comment.