-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plot parallelization off failing in GCPy 1.4.1 #285
Comments
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. So when parallelization ( [{'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 ( {'Sulfur': {'sfc': [], '500': [], 'zm': []}} I think the solution is to make |
This commit fixes the issue reported by @lizziel in #285. The "results" variable was being overwritten instead of appended to when plots are generated sequentially (i.e. with "n_cores: 1" in the YAML input). gcpy/benchmark/modules/run_1yr_*_fullchem.py gcpy/benchmark_funcs.py gcpy/plot/compare_*.py - For the case when parallelization is off: 1. Declare "results" as an empty list 2. Append the output of the routine being called into "results" This will prevent a dictionary key error as described in #285. Signed-off-by: Bob Yantosca <[email protected]>
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 #284.
The text was updated successfully, but these errors were encountered: