Skip to content

Commit f079828

Browse files
committed
Fixed variable creation to use _FillValue attr properly
1 parent c9415d6 commit f079828

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

exodus_helper/reconfigure_mesh.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,15 @@ def scale_mesh(filename, scale=(1., 1., 1.)):
4848

4949
variables = dataset_from.variables
5050
for k, v in variables.items():
51+
attrs = v.ncattrs()
52+
fargs = {}
53+
if '_FillValue' in attrs:
54+
fargs['fill_value'] = v.getncattr('_FillValue')
55+
attrs.remove('_FillValue')
5156
variable = dataset_to.createVariable(
52-
k, v.datatype, dimensions=v.dimensions)
57+
k, v.datatype, dimensions=v.dimensions, **fargs)
5358
variable[:] = v[:]
54-
for attr in v.ncattrs():
59+
for attr in attrs:
5560
variable.setncattr(attr, v.getncattr(attr))
5661

5762
mesh.close()

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = 'poetry.core.masonry.api'
44

55
[tool.poetry]
66
name = 'exodus_helper'
7-
version = '1.0.0'
7+
version = '1.0.1'
88
description = 'A package for manipulating ExodusII databases'
99
license = 'BSD-3-Clause'
1010
authors = ['Coleman Alleman <callema@sandia.gov>']

0 commit comments

Comments
 (0)