Skip to content

Commit 4bd18e8

Browse files
Add CDMS_NO_MPI env var to acme_diags/__init__.py (#468)
- Add acme_diags/libs README.md Move os.environ settings to root __init__.py - Remove acme_diags/libs dir
1 parent 8b3e4dc commit 4bd18e8

File tree

6 files changed

+25
-37
lines changed

6 files changed

+25
-37
lines changed

acme_diags/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,15 @@
33

44
__version__ = "v2.5.0rc1"
55
INSTALL_PATH = os.path.join(sys.prefix, "share/e3sm_diags/")
6+
7+
# Disable MPI in cdms2, which is not currently supported by E3SM-unified
8+
os.environ["CDMS_NO_MPI"] = "True"
9+
# Must be done before any CDAT library is called.
10+
os.environ["UVCDAT_ANONYMOUS_LOG"] = "no"
11+
os.environ["CDAT_ANONYMOUS_LOG"] = "no"
12+
# Needed for when using hdf5 >= 1.10.0,
13+
# without this, errors are thrown on Edison compute nodes.
14+
os.environ["HDF5_USE_FILE_LOCKING"] = "FALSE"
15+
# Used by numpy, causes too many threads to spawn otherwise.
16+
os.environ["OPENBLAS_NUM_THREADS"] = "1"
17+
os.environ["OMP_NUM_THREADS"] = "1"

acme_diags/acme_diags_driver.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,13 @@
11
#!/usr/bin/env python
22
from __future__ import print_function
3-
from typing import Dict, Tuple
4-
import os
5-
6-
# Must be done before any CDAT library is called.
7-
os.environ["UVCDAT_ANONYMOUS_LOG"] = "no"
8-
os.environ["CDAT_ANONYMOUS_LOG"] = "no"
9-
# Needed for when using hdf5 >= 1.10.0,
10-
# without this, errors are thrown on Edison compute nodes.
11-
os.environ["HDF5_USE_FILE_LOCKING"] = "FALSE"
12-
# Used by numpy, causes too many threads to spawn otherwise.
13-
os.environ["OPENBLAS_NUM_THREADS"] = "1"
14-
os.environ["OMP_NUM_THREADS"] = "1"
153

164
import importlib
5+
import os
176
import subprocess
187
import sys
198
import traceback
9+
from typing import Dict, Tuple
2010

21-
import cdms2.tvariable
2211
import cdp.cdp_run
2312

2413
import acme_diags
@@ -28,9 +17,6 @@
2817
from acme_diags.parser.core_parser import CoreParser
2918
from acme_diags.viewer.main import create_viewer
3019

31-
# turn off MPI in cdms2 -- not currently supported by e3sm_diags
32-
cdms2.tvariable.HAVE_MPI = False
33-
3420

3521
def get_default_diags_path(set_name, run_type, print_path=True):
3622
"""

acme_diags/acme_diags_vars.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,12 @@
1010
from typing import Any, Dict, List
1111

1212
import cdms2
13-
import cdms2.tvariable
1413

1514
import acme_diags
1615
from acme_diags.acme_diags_driver import get_parameters
1716
from acme_diags.derivations.acme import derived_variables
1817
from acme_diags.parser.core_parser import CoreParser
1918

20-
# turn off MPI in cdms2 -- not currently supported by e3sm_diags
21-
cdms2.tvariable.HAVE_MPI = False
22-
2319

2420
def main():
2521
vars_in_e3sm_diags = list_of_vars_in_e3sm_diags()

analysis_data_preprocess/create_OAFLUX_climo.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -295,25 +295,19 @@
295295
if ji == "shtfl":
296296
outputdattable.id = "SHFLX"
297297
outputdattable.units = "W m-2"
298-
outputdattable.standard_name = (
299-
"surface_upward_sensible_heat_flux"
300-
)
298+
outputdattable.standard_name = "surface_upward_sensible_heat_flux"
301299
# print ji,' modified'
302300
if ji == "lhtfl":
303301
outputdattable.id = "LHFLX"
304302
outputdattable.units = "W m-2"
305-
outputdattable.standard_name = (
306-
"surface_upward_latent_heat_flux"
307-
)
303+
outputdattable.standard_name = "surface_upward_latent_heat_flux"
308304
# print ji,' modified'
309305
f_out.write(outputdattable)
310306

311307
time_axis = f_out.getAxis("time")
312308
bnds_axis = f_out.getAxis("bound")
313309
climatology = None
314-
climo_start = "".join(
315-
[startyear, clim_edges[clim_edge_values[f_index, 0]]]
316-
)
310+
climo_start = "".join([startyear, clim_edges[clim_edge_values[f_index, 0]]])
317311
climo_end = "".join([endyear, clim_edges[clim_edge_values[f_index, 1]]])
318312
# climatology_bnds_value={climo_start, climo_end}
319313

@@ -402,9 +396,7 @@
402396
shell=True,
403397
)
404398
call(
405-
"".join(
406-
["ncatted -a _FillValue,'^bounds',d,, ", output_hostANDfilename]
407-
),
399+
"".join(["ncatted -a _FillValue,'^bounds',d,, ", output_hostANDfilename]),
408400
shell=True,
409401
)
410402
call(

analysis_data_preprocess/create_PminusE_GPCP-OAFlux_timeseries.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@
2929
# print(prect.getTime().asComponentTime())
3030
# print(qflux.getTime().asComponentTime())
3131

32-
qflux_reg = qflux.regrid(
33-
prect.getGrid(), regridTool="esmf", regridMethod="linear"
34-
)
32+
qflux_reg = qflux.regrid(prect.getGrid(), regridTool="esmf", regridMethod="linear")
3533

3634
PminusE = prect / 24.0 / 3600.0 - qflux_reg # conver to kg/m2/s
3735
PminusE.setAxis(0, prect.getTime())
@@ -51,7 +49,9 @@
5149
delattr(PminusE, "var_desc")
5250
delattr(PminusE, "valid_range")
5351

54-
output_path = "/p/user_pub/e3sm/zhang40/analysis_data_e3sm_diags/GPCP_OAFLux/time_series/"
52+
output_path = (
53+
"/p/user_pub/e3sm/zhang40/analysis_data_e3sm_diags/GPCP_OAFLux/time_series/"
54+
)
5555
output_filename = "PminusE_197901_201312.nc"
5656
fout = cdms2.open(output_path + output_filename, "w")
5757
fout.write(PminusE)

analysis_data_preprocess/fix_units_TRMM-3B43v-7_3hr.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
import cdms2
44

5-
datapath = "/p/user_pub/e3sm/zhang40/analysis_data_e3sm_diags/TRMM/climatology_diurnal_cycle/"
5+
datapath = (
6+
"/p/user_pub/e3sm/zhang40/analysis_data_e3sm_diags/TRMM/climatology_diurnal_cycle/"
7+
)
68
for path in Path(datapath).rglob("*.nc"):
79
print(path.name)
810
print(path)

0 commit comments

Comments
 (0)