Closed gmaze closed 4 years ago
Here is the function:
def pcm1liner(this_pcm):
prtval = lambda x: "%0.2f" % x
getrge = lambda x: [np.max(x), np.min(x)]
prtrge = lambda x: "[%s:%s]" % (prtval(getrge(x)[0]), prtval(getrge(x)[1]))
prtfeatures = lambda p: "{%s}" % ", ".join(["'%s':%s" % (k, prtrge(v)) for k, v in p.features.items()])
return "PCM :: K:%i, F:%i%s, %s" % (this_pcm.K,
this_pcm.F,
prtfeatures(this_pcm),
this_pcm._props['with_classifier'].upper())
It returns something line:
"PCM :: K:8, F:2{'temperature':[0.00:-990.00], 'salinity':[0.00:-990.00]}, GMM"
Provide code that return a 1 line string to describee a PCM Useful in figure titles