wrf-python icon indicating copy to clipboard operation
wrf-python copied to clipboard

CAPE and WETBULB Fortran routines not fully thread safe

Open bladwig1 opened this issue 6 years ago • 1 comments

The reading of the lookup tables might be causing some race conditions when working with dask. Now that WRF-Python's functionality has been ported back to NCL, and NCL is in maintenance mode, the lookup tables should be loaded upon import and passed to the CAPE routines rather than keeping the NCL behavior of reading the file.

bladwig1 avatar Mar 29 '19 17:03 bladwig1

Would that be a matter of adding these variables to every function that calls dlookup_table? https://github.com/NCAR/wrf-python/blob/04159d68c9ffbcd7025da8fecf82742245c46054/fortran/rip_cape.f90#L193-L195 then modifying the functions that call those functions to pass the arrays from constants in the python package somewhere?

The other option, if the values are only changed in dlookup_table, would be to make them private module variables, repurpose the current dlookup_table to initialize those module variables and ensure the new function gets called during package initialization, then create a new function to fill the arrays passed as arguments from the module variables to be called everywhere dlookup_table is called now.

DWesl avatar Oct 24 '24 22:10 DWesl