Skip to content

Commit

Permalink
Fixed variable creation to use _FillValue attr properly
Browse files Browse the repository at this point in the history
  • Loading branch information
calleman21 committed Aug 13, 2024
1 parent c9415d6 commit f079828
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions exodus_helper/reconfigure_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,15 @@ def scale_mesh(filename, scale=(1., 1., 1.)):

variables = dataset_from.variables
for k, v in variables.items():
attrs = v.ncattrs()
fargs = {}
if '_FillValue' in attrs:
fargs['fill_value'] = v.getncattr('_FillValue')
attrs.remove('_FillValue')
variable = dataset_to.createVariable(
k, v.datatype, dimensions=v.dimensions)
k, v.datatype, dimensions=v.dimensions, **fargs)
variable[:] = v[:]
for attr in v.ncattrs():
for attr in attrs:
variable.setncattr(attr, v.getncattr(attr))

mesh.close()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = 'poetry.core.masonry.api'

[tool.poetry]
name = 'exodus_helper'
version = '1.0.0'
version = '1.0.1'
description = 'A package for manipulating ExodusII databases'
license = 'BSD-3-Clause'
authors = ['Coleman Alleman <[email protected]>']
Expand Down

0 comments on commit f079828

Please sign in to comment.