Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract cubewrite() fill value to function #99

Open
4 tasks
truth-quark opened this issue Sep 12, 2024 · 0 comments · May be fixed by #114
Open
4 tasks

Extract cubewrite() fill value to function #99

truth-quark opened this issue Sep 12, 2024 · 0 comments · May be fixed by #114
Assignees

Comments

@truth-quark
Copy link
Collaborator

Continuing with the overarching task of splitting cubewrite() (#12), fill value functionality can be extracted as a function:

# Set the missing_value attribute. Use an array to force the type to match
# the data type
if cube.data.dtype.kind == 'f':
fill_value = 1.e20
else:
# Use netCDF defaults
fill_value = default_fillvals['%s%1d' % (cube.data.dtype.kind, cube.data.dtype.itemsize)]
cube.attributes['missing_value'] = np.array([fill_value], cube.data.dtype)

Tasks:

  • Extract code block to separate function
  • Add unit tests
  • Convert 1e20 fill value to a constant
  • Add arg to function signature for custom fill values

For now, let's keep cubewrite()'s steps the same, merging into process() can be a separate refactoring issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants