NCL Home > Documentation > Functions > File I/O


Returns a string of the opened file's path.

Available in version 6.3.0 and later.


	function getfilepath (
		thefile [1] : file   

	return_val [1] :  string



A reference to a file created from a call to addfile or addfiles. The file referenced must be one in the supported file format list.

Return value

This function returns a string which contains the path of a opended file.


The following example gets the path info of a opened file back.

    f = addfile ("MLS-Aura_L2GP-O3_v02-22-c01_2008d001.he5" , "r")   ; could also have ccm, grb or hdf suffix
    path = getfilepath (f) ; get file pointer's path
    print (path)               ; print file's path

The above script produces:

Variable: path
Type: string
Total Size: 8 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes:   [1]
(0)     MLS-Aura_L2GP-O3_v02-22-c01_2008d001.he5