ee.Dictionary.aside
Calls a function passing this object as the first argument, and returning itself. Convenient e.g. when debugging:
var c = ee.ImageCollection('foo').aside(print)
.filterDate('2001-01-01', '2002-01-01').aside(print, 'In 2001')
.filterBounds(geom).aside(print, 'In region')
.aside(Map.addLayer, {min: 0, max: 142}, 'Filtered')
.select('a', 'b');
Returns the same object, for chaining.
Usage | Returns |
---|
Dictionary.aside(func, var_args) | ComputedObject |
Argument | Type | Details |
---|
this: computedobject | ComputedObject | The ComputedObject instance. |
func | Function | The function to call. |
var_args | VarArgs | Any extra arguments to pass to the function. |
Examples
// A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
var dict = {
B1: 182,
B2: 219,
B3: 443
};
// Print a message when constructing the ee.Dictionary.
var eeDict = ee.Dictionary(dict).aside(print, 'ee.Dictionary from an object');
Python setup
See the
Python Environment page for information on the Python API and using
geemap
for interactive development.
import ee
import geemap.core as geemap
# A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
dic = {
'B1': 182,
'B2': 219,
'B3': 443
}
def print_dic(dic):
"""Prints the dictionary."""
print('ee.Dictionary from client-side dictionary:', dic.getInfo())
# Print a message when constructing the ee.Dictionary.
ee_dic = ee.Dictionary(dic).aside(print_dic)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[[["`aside()` is a method that allows calling a function with the current object as the first argument, without altering the object itself, enabling debugging or side effects like adding to the map."],["It takes a function as its primary argument, followed by any additional arguments that should be passed to the function, facilitating flexibility in its application."],["This method returns the original object, making it seamlessly chainable with other Earth Engine operations for concise and readable code."],["The method can be used with various Earth Engine objects, including `ee.ImageCollection` and `ee.Dictionary`, as demonstrated in the examples."]]],["The `aside` function calls a specified function, passing the current object as the first argument, and then returns the original object. This allows for chaining operations, particularly useful for debugging. It accepts a function and optional extra arguments to pass to that function. In the examples, `aside` is used to print a message or add a layer during image collection filtering, and dictionary creation, with the `print` or `print_dic` function. It can use different type of data like `ee.Dictionary` or `ee.ImageCollection`.\n"]]