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

Method sample

python/ee/image.py:3751–3806  ·  view source on GitHub ↗

Returns an ee.FeatureCollection of samples from an ee.Image. Samples the pixels of an image, returning them as a FeatureCollection. Each feature will have 1 property per band in the input image. Note that the default behavior is to drop features that intersect masked pixels, which r

(
      self,
      region: _arg_types.Geometry | None = None,
      scale: _arg_types.Number | None = None,
      projection: _arg_types.Projection | None = None,
      factor: _arg_types.Number | None = None,
      # pylint: disable=invalid-name
      numPixels: _arg_types.Integer | None = None,
      seed: _arg_types.Integer | None = None,
      dropNulls: _arg_types.Bool | None = None,
      tileScale: _arg_types.Number | None = None,
      geometries: _arg_types.Bool | None = None,
      # pylint: enable=invalid-name
  )

Source from the content-addressed store, hash-verified

3749 )
3750
3751 def sample(
3752 self,
3753 region: _arg_types.Geometry | None = None,
3754 scale: _arg_types.Number | None = None,
3755 projection: _arg_types.Projection | None = None,
3756 factor: _arg_types.Number | None = None,
3757 # pylint: disable=invalid-name
3758 numPixels: _arg_types.Integer | None = None,
3759 seed: _arg_types.Integer | None = None,
3760 dropNulls: _arg_types.Bool | None = None,
3761 tileScale: _arg_types.Number | None = None,
3762 geometries: _arg_types.Bool | None = None,
3763 # pylint: enable=invalid-name
3764 ) -> featurecollection.FeatureCollection:
3765 """Returns an ee.FeatureCollection of samples from an ee.Image.
3766
3767 Samples the pixels of an image, returning them as a FeatureCollection. Each
3768 feature will have 1 property per band in the input image. Note that the
3769 default behavior is to drop features that intersect masked pixels, which
3770 result in null-valued properties (see dropNulls argument).
3771
3772 Args:
3773 region: The region to sample from. If unspecified, uses the image's whole
3774 footprint.
3775 scale: A nominal scale in meters of the projection to sample in.
3776 projection: The projection in which to sample. If unspecified, the
3777 projection of the image's first band is used. If specified in addition
3778 to scale, rescaled to the specified scale.
3779 factor: A subsampling factor, within (0, 1]. If specified, 'numPixels'
3780 must not be specified. Defaults to no subsampling.
3781 numPixels: The approximate number of pixels to sample. If specified,
3782 'factor' must not be specified.
3783 seed: A randomization seed to use for subsampling.
3784 dropNulls: Post filter the result to drop features that have null-valued
3785 properties.
3786 tileScale: A scaling factor used to reduce aggregation tile size; using a
3787 larger tileScale (e.g., 2 or 4) may enable computations that run out of
3788 memory with the default.
3789 geometries: If true, adds the center of the sampled pixel as the geometry
3790 property of the output feature. Otherwise, geometries will be omitted
3791 (saving memory).
3792 """
3793
3794 return apifunction.ApiFunction.call_(
3795 self.name() + '.sample',
3796 self,
3797 region,
3798 scale,
3799 projection,
3800 factor,
3801 numPixels,
3802 seed,
3803 dropNulls,
3804 tileScale,
3805 geometries,
3806 )
3807
3808 def sampleRectangle(

Callers 3

test_sampleMethod · 0.80
LayerFilters.jsFile · 0.80

Calls 2

nameMethod · 0.95
call_Method · 0.80

Tested by 1

test_sampleMethod · 0.64