ipygee#
The init file of the package.
Submodules#
Attributes#
Classes#
Initialize the FeatureCollectionAccessor class. |
|
Initialize the Image class. |
|
Initialize the ImageCollectionAccessor class. |
Package Contents#
- class ipygee.FeatureCollectionAccessor(obj)[source]#
Initialize the FeatureCollectionAccessor class.
- Parameters:
obj (ee.FeatureCollection)
- plot_by_features(type='bar', featureId='system:index', properties=None, labels=None, colors=None, figure=None, **kwargs)[source]#
Plot the values of a
ee.FeatureCollectionby feature.Each feature property selected in properties will be plotted using the
featureIdas the x-axis. If nopropertiesare provided, all properties will be plotted. If nofeatureIdis provided, the"system:index"property will be used.Warning
This function is a client-side function.
- Parameters:
type (str) – The type of plot to use. Defaults to
"bar". can be any type of plot from the python libmatplotlib.pyplot. If the one you need is missing open an issue!featureId (str) – The property to use as the x-axis (name the features). Defaults to
"system:index".properties (list[str] | None) – A list of properties to plot. Defaults to all properties.
labels (list[str] | None) – A list of labels to use for plotting the properties. If not provided, the default labels will be used. It needs to match the properties’ length.
colors (list[str] | None) – A list of colors to use for plotting the properties. If not provided, the default colors from the matplotlib library will be used.
figure (bokeh.plotting.figure | None) – The bokeh figure to plot the data on. If None, a new figure is created.
kwargs – Additional arguments from the
pyplottype selected.
- Return type:
bokeh.plotting.figure
Examples
- plot_by_properties(type='bar', featureId='system:index', properties=None, labels=None, colors=None, figure=None, **kwargs)[source]#
Plot the values of a
ee.FeatureCollectionby property.Each features will be represented by a color and each property will be a bar of the bar chart.
Warning
This function is a client-side function.
- Parameters:
type (str) – The type of plot to use. Defaults to
"bar". can be any type of plot from the python libmatplotlib.pyplot. If the one you need is missing open an issue!featureId (str) – The property to use as the y-axis (name the features). Defaults to
"system:index".properties (list[str] | ee.List | None) – A list of properties to plot. Defaults to all properties.
labels (list[str] | None) – A list of labels to use for plotting the properties. If not provided, the default labels will be used. It needs to match the properties’ length.
colors (list[str] | None) – A list of colors to use for plotting the properties. If not provided, the default colors from the matplotlib library will be used.
figure (bokeh.plotting.Feature | None) – The bokeh figure to plot the data on. If None, a new figure is created.
kwargs – Additional arguments from the
pyplotfunction.
- Return type:
bokeh.plotting.Feature
Examples
- plot_hist(property, label='', figure=None, color=None, **kwargs)[source]#
Plot the histogram of a specific property.
Warning
This function is a client-side function.
- Parameters:
property (str | ee.String) – The property to display
label (str) – The label to use for the property. If not provided, the property name will be used.
figure (bokeh.plotting.figure | None) – The bokeh figure to plot the data on. If None, a new figure is created.
color (str | None) – The color to use for the plot. If not provided, the default colors from the matplotlib library will be used.
**kwargs – Additional arguments from the
matplotlib.pyplot.hist()function.
- Return type:
bokeh.plotting.figure
Examples
- _obj#
- class ipygee.ImageAccessor(obj)[source]#
Initialize the Image class.
- Parameters:
obj (ee.Image)
- plot_by_bands(type, regions, reducer='mean', bands=None, regionId='system:index', labels=None, colors=None, figure=None, scale=10000, crs=None, crsTransform=None, tileScale=1)[source]#
Plot the reduced values for each band.
Each band will be plotted using the
labelsas x-axis label defaulting to band names if not provided. If nobandsare provided, all bands will be plotted. If noregionIdare provided, the"system:index"property will be used.Warning
This method is client-side.
- Parameters:
type (str) – The type of plot to use. Defaults to
"bar". can be any type of plot from the python libmatplotlib.pyplot. If the one you need is missing open an issue!regions (ee.FeatureCollection) – The regions to compute the reducer in.
reducer (str | ee.Reducer) – The name of the reducer or a reducer object to use. Default is
"mean".bands (list[str] | None) – The bands to compute the reducer on. Default to all bands.
regionId (str) – The property used to label region. Defaults to
"system:index".labels (list[str] | None) – The labels to use for the output dictionary. Default to the band names.
colors (list[str] | None) – The colors to use for the plot. Default to the default matplotlib colors.
figure (bokeh.plotting.figure | None) – The bokeh figure to plot the data on. If None, a new figure is created.
scale (int) – The scale to use for the computation. Default is 10000m.
crs (str | None) – The projection to work in. If unspecified, the projection of the image’s first band is used. If specified in addition to scale, rescaled to the specified scale.
crsTransform (list | None) – The list of CRS transform values. This is a row-major ordering of the 3x2 transform matrix. This option is mutually exclusive with ‘scale’, and replaces any transform already set on the projection.
tileScale (float) – A scaling factor between 0.1 and 16 used to adjust aggregation tile size; setting a larger tileScale (e.g., 2 or 4) uses smaller tiles and may enable computations that run out of memory with the default.
- Returns:
The bokeh figure with the plot
- Return type:
bokeh.plotting.figure
Examples
import ee, ipygee ee.Initialize() ecoregions = ee.FeatureCollection("projects/google/charts_feature_example").select(["label", "value","warm"]) normClim = ee.ImageCollection('OREGONSTATE/PRISM/Norm91m').toBands() normClim.bokeh.plot_by_bands(ecoregions, ee.Reducer.mean(), scale=10000)
- plot_by_regions(type, regions, reducer='mean', bands=None, regionId='system:index', labels=None, colors=None, figure=None, scale=10000, crs=None, crsTransform=None, tileScale=1)[source]#
Plot the reduced values for each region.
Each region will be plotted using the
regionIdas x-axis label defaulting to “system:index” if not provided. If nobandsare provided, all bands will be plotted. If nolabelsare provided, the band names will be used.Warning
This method is client-side.
- Parameters:
type (str) – The type of plot to use. Defaults to
"bar". can be any type of plot from the python libmatplotlib.pyplot. If the one you need is missing open an issue!regions (ee.FeatureCollection) – The regions to compute the reducer in.
reducer (str | ee.Reducer) – The name of the reducer or a reducer object to use. Default is
"mean".bands (list[str] | None) – The bands to compute the reducer on. Default to all bands.
regionId (str) – The property used to label region. Defaults to
"system:index".labels (list[str] | None) – The labels to use for the output dictionary. Default to the band names.
colors (list[str] | None) – The colors to use for the plot. Default to the default matplotlib colors.
figure (bokeh.plotting.figure | None) – The bokeh figure to plot the data on. If None, a new figure is created.
scale (int) – The scale to use for the computation. Default is 10000m.
crs (str | None) – The projection to work in. If unspecified, the projection of the image’s first band is used. If specified in addition to scale, rescaled to the specified scale.
crsTransform (list | None) – The list of CRS transform values. This is a row-major ordering of the 3x2 transform matrix. This option is mutually exclusive with ‘scale’, and replaces any transform already set on the projection.
tileScale (float) – A scaling factor between 0.1 and 16 used to adjust aggregation tile size; setting a larger tileScale (e.g., 2 or 4) uses smaller tiles and may enable computations that run out of memory with the default.
- Returns:
The bokeh figure with the plot.
- Return type:
bokeh.plotting.figure
Examples
import ee, ipygee ee.Initialize() ecoregions = ee.FeatureCollection("projects/google/charts_feature_example").select(["label", "value","warm"]) normClim = ee.ImageCollection('OREGONSTATE/PRISM/Norm91m').toBands() normClim.bokeh.plot_by_regions(ecoregions, ee.Reducer.mean(), scale=10000)
- plot_hist(bins=30, region=None, bands=None, labels=None, colors=None, precision=2, figure=None, scale=10000, crs=None, crsTransform=None, bestEffort=False, maxPixels=10**7, tileScale=1, **kwargs)[source]#
Plot the histogram of the image bands.
- Parameters:
bins (int) – The number of bins to use for the histogram. Default is 30.
region (ee.Geometry | None) – The region to compute the histogram in. Default is the image geometry.
bands (list[str] | None) – The bands to plot the histogram for. Default to all bands.
labels (list[str] | None) – The labels to use for the output dictionary. Default to the band names.
colors (list[str] | None) – The colors to use for the plot. Default to the default matplotlib colors.
precision (int) – The number of decimal to keep for the histogram bins values. Default is 2.
figure (bokeh.plotting.figure | None) – The bokeh figure to plot the data on. If None, a new figure is created.
scale (int) – The scale to use for the computation. Default is 10,000m.
crs (str | None) – The projection to work in. If unspecified, the projection of the image’s first band is used. If specified in addition to scale, rescaled to the specified scale.
crsTransform (list | None) – The list of CRS transform values. This is a row-major ordering of the 3x2 transform matrix. This option is mutually exclusive with ‘scale’, and replaces any transform already set on the projection.
bestEffort (bool) – If the polygon would contain too many pixels at the given scale, compute and use a larger scale which would allow the operation to succeed.
maxPixels (int) – The maximum number of pixels to reduce. default to 10**7.
tileScale (float) – A scaling factor between 0.1 and 16 used to adjust aggregation tile size; setting a larger tileScale (e.g., 2 or 4) uses smaller tiles and may enable computations that run out of memory with the default.
**kwargs – Keyword arguments passed to the matplotlib.fill_between() function.
- Returns:
The bokeh figure with the plot.
- Return type:
bokeh.plotting.figure
Examples
import ee, ipygee ee.Initialize() normClim = ee.ImageCollection('OREGONSTATE/PRISM/Norm91m').toBands() normClim.bokeh.plot_hist()
- _obj#
- class ipygee.ImageCollectionAccessor(obj)[source]#
Initialize the ImageCollectionAccessor class.
- Parameters:
obj (ee.ImageCollection)
- plot_dates_by_bands(region, reducer='mean', dateProperty='system:time_start', bands=None, labels=None, colors=None, figure=None, scale=10000, crs=None, crsTransform=None, bestEffort=False, maxPixels=10**7, tileScale=1)[source]#
Plot the reduced data for each image in the collection by bands on a specific region.
This method is plotting the reduced data for each image in the collection by bands on a specific region.
- Parameters:
region (ee.Geometry) – The region to reduce the data on.
reducer (str | ee.Reducer) – The name of the reducer or a reducer object to use. Default is
"mean".dateProperty (str) – The property to use as date for each image. Default is
"system:time_start".bands (list[str] | None) – The bands to reduce. If empty, all bands are reduced.
labels (list[str] | None) – The labels to use for the bands. If empty, the bands names are used.
colors (list[str] | None) – The colors to use for the bands. If empty, the default colors are used.
figure (bokeh.plotting.figure | None) – The bokeh figure to plot the data on. If None, a new figure is created.
scale (int) – The scale in meters to use for the reduction. default is 10000m
crs (str | None) – The projection to work in. If unspecified, the projection of the image’s first band is used. If specified in addition to scale, rescaled to the specified scale.
crsTransform (list | None) – The list of CRS transform values. This is a row-major ordering of the 3x2 transform matrix. This option is mutually exclusive with ‘scale’, and replaces any transform already set on the projection.
bestEffort (bool) – If the polygon would contain too many pixels at the given scale, compute and use a larger scale which would allow the operation to succeed.
maxPixels (int | None) – The maximum number of pixels to reduce. Defaults to 1e7.
tileScale (float) – A scaling factor between 0.1 and 16 used to adjust aggregation tile size; setting a larger tileScale (e.g., 2 or 4) uses smaller tiles and may enable computations that run out of memory with the default.
- Returns:
A bokeh figure with the reduced values for each band and each date.
- Return type:
bokeh.plotting.figure
Examples
import ee, geetools ee.Initialize() collection = ( ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA") .filterBounds(ee.Geometry.Point(-122.262, 37.8719)) .filterDate("2014-01-01", "2014-12-31") ) region = ee.Geometry.Point(-122.262, 37.8719).buffer(10000) collection.geetools.plot_dates_by_bands(region, "mean", 10000, "system:time_start")
- plot_dates_by_regions(band, regions, label='system:index', reducer='mean', dateProperty='system:time_start', colors=None, figure=None, scale=10000, crs=None, crsTransform=None, tileScale=1)[source]#
Plot the reduced data for each image in the collection by regions for a single band.
This method is plotting the reduced data for each image in the collection by regions for a single band.
- Parameters:
band (str) – The band to reduce.
regions (ee.FeatureCollection) – The regions to reduce the data on.
label (str) – The property to use as label for each region. Default is
"system:index".reducer (str | ee.Reducer) – The name of the reducer or a reducer object to use. Default is
"mean".dateProperty (str) – The property to use as date for each image. Default is
"system:time_start".colors (list[str] | None) – The colors to use for the regions. If empty, the default colors are used.
figure (bokeh.plotting.figure | None) – The bokeh figure to plot the data on. If None, a new figure is created.
scale (int) – The scale in meters to use for the reduction. default is 10000m
crs (str | None) – The projection to work in. If unspecified, the projection of the image’s first band is used. If specified in addition to scale, rescaled to the specified scale.
crsTransform (list | None) – The list of CRS transform values. This is a row-major ordering of the 3x2 transform matrix. This option is mutually exclusive with ‘scale’, and replaces any transform already set on the projection.
tileScale (float) – A scaling factor between 0.1 and 16 used to adjust aggregation tile size; setting a larger tileScale (e.g., 2 or 4) uses smaller tiles and may enable computations that run out of memory with the default.
- Returns:
A bokeh figure with the reduced values for each region and each date.
- Return type:
bokeh.plotting.figure
Examples
import ee, geetools ee.Initialize() collection = ( ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA") .filterBounds(ee.Geometry.Point(-122.262, 37.8719)) .filterDate("2014-01-01", "2014-12-31") ) regions = ee.FeatureCollection([ ee.Feature(ee.Geometry.Point(-122.262, 37.8719).buffer(10000), {"name": "region1"}), ee.Feature(ee.Geometry.Point(-122.262, 37.8719).buffer(20000), {"name": "region2"}) ]) collection.geetools.plot_dates_by_regions("B1", regions, "name", "mean", 10000, "system:time_start")
- plot_doy_by_bands(region, spatialReducer='mean', timeReducer='mean', dateProperty='system:time_start', bands=None, labels=None, colors=None, figure=None, scale=10000, crs=None, crsTransform=None, bestEffort=False, maxPixels=10**7, tileScale=1)[source]#
Plot the reduced data for each image in the collection by bands on a specific region.
This method is plotting the reduced data for each image in the collection by bands on a specific region.
- Parameters:
region (ee.Geometry) – The region to reduce the data on.
spatialReducer (str | ee.Reducer) – The name of the reducer or a reducer object to use. Default is
"mean".timeReducer (str | ee.Reducer) – The name of the reducer or a reducer object to use. Default is
"mean".dateProperty (str) – The property to use as date for each image. Default is
"system:time_start".bands (list[str] | None) – The bands to reduce. If empty, all bands are reduced.
labels (list[str] | None) – The labels to use for the bands. If empty, the bands names are used.
colors (list[str] | None) – The colors to use for the bands. If empty, the default colors are used.
figure (bokeh.plotting.figure | None) – The bokeh figure to plot the data on. If None, a new figure is created.
scale (int) – The scale in meters to use for the reduction. default is 10000m
crs (str | None) – The projection to work in. If unspecified, the projection of the image’s first band is used. If specified in addition to scale, rescaled to the specified scale.
crsTransform (list | None) – The list of CRS transform values. This is a row-major ordering of the 3x2 transform matrix. This option is mutually exclusive with ‘scale’, and replaces any transform already set on the projection.
bestEffort (bool) – If the polygon would contain too many pixels at the given scale, compute and use a larger scale which would allow the operation to succeed.
maxPixels (int | None) – The maximum number of pixels to reduce. Defaults to 1e7.
tileScale (float) – A scaling factor between 0.1 and 16 used to adjust aggregation tile size; setting a larger tileScale (e.g., 2 or 4) uses smaller tiles and may enable computations that run out of memory with the default.
- Returns:
A bokeh figure with the reduced values for each band and each day.
- Return type:
bokeh.plotting.figure
Examples
import ee, geetools ee.Initialize() collection = ( ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA") .filterBounds(ee.Geometry.Point(-122.262, 37.8719)) .filterDate("2014-01-01", "2014-12-31") ) region = ee.Geometry.Point(-122.262, 37.8719).buffer(10000) collection.geetools.plot_doy_by_bands(region, "mean", "mean", 10000, "system:time_start")
- plot_doy_by_regions(band, regions, label='system:index', spatialReducer='mean', timeReducer='mean', dateProperty='system:time_start', colors=None, figure=None, scale=10000, crs=None, crsTransform=None, tileScale=1)[source]#
Plot the reduced data for each image in the collection by regions for a single band.
This method is plotting the reduced data for each image in the collection by regions for a single band.
- Parameters:
band (str) – The band to reduce.
regions (ee.FeatureCollection) – The regions to reduce the data on.
label (str) – The property to use as label for each region. Default is
"system:index".spatialReducer (str | ee.Reducer) – The name of the reducer or a reducer object to use. Default is
"mean".timeReducer (str | ee.Reducer) – The name of the reducer or a reducer object to use. Default is
"mean".dateProperty (str) – The property to use as date for each image. Default is
"system:time_start".colors (list[str] | None) – The colors to use for the regions. If empty, the default colors are used.
figure (bokeh.plotting.figure | None) – The bokeh figure to plot the data on. If None, a new figure is created.
scale (int) – The scale in meters to use for the reduction. default is 10000m
crs (str | None) – The projection to work in. If unspecified, the projection of the image’s first band is used. If specified in addition to scale, rescaled to the specified scale.
crsTransform (list | None) – The list of CRS transform values. This is a row-major ordering of the 3x2 transform matrix. This option is mutually exclusive with ‘scale’, and replaces any transform already set on the projection.
tileScale (float) – A scaling factor between 0.1 and 16 used to adjust aggregation tile size; setting a larger tileScale (e.g., 2 or 4) uses smaller tiles and may enable computations that run out of memory with the default.
- Returns:
A bokeh figure with the reduced values for each region and each day.
- Return type:
bokeh.plotting.figure
Examples
import ee, geetools ee.Initialize() collection = ( ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA") .filterBounds(ee.Geometry.Point(-122.262, 37.8719)) .filterDate("2014-01-01", "2014-12-31") ) regions = ee.FeatureCollection([ ee.Feature(ee.Geometry.Point(-122.262, 37.8719).buffer(10000), {"name": "region1"}), ee.Feature(ee.Geometry.Point(-122.262, 37.8719).buffer(20000), {"name": "region2"}) ]) collection.geetools.plot_doy_by_regions("B1", regions, "name", "mean", "mean", 10000, "system:time_start")
- plot_doy_by_seasons(band, region, seasonStart=1, seasonEnd=366, reducer='mean', dateProperty='system:time_start', colors=None, figure=None, scale=10000, crs=None, crsTransform=None, bestEffort=False, maxPixels=10**7, tileScale=1)[source]#
Plot the reduced data for each image in the collection by years for a single band.
This method is plotting the reduced data for each image in the collection by years for a single band. To set the start and end of the season, use the
ee.Date.getRelative()ortime.struct_timemethod to get the day of the year.- Parameters:
band (str) – The band to reduce.
region (ee.Geometry) – The region to reduce the data on.
seasonStart (int | ee.Number) – The day of the year that marks the start of the season.
seasonEnd (int | ee.Number) – The day of the year that marks the end of the season.
reducer (str | ee.Reducer) – The name of the reducer or a reducer object to use. Default is
"mean".dateProperty (str) – The property to use as date for each image. Default is
"system:time_start".colors (list[str] | None) – The colors to use for the regions. If empty, the default colors are used.
figure (bokeh.plotting.figure | None) – The bokeh figure to plot the data on. If None, a new figure is created.
scale (int) – The scale in meters to use for the reduction. default is 10000m
crs (str | None) – The projection to work in. If unspecified, the projection of the image’s first band is used. If specified in addition to scale, rescaled to the specified scale.
crsTransform (list | None) – The list of CRS transform values. This is a row-major ordering of the 3x2 transform matrix. This option is mutually exclusive with ‘scale’, and replaces any transform already set on the projection.
bestEffort (bool) – If the polygon would contain too many pixels at the given scale, compute and use a larger scale which would allow the operation to succeed.
maxPixels (int | None) – The maximum number of pixels to reduce. Defaults to 1e7.
tileScale (float) – A scaling factor between 0.1 and 16 used to adjust aggregation tile size; setting a larger tileScale (e.g., 2 or 4) uses smaller tiles and may enable computations that run out of memory with the default.
- Returns:
A bokeh figure with the reduced values for each year and each day.
- Return type:
bokeh.plotting.figure
Examples
- _obj#