cfdm.abspath

cfdm.abspath(filename)[source]

Return a normalised absolute version of a file name.

If a string containing URL is provided then it is returned unchanged.

New in version (cfdm): 1.7.0

Parameters
filename: str

The name of the file.

Returns
str

The normalised absolutised version of filename.

Examples

>>> import os
>>> os.getcwd()
'/data/archive'
>>> cfdm.abspath('file.nc')
'/data/archive/file.nc'
>>> cfdm.abspath('..//archive///file.nc')
'/data/archive/file.nc'
>>> cfdm.abspath('http://data/archive/file.nc')
'http://data/archive/file.nc'