1 | #!/usr/bin/env python3 |
---|
2 | ### |
---|
3 | ### Script to check water conservation in the IPSL coupled model |
---|
4 | ### |
---|
5 | ## Warning, to install, configure, run, use any of included software or |
---|
6 | ## to read the associated documentation you'll need at least one (1) |
---|
7 | ## brain in a reasonably working order. Lack of this implement will |
---|
8 | ## void any warranties (either express or implied). Authors assumes |
---|
9 | ## no responsability for errors, omissions, data loss, or any other |
---|
10 | ## consequences caused directly or indirectly by the usage of his |
---|
11 | ## software by incorrectly or partially configured personal |
---|
12 | ## |
---|
13 | ## |
---|
14 | ## SVN information |
---|
15 | # $Author$ |
---|
16 | # $Date$ |
---|
17 | # $Revision$ |
---|
18 | # $Id: $ |
---|
19 | # $HeadURL$ |
---|
20 | |
---|
21 | # Where do we run ? |
---|
22 | import pathlib, os |
---|
23 | |
---|
24 | SysName, NodeName, Release, Version, Machine = os.uname () |
---|
25 | TGCC = ( 'irene' in NodeName ) |
---|
26 | IDRIS = ( 'jeanzay' in NodeName ) |
---|
27 | SPIP = ( 'lsce5138' in NodeName ) or ( 'spip' in NodeName.lower () ) |
---|
28 | |
---|
29 | ## Set site specific libIGCM directories, and other specific stuff |
---|
30 | # =========================================================================================== |
---|
31 | if TGCC : |
---|
32 | CPU = subprocess.getoutput ( 'lscpu | grep "Model name"' ) |
---|
33 | if "Intel(R) Xeon(R) Platinum" in CPU : Machine = 'irene' |
---|
34 | if "AMD" in CPU : Machine = 'irene-amd' |
---|
35 | |
---|
36 | if libIGCM : |
---|
37 | if ARCHIVE == None : ARCHIVE = subprocess.getoutput ( f'ccc_home --cccstore -d {Project} -u {User}' ) |
---|
38 | if STORAGE == None : STORAGE = subprocess.getoutput ( f'ccc_home --cccwork -d {Project} -u {User}' ) |
---|
39 | if SCRATCHDIR == None : SCRATCHDIR = subprocess.getoutput ( f'ccc_home --cccscratch -d {Project} -u {User}' ) |
---|
40 | if R_IN == None : R_IN = os.path.join ( subprocess.getoutput ( f'ccc_home --cccwork -d igcmg -u igcmg' ), 'IGCM') |
---|
41 | if rebuild == None : rebuild = os.path.join ( subprocess.getoutput ( f'ccc_home --ccchome -d igcmg -u igcmg' ), 'Tools', Machine, 'rebuild_nemo', 'bin', 'rebuild_nemo' ) |
---|
42 | |
---|
43 | ## Specific to run at TGCC. |
---|
44 | # Needed before importing a NetCDF library (netCDF4, xarray, cmds, etc ...) |
---|
45 | if platform.python_version () == '3.7.5' : |
---|
46 | import mpi4py |
---|
47 | mpi4py.rc.initialize = False |
---|
48 | |
---|
49 | ## Creates output directory name |
---|
50 | if TmpDir == None : |
---|
51 | TmpDir = subprocess.getoutput ( 'ccc_home -s' ) |
---|
52 | config['Files']['TmpDir'] = TmpDir |
---|
53 | |
---|
54 | # =========================================================================================== |
---|
55 | if IDRIS : |
---|
56 | Machine = 'jean-zay' |
---|
57 | if libIGCM : |
---|
58 | if ARCHIVE == None : ARCHIVE = os.path.join ( '/', 'gpfsstore' , 'rech', Project, User ) |
---|
59 | if STORAGE == None : STORAGE = os.path.join ( '/', 'gpfswork' , 'rech', Project, User ) |
---|
60 | if SCRATCHDIR == None : SCRATCHDIR = os.path.join ( '/', 'gpfsscratch', 'rech', Project, User ) |
---|
61 | if R_IN == None : R_IN = os.path.join ( '/', 'gpfswork' , 'rech', 'psl', 'commun', 'IGCM' ) |
---|
62 | if rebuild == None : rebuild = os.path.join ( '/', 'gpfswork', 'rech', 'psl', 'commun', 'Tools', 'rebuild', 'modipsl_IOIPSL_PLUS_v2_2_4', 'bin', 'rebuild' ) |
---|
63 | |
---|
64 | ## Creates output directory name |
---|
65 | if TmpDir == None : |
---|
66 | TmpDir = os.getenv ( 'CCFRSCRATCH' ) |
---|
67 | config['Files']['TmpDir'] = TmpDir |
---|
68 | |
---|
69 | # =========================================================================================== |
---|
70 | if SPIP : |
---|
71 | Machine = 'spip' |
---|
72 | if libIGCM : |
---|
73 | if ARCHIVE == None : ARCHIVE = os.path.join ( '/', 'Users', User, 'Data' ) |
---|
74 | if STORAGE == None : STORAGE = os.path.join ( '/', 'Users', User, 'Data' ) |
---|
75 | if SCRATCHDIR == None : SCRATCHDIR = os.path.join ( '/', 'Users', User, 'Data' ) |
---|
76 | if R_IN == None : R_IN = os.path.join ( '/', 'Users', User, 'Data', 'IGCM' ) |
---|
77 | |
---|
78 | ## Creates output directory name |
---|
79 | if TmpDir == None : |
---|
80 | TmpDir = os.path.join ( pathlib.Path.home (), 'Scratch' ) |
---|
81 | config['Files']['TmpDir'] = TmpDir |
---|
82 | |
---|
83 | # =========================================================================================== |
---|