cf.abspath

cf.abspath(filename)[source]

Return a normalized absolute version of a file name.

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

Parameters
filename: str or None

The name of the file, or None

Returns

str

The normalized absolutised version of filename, or None.

Examples

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