Commit c9fc6ed8 authored by peastman's avatar peastman
Browse files

Merge pull request #934 from swails/ncwarn

Eliminate scipy RuntimeWarning when reading NetCDF restart files
parents 77524af3 8908f33b
...@@ -1363,6 +1363,7 @@ class AmberNetcdfRestart(object): ...@@ -1363,6 +1363,7 @@ class AmberNetcdfRestart(object):
if 'velocities' in ncfile.variables: if 'velocities' in ncfile.variables:
vels = ncfile.variables['velocities'] vels = ncfile.variables['velocities']
self.velocities = np.array(vels[:]) * vels.scale_factor self.velocities = np.array(vels[:]) * vels.scale_factor
del vels # Get rid of reference to variable to avoid warnings
if ('cell_lengths' in ncfile.variables and if ('cell_lengths' in ncfile.variables and
'cell_angles' in ncfile.variables): 'cell_angles' in ncfile.variables):
self.boxVectors = np.zeros((3,3), np.float32) self.boxVectors = np.zeros((3,3), np.float32)
...@@ -1372,6 +1373,7 @@ class AmberNetcdfRestart(object): ...@@ -1372,6 +1373,7 @@ class AmberNetcdfRestart(object):
units.degrees) units.degrees)
self.boxVectors = computePeriodicBoxVectors(leng[0], leng[1], self.boxVectors = computePeriodicBoxVectors(leng[0], leng[1],
leng[2], angl[0], angl[1], angl[2]) leng[2], angl[0], angl[1], angl[2])
del leng, angl # Avoid warnings
if 'time' in ncfile.variables: if 'time' in ncfile.variables:
self.time = ncfile.variables['time'].getValue() self.time = ncfile.variables['time'].getValue()
finally: finally:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment