Managing resources (files, filenames, copy, memory)

Created on 30 Aug. 2017

Authord
  1. Lafaysse

This module contains all file manipulations.

exception utils.resources.InstallException(issue)[source]

Bases: Exception

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

utils.resources.absolute_path(pathin)[source]

Convert a local path in an absolute path.

The input may be a list of coma-separated paths

utils.resources.check_snowtools_install()[source]

Check the snowtools installation. More precisely :

  • Check that the required folders for a simulation are present in the folder pointed by SNOWTOOLS_CEN

  • Check the snowtools packages are correctly importable

utils.resources.check_surfex_exe(path)[source]

Check that SURFEX inaries are present and return their path

Parameters

path – The path to look in. If one, fallback to environment variable EXESURFEX.

Returns

The path for surfex binaries

Raises

BaseException if no path provided or FileNameException if binaries not found

utils.resources.print_used_memory()[source]

Print the currently used memory with the free linux command

utils.resources.smart_copy(pathin, nameout, preferlink=False)[source]

If pathin includes /home do a symbolic link because we probably are on the disk. Otherwise, do a hard copy of the file to improve computing times.