modelskill icon indicating copy to clipboard operation
modelskill copied to clipboard

match() should not fail when a comparison is empty

Open jsmariegaard opened this issue 1 year ago • 1 comments

When matching many observations with one or more modelresults with ms.match(obslist, mr), it is annoying when it fails only because a one or a few of comparers have no overlapping data. This forces me to use this ugly block:

cmps = []
for o in obslist:
	print(f"Processing {o.name}...")
	try:
		cmp = ms.match(obs=o, mod=mr)
		cmps.append(cmp)
	except Exception as e:
		print(e)    
cc = ms.ComparerCollection(cmps)

instead of just:

cc = ms.match(obs=olist, mod=mr)

jsmariegaard avatar Dec 06 '24 16:12 jsmariegaard

Solve by adding action_no_data argument on match() which accepts "ignore", "warn", "error"

jsmariegaard avatar Dec 18 '24 09:12 jsmariegaard