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.

Parameters
filename: str

The name of the file.

Returns
str

The normalized absolutized version of filename.

Examples:

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