# spacepy.pycdf.istp.format

spacepy.pycdf.istp.format(v, use_scaleminmax=False, dryrun=False)

  Set ISTP-compliant FORMAT on a variable

  Sets a CDF variable’s FORMAT attribute, which provides a Fortran-like format string that should be useable for printing any valid value in the variable. Sets according to the VALIDMIN/VALIDMAX attributes (or, optionally, SCALEMIN/SCALEMAX) if present, otherwise uses the full range of the type.

  Parameters:
    v `Var`

      Variable to update

    use_scaleminmax bool, optional

      Use SCALEMIN/MAX instead of VALIDMIN/MAX (default False). Note: istpchecks may complain about result.

    dryrun bool, optional

      Print the decided format to stdout instead of modifying the CDF (for use in command-line debugging) (default False).

  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.format(v)
      >>> v.attrs['FORMAT']
      'I4'