MCPcopy
hub / github.com/google/earthengine-api / __init__

Method __init__

python/ee/imagecollection.py:32–74  ·  view source on GitHub ↗

ImageCollection constructor. Args: args: ImageCollections can be constructed from the following arguments: 1) A string: assumed to be the name of a collection, 2) An array of images, or anything that can be used to construct an image. 3) A s

(self, args: Any)

Source from the content-addressed store, hash-verified

30
31 @deprecation.WarnForDeprecatedAsset('args')
32 def __init__(self, args: Any):
33 """ImageCollection constructor.
34
35 Args:
36 args: ImageCollections can be constructed from the following arguments:
37 1) A string: assumed to be the name of a collection,
38 2) An array of images, or anything that can be used to construct an
39 image.
40 3) A single image.
41 5) A computed object - reinterpreted as a collection.
42
43 Raises:
44 EEException: if passed something other than the above.
45 """
46 self.initialize()
47
48 # Wrap single images in an array.
49 if isinstance(args, image.Image):
50 args = [args]
51
52 if ee_types.isString(args):
53 # An ID.
54 super().__init__(
55 apifunction.ApiFunction.lookup('ImageCollection.load'), {'id': args})
56 elif isinstance(args, (list, tuple)):
57 # A list of images.
58 super().__init__(
59 apifunction.ApiFunction.lookup('ImageCollection.fromImages'), {
60 'images': [image.Image(i) for i in args]
61 })
62 elif isinstance(args, ee_list.List):
63 # A computed list of images.
64 super().__init__(
65 apifunction.ApiFunction.lookup('ImageCollection.fromImages'), {
66 'images': args
67 })
68 elif isinstance(args, computedobject.ComputedObject):
69 # A custom object to reinterpret as an ImageCollection.
70 super().__init__(args.func, args.args, args.varName)
71 else:
72 raise ee_exception.EEException(
73 'Unrecognized argument type to convert to an ImageCollection: %s' %
74 args)
75
76 @classmethod
77 def initialize(cls) -> None:

Callers

nothing calls this directly

Calls 2

initializeMethod · 0.95
lookupMethod · 0.80

Tested by

no test coverage detected