I want to explicitly record the missing_value attribute for variables in a netCDF file I am writing with the netCDF4 module. I am aware that I can accomplish this by explicitly setting the fill_value argument to netCDF4.createVariable, and that netCDF4.default_fillvals provides the defaults. So far so good. Is there a reliable way to get the dict key for netCDF4.default_fillvals from an arbitrary numpy array? The default_fillvals keys are ['i1', 'u1', ... 'i8', 'f8'], etc., and numpy dtypes are different and potentially quite complex.
I can make my own mapping dict, of course, but I suspect I'd miss some possibilities so I wonder if netCDF4 provides a better way.