# coyote: NCDF_CASTDATATYPE

- coyote/Utilities
- [Source code]

NAME

      NCDF_CastDataType

PURPOSE

      This is a utility routine to turn IDL data types into the equivalent
      netCDF data type. In other words, change 'STRING' to 'CHAR' and so on.

AUTHOR

      FANNING SOFTWARE CONSULTING
      David Fanning, Ph.D.
      1645 Sheely Drive
      Fort Collins, CO 80526 USA
      Phone: 970-221-0438
      E-mail: david@idlcoyote.com
      Coyote's Guide to IDL Programming: http://www.idlcoyote.com

CATEGORY

      Utilities

CALLING SEQUENCE

      ncdf_datatype = NCDF_CastDataType(variable)

ARGUMENTS

      variable:      The IDL variable for which you want a netCDF data type.
                     Or, if the TYPE keyword is set, the variable type index you wish
                     to convert. Or, if the TNAME keyword is set, the variable type
                     name you wish to convert.

KEYWORDS

      TYPE:         If set, the positional argument is an IDL variable type of
                    the sort returned by the SIZE function with the TYPE keyword set.
                     type = Size(variable, /TYPE)
      TNAME:        If set, the positional argument is an IDL variable type of
                    the sort returned by the SIZE function with the TNAME keyword set.
                     type = Size(variable, /TNAME)

RETURN VALUE

      ncdf_datatype: The netCDF data type of the variable. Possible values are
                     'BYTE', 'CHAR', 'SHORT', 'LONG', 'FLOAT' and 'DOUBLE'.

NOTES

      The program is designed to work with the NCDF_FILE object and related programs.

MODIFICATION HISTORY

      Written by:  David W. Fanning, 3 February 2010.
      Made a UINT data type be cast to LONG, rather than SHORT. 29 April 2010. DWF.
      Added TYPE and TNAME keywords. 5 May 2010. DWF.