<jupyter_start><jupyter_text>Applying different distributions to collections and images<jupyter_code>import ee
ee.Initialize()
from geetools import tools
import ipygee as ui
p = ee.Geometry.Point([0, 0])<jupyter_output><empty_output><jupyter_text>Build a Test Collection<jupyter_code># values = ee.List([0, 2, 5, 8, 10, 12, 15, 18, 22, 25, 28, 31, 35, 39, 42, 48, 51, 55])
# values = ee.List([-10, -8, -7, -1, -2, 0, 1, 5, 7, 8, 10, 12, 14, 16, 18, 20, 22, 24])  # With negative values
values = ee.List([-20, -32, -15, -8, -5, 0, 2, 4, 6, 8, 9, 10, 12, 14, 16, 18, 20, 23])
def build_collection(n):
    n = ee.Number(n)
    return ee.Image.constant(n).rename('test').set('test', n).toFloat()
images = values.map(build_collection)
collection = ee.ImageCollection.fromImages(images)<jupyter_output><empty_output><jupyter_text>Linear Function  Using a band<jupyter_code>help(tools.imagecollection.linearFunctionBand)
linear_band1 = tools.imagecollection.linearFunctionBand(collection, 'test')
linear_band1_chart = ui.chart.Image.series(linear_band1, p, scale=1000, xProperty='test', bands=['linear_function'], label_bands=['default values'])
linear_band2 = tools.imagecollection.linearFunctionBand(collection, 'test', mean=10)
linear_band2_chart = ui.chart.Image.series(linear_band2, p, scale=1000, xProperty='test', bands=['linear_function'], label_bands=['mean=10'])
linear_band3 = tools.imagecollection.linearFunctionBand(collection, 'test', mean=10, output_min=0)
linear_band3_chart = ui.chart.Image.series(linear_band3, p, scale=1000, xProperty='test', bands=['linear_function'], label_bands=['mean=10 min=0'])
linear_band4 = tools.imagecollection.linearFunctionBand(collection, 'test', mean=10, output_min=10, output_max=20)
linear_band4_chart = ui.chart.Image.series(linear_band4, p, scale=1000, xProperty='test', bands=['linear_function'], label_bands=['mean=10 min=0 max=12'])
linear_chart = linear_band1_chart.cat(linear_band2_chart, linear_band3_chart, linear_band4_chart)
linear_chart.renderWidget(width=800)<jupyter_output><empty_output><jupyter_text>Using a Property<jupyter_code>linear_prop1 = tools.imagecollection.linearFunctionProperty(collection, 'test')
linear_prop1_chart = ui.chart.Image.series(linear_prop1, p, scale=1000, xProperty='test', properties=['LINEAR_FUNCTION'], label_properties=['default values'])
linear_prop2 = tools.imagecollection.linearFunctionProperty(collection, 'test', mean=10)
linear_prop2_chart = ui.chart.Image.series(linear_prop2, p, scale=1000, xProperty='test', properties=['LINEAR_FUNCTION'], label_properties=['mean=10'])
linear_prop3 = tools.imagecollection.linearFunctionProperty(collection, 'test', mean=10, output_min=0)
linear_prop3_chart = ui.chart.Image.series(linear_prop3, p, scale=1000, xProperty='test', properties=['LINEAR_FUNCTION'], label_properties=['mean=10 min=0'])
linear_prop4 = tools.imagecollection.linearFunctionProperty(collection, 'test', mean=10, output_min=0, output_max=10)
linear_prop4_chart = ui.chart.Image.series(linear_prop4, p, scale=1000, xProperty='test', properties=['LINEAR_FUNCTION'], label_properties=['mean=10 min=0 max=10'])
linear_prop5 = tools.imagecollection.linearFunctionProperty(collection, 'test', mean=10, output_min=5, output_max=20)
linear_prop5_chart = ui.chart.Image.series(linear_prop5, p, scale=1000, xProperty='test', properties=['LINEAR_FUNCTION'], label_properties=['mean=10 min=5 max=20'])
linear_chart_prop = linear_prop1_chart.cat(linear_prop2_chart, linear_prop3_chart, linear_prop4_chart, linear_prop5_chart)
linear_chart_prop.renderWidget(width=800)
linear_chart_prop.dataframe<jupyter_output><empty_output><jupyter_text>Gauss Function  Over a band<jupyter_code>gauss_band1 = tools.imagecollection.gaussFunctionBand(collection, 'test')
gauss_band1_chart = ui.chart.Image.series(gauss_band1, ee.Geometry.Point([0, 0]), scale=1000, xProperty='test', bands=['gauss'], label_bands=['defualt'])
gauss_band2 = tools.imagecollection.gaussFunctionBand(collection, 'test', mean=10)
gauss_band2_chart = ui.chart.Image.series(gauss_band2, ee.Geometry.Point([0, 0]), scale=1000, xProperty='test', bands=['gauss'], label_bands=['mean=10'])
gauss_band3 = tools.imagecollection.gaussFunctionBand(collection, 'test', mean=10, output_min=0.5)
gauss_band3_chart = ui.chart.Image.series(gauss_band3, ee.Geometry.Point([0, 0]), scale=1000, xProperty='test', bands=['gauss'], label_bands=['mean=10 min=0.5'])<jupyter_output><empty_output><jupyter_text>Exponential function using the gauss functionUse as mean value the range_max<jupyter_code>gauss_band4 = tools.imagecollection.gaussFunctionBand(collection, 'test', mean=23, output_min=0.5)
gauss_band4_chart = ui.chart.Image.series(gauss_band4, ee.Geometry.Point([0, 0]), scale=1000, xProperty='test', bands=['gauss'], label_bands=['Exponential'])
gauss_band_chart = gauss_band1_chart.cat(gauss_band2_chart, gauss_band3_chart, gauss_band4_chart)
gauss_band_chart.renderWidget(width=800)
gauss_band_chart.dataframe<jupyter_output><empty_output><jupyter_text>Over a Property<jupyter_code>gauss_prop1 = tools.imagecollection.gaussFunctionProperty(collection, 'test')
gauss_prop1_chart = ui.chart.Image.series(gauss_prop1, ee.Geometry.Point([0, 0]), scale=1000, xProperty='test', properties=['GAUSS'], label_properties=['defualt'])
gauss_prop2 = tools.imagecollection.gaussFunctionProperty(collection, 'test', mean=10)
gauss_prop2_chart = ui.chart.Image.series(gauss_prop2, ee.Geometry.Point([0, 0]), scale=1000, xProperty='test', properties=['GAUSS'], label_properties=['mean=10'])
gauss_prop3 = tools.imagecollection.gaussFunctionProperty(collection, 'test', mean=10, output_min=0.5)
gauss_prop3_chart = ui.chart.Image.series(gauss_prop3, ee.Geometry.Point([0, 0]), scale=1000, xProperty='test', properties=['GAUSS'], label_properties=['mean=10 min=0.5'])
gauss_prop = gauss_prop1_chart.cat(gauss_prop2_chart, gauss_prop3_chart)
gauss_prop.renderWidget(width=800)
gauss_prop.dataframe<jupyter_output><empty_output><jupyter_text>Normal Distribution (applies the Gauss function using a computed stdDev and mean)  Over a Property<jupyter_code>normal_prop = tools.imagecollection.normalDistributionProperty(collection, 'test')
normal_prop_chart = ui.chart.Image.series(normal_prop, ee.Geometry.Point([0, 0]), scale=1000, xProperty='test', properties=['NORMAL_DISTRIBUTION'], label_properties=['defualt'])
normal_prop_chart.renderWidget(width=800)
normal_prop_chart.dataframe<jupyter_output><empty_output><jupyter_text>Over a Band<jupyter_code>normal_band = tools.imagecollection.normalDistributionBand(collection, 'test')
normal_band_chart = ui.chart.Image.series(normal_band, ee.Geometry.Point([0, 0]), scale=1000, xProperty='test', bands=['normal_distribution'], label_bands=['defualt'])
normal_band_chart.renderWidget(width=800)
normal_band_chart.dataframe<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14488719601523586, 'fraction_numerical': 0.049809551714034575, 'mean_word_length': 10.51264755480607, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '369644', 'license': 'MIT', 'n_tokens_mistral': 2529, 'n_tokens_neox': 2340, 'n_words': 377, 'path': 'notebooks/imagecollection/distributions.ipynb', 'repo_name': 'hubert-thieriot/gee_tools', 'size': '6826'}