Skip to content

Commit

Permalink
add warning if fill_value='default' used for non primitive data type
Browse files Browse the repository at this point in the history
  • Loading branch information
jswhit2 committed Oct 21, 2024
1 parent f3eba10 commit 801e7b6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/netCDF4/_netCDF4.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4414,6 +4414,11 @@ behavior is similar to Fortran or Matlab, but different than numpy.
if not fillval.dtype.isnative: fillval.byteswap(True)
_set_att(self._grp, self._varid, '_FillValue',\
fillval, xtype=xtype)
else:
msg = """
WARNING: there is no default fill value for this data type, so fill_value='default'
does not do anything."""
warnings.warn(msg)
else:
if self._isprimitive or self._isenum or \
(self._isvlen and self.dtype == str):
Expand Down

0 comments on commit 801e7b6

Please sign in to comment.