isInstance#
- geetools.ee_computed_object.isInstance(self, klass)#
Return 1 if the element is the passed type or 0 if not.
- Parameters:
klass (type) – The class to check the instance of.
- Returns:
1if the element is the passed type or0if not.- Return type:
Examples
import ee, geetools from geetools.utils import initialize_documentation initialize_documentation() # test if a String is a ee.String s = ee.String("foo") isString = ee.String("foo").isInstance(ee.String) print(f"{s.getInfo()} is a earthengine string: {isString.getInfo()}") # test if a Number is a ee.String n = ee.Number(1) isString = ee.Number(1).isInstance(ee.String) print(f"{n.getInfo()} is a earthengine string: {isString.getInfo()}")
foo is a earthengine string: 1
1 is a earthengine string: 0