A friend using this package to extract data across many wrf files was encountering huge slowdowns and found huge speedups switching to xarray. I dug a bit and I have a suspicion where the inefficiency is. There are two things about the linked line that concerns me. First, It is called before a possible short-circuit path that doesn't use its result, so perhaps this line can get moved to a few lines down? Second, I notice that this function call doesn't use the passed in _key. I don't fully understand the cache mechanism, but I wonder if this would benefit from it?
https://github.com/NCAR/wrf-python/blob/bd1107c605f7f51c712d3a1d22cf359bfcbad874/src/wrf/util.py#L1609
https://twitter.com/JaredALee/status/1263311504469889031
A friend using this package to extract data across many wrf files was encountering huge slowdowns and found huge speedups switching to xarray. I dug a bit and I have a suspicion where the inefficiency is. There are two things about the linked line that concerns me. First, It is called before a possible short-circuit path that doesn't use its result, so perhaps this line can get moved to a few lines down? Second, I notice that this function call doesn't use the passed in
_key
. I don't fully understand the cache mechanism, but I wonder if this would benefit from it?