save#

geetools.ee_computed_object.save(self, path)#

Save a ee.ComputedObject to a .gee file.

The file contains the JSON representation of the object. It still needs to be computed via ee.ComputedObject.getInfo() to be used.

Parameters:

path (os.PathLike) – The path to save the object to.

Returns:

The path to the saved file.

Return type:

pathlib.Path

Examples

from tempfile import TemporaryDirectory
from pathlib import Path
import ee, geetools
from geetools.utils import initialize_documentation

initialize_documentation()

img = ee.Image("COPERNICUS/S2_SR_HARMONIZED/20200101T100319_20200101T100321_T32TQM")

with TemporaryDirectory() as tmp:
    file = Path(tmp) / "test.gee"
    img.save(file)
    print(file.read_text())
{"result": "0", "values": {"0": {"functionInvocationValue": {"functionName": "Image.load", "arguments": {"id": {"constantValue": "COPERNICUS/S2_SR_HARMONIZED/20200101T100319_20200101T100321_T32TQM"}}}}}}