Closed lizziel closed 10 months ago
Thanks @lizziel. I think I see what the problem is. When you turn off parallelization you might be getting a string back instead of a dict. Let me see if I can reproduce this locally.
Hi @lizziel! I think I've figured this out. This is happening in the various places where plots are parallelized. There are code blocks such as:
# --------------------------------------------
# Create the plots in parallel
# Turn off parallelization if n_job=1
if n_job != 1:
results = Parallel(n_jobs=n_job)(
delayed(createplots)(filecat)
for _, filecat in enumerate(catdict)
)
else:
for _, filecat in enumerate(catdict):
results = createplots(filecat)
# --------------------------------------------
in e.g. gcpy/benchmark_funcs.py
.
So when parallelization (n_cores: -1
) is on, the results
variable comes back as:
[{'Aerosols': {'sfc': [], '500': [], 'zm': []}}, {'Bromine': {'sfc': [], '500': [], 'zm': []}}, {'Chlorine': {'sfc': [], '500': [], 'zm': []}}, {'Iodine': {'sfc': [], '500': [], 'zm': []}}, {'Nitrogen': {'sfc': [], '500': [], 'zm': []}}, {'Oxidants': {'sfc': [], '500': [], 'zm': []}}, {'Primary_Organics': {'sfc': [], '500': [], 'zm': []}}, {'ROy': {'sfc': [], '500': [], 'zm': []}}, {'Secondary_Organic_Aerosols': {'sfc': [], '500': [], 'zm': []}}, {'Secondary_Organics': {'sfc': [], '500': [], 'zm': []}}, {'Sulfur': {'sfc': [], '500': [], 'zm': []}}]
but when parallelization is off (n_cores: 1
), the results
variable comes back as:
{'Sulfur': {'sfc': [], '500': [], 'zm': []}}
I think the solution is to make results
a list and then append the output of the createplots
function to the list when parallelization is off. I'll implement a fix.
Closed by #287
We can close this issue now because #287 has been merged. This problem is now fixed.
Name and Institution (Required)
Name: Lizzie Lundgren Institution: Harvard University
Description of your issue or question
I am getting the following error when running the transport tracer benchmark with GCPy 1.4.1 with plotting parallelization turned off in the 1yr transport tracer benchmark configuration file. I am using python 3.9.18. Full package list is in https://github.com/geoschem/gcpy/issues/284.