AI-generated Key Takeaways
-
The
aggregate_sample_varmethod calculates the sample variance of a specified property for objects in a FeatureCollection. -
This method is available for
FeatureCollectionobjects and returns a single numerical value representing the sample variance. -
It requires two arguments: the FeatureCollection to operate on and a string specifying the property to analyze.
| Usage | Returns |
|---|---|
FeatureCollection.aggregate_sample_var(property) | Number |
| Argument | Type | Details |
|---|---|---|
this: collection | FeatureCollection | The collection to aggregate over. |
property | String | The property to use from each element of the collection. |
Examples
Code Editor (JavaScript)
// FeatureCollection of power plants in Belgium. var fc = ee.FeatureCollection('WRI/GPPD/power_plants') .filter('country_lg == "Belgium"'); print('Sample variance of power plant capacities (MW)', fc.aggregate_sample_var('capacitymw')); // 217604.420018647
import ee import geemap.core as geemap
Colab (Python)
# FeatureCollection of power plants in Belgium. fc = ee.FeatureCollection('WRI/GPPD/power_plants').filter( 'country_lg == "Belgium"') print('Sample variance of power plant capacities (MW):', fc.aggregate_sample_var('capacitymw').getInfo()) # 217604.420018647