cf-python
cf-python copied to clipboard
Potentially slow iteration for setting condition value units
As noted by @davidhassell in the review thread https://github.com/NCAS-CMS/cf-python/pull/427#discussion_r1040910208, the crux being:
if a large set is stored as a Data object, as opposed to a python built-in like a list, then iterating through it could be slow
relating to the code (currently on the lama-to-dask branch only):
https://github.com/NCAS-CMS/cf-python/blob/f17e08ee69b271c3b595131ef93d25f4bb3c2395/cf/query.py#L890-L896
with a suggested solution of:
For the Data object case we could just change the units without iterating through.