Fixed potential memory leak in local_solar_time#2356
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2356 +/- ##
==========================================
- Coverage 94.11% 94.11% -0.01%
==========================================
Files 241 241
Lines 13381 13379 -2
==========================================
- Hits 12594 12592 -2
Misses 787 787 ☔ View full report in Codecov by Sentry. |
|
Thanks @schlunma Code looks good to me. I also did a test run. I did notice some strange vertical lines with very low values in them though. Here is the recipe: datasets:
- {dataset: ERA5, project: native6, tier: 3, type: reanaly}
preprocessors:
local_solar_time:
local_solar_time:
diagnostics:
map:
description: Global map of temperature in January 2000.
themes:
- phys
realms:
- atmos
variables:
pr:
mip: E1hr
preprocessor: local_solar_time
timerange: 19900102/P2D
caption: |
Global map of {long_name} in January 2000 according to {dataset}.
scripts:
script1:
script: examples/diagnostic.py
quickplot:
plot_type: pcolormesh
cmap: Redsand the plot (plotted time step 23), the white lines have values of order 1e-18: This does not appear to be a new issue though, it also happens with the |
|
Hmm, when I was testing this I've never seen these weird lines. I think these are missing values, not very small values. My guess is that it's somehow related to rounding, which leads to some longitude/time combinations having missing values. When this dataset is regridded to a course grid, these lines are gone. Unfortunately I don't have the time to investigate this further, but this also shouldn't be a big issue to be honest, except if someone is interested in only these longitudes bands individually. |

Description
See SciTools/iris#5767: wrapping large arguments, such as numpy arrays in a
functools.partialis an example of how functions can be created that will make this into a sizeable memory leak. This fixes this by using all numpy arrays as positional arguments indask.array.apply_gufunc.Closes #2355
Before you get started
Checklist
It is the responsibility of the author to make sure the pull request is ready to review. The icons indicate whether the item will be subject to the 🛠 Technical or 🧪 Scientific review.
To help with the number pull requests: