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

Method __init__

python/ee/ee_array.py:36–68  ·  view source on GitHub ↗

Creates an Array wrapper. Returns an Array with the given coordinates. Args: values: An existing array to cast, or a number/list of numbers/nested list of numbers of any depth to create an array from. For nested lists, all inner arrays at the same depth must have the

(
      self,
      values: _arg_types.Array,
      # pylint: disable-next=invalid-name
      pixelType: _arg_types.String | None = None,
  )

Source from the content-addressed store, hash-verified

34 _initialized: bool = False
35
36 def __init__(
37 self,
38 values: _arg_types.Array,
39 # pylint: disable-next=invalid-name
40 pixelType: _arg_types.String | None = None,
41 ):
42 """Creates an Array wrapper.
43
44 Returns an Array with the given coordinates.
45
46 Args:
47 values: An existing array to cast, or a number/list of numbers/nested list
48 of numbers of any depth to create an array from. For nested lists, all
49 inner arrays at the same depth must have the same length, and numbers
50 may only be present at the deepest level.
51 pixelType: The type of each number in the values argument. If the pixel
52 type is not provided, it will be inferred from the numbers in 'values'.
53 If there aren't any numbers in 'values', this type must be provided.
54 """
55 self.initialize()
56
57 if isinstance(values, computedobject.ComputedObject) and pixelType is None:
58 if self.is_func_returning_same(values):
59 # If it is a call that is already returning an Array, just cast.
60 super().__init__(values.func, values.args, values.varName)
61 return
62
63 args: dict[str, Any] = {'values': values}
64 if pixelType is not None:
65 args['pixelType'] = pixelType
66
67 func = apifunction.ApiFunction(self.name())
68 super().__init__(func, func.promoteArgs(args))
69
70 @classmethod
71 def initialize(cls) -> None:

Callers

nothing calls this directly

Calls 4

initializeMethod · 0.95
nameMethod · 0.95
promoteArgsMethod · 0.80

Tested by

no test coverage detected