spacepy.pycdf.istp.fillval

spacepy.pycdf.istp.fillval(v, ret=False)[source]

Set ISTP-compliant FILLVAL on a variable

Sets or returns a CDF variable’s FILLVAL attribute to the value required by ISTP (based on variable type).

Parameters
vVar

CDF variable to update

Returns
various

If ret is True, returns the correct value for variable type (which may be of various Python types). Otherwise sets the value and returns None.

Other Parameters
retboolean

If True, return the value instead of setting it (Default False, set).

Examples

>>> import spacepy.pycdf
>>> import spacepy.pycdf.istp
>>> f = spacepy.pycdf.CDF('foo.cdf', create=True)
>>> v = f.new('Var', data=[1, 2, 3])
>>> spacepy.pycdf.istp.fillval(v)
>>> v.attrs['FILLVAL']
-128