অ্যারে এবং তালিকা চার্ট

ui.Chart.array.values ​​ফাংশন ee.Array এবং ee.List অবজেক্ট থেকে চার্ট রেন্ডার করার জন্য একটি পদ্ধতি প্রদান করে।

নিম্নলিখিত উদাহরণগুলি ee.Reducer.toList() রিডুসার ব্যবহার করে ইমেজ ব্যান্ড এবং ইমেজ মেটাডেটা হ্রাস করে তৈরি করা অ্যারে এবং তালিকা ডেটার উপর নির্ভর করে। উল্লেখ্য যে একটি নির্দিষ্ট অক্ষ বরাবর একই দৈর্ঘ্যের তালিকা এবং/অথবা অ্যারের যেকোন সেট ui.Chart.array.values ​​দ্বারা প্লট করা যেতে পারে।

ee.Array অঞ্চল স্ক্যাটার প্লট

ee.Reducer.toList() দ্বারা চিত্র অঞ্চল হ্রাস পিক্সেল মান তালিকার একটি অভিধান তৈরি করে, একটি প্রদত্ত চিত্রের প্রতিটি ব্যান্ডের জন্য একটি। এখানে, এটি একটি বনজ পরিবেশে ছেদ করা পিক্সেলগুলির জন্য একটি MODIS চিত্র থেকে লাল, NIR, এবং SWIR প্রতিফলিত মান তালিকা বের করতে ব্যবহৃত হয়। লাল প্রতিফলন মানগুলি x-অক্ষে প্লট করা হয়, NIR এবং SWIR মানগুলি y-অক্ষে প্লট করা হয়।

প্রজেক্ট/google/charts_feature_example অ্যাসেট, এই উদাহরণে ব্যবহার করা হয়েছে একটি বন-বাস্তব অঞ্চলকে চিত্রিত করার জন্য, প্রদর্শনের উদ্দেশ্যে তৈরি করা হয়েছে। এটি তিনটি ইকোরিজিয়ন বহুভুজের একটি সংগ্রহ যা জলবায়ুর স্বাভাবিক অবস্থা বর্ণনা করে।

কোড এডিটর (জাভাস্ক্রিপ্ট)

// Import the example feature collection and subset the forest feature.
var forest = ee.FeatureCollection('projects/google/charts_feature_example')
                 .filter(ee.Filter.eq('label', 'Forest'));

// Define a MODIS surface reflectance composite.
var modisSr = ee.ImageCollection('MODIS/006/MOD09A1')
                  .filter(ee.Filter.date('2018-06-01', '2018-09-01'))
                  .select('sur_refl_b0[0-7]')
                  .mean();

// Reduce MODIS reflectance bands by forest region; get a dictionary with
// band names as keys, pixel values as lists.
var pixelVals = modisSr.reduceRegion(
    {reducer: ee.Reducer.toList(), geometry: forest.geometry(), scale: 2000});

// Convert NIR and SWIR value lists to an array to be plotted along the y-axis.
var yValues = pixelVals.toArray(['sur_refl_b02', 'sur_refl_b06']);

// Get the red band value list; to be plotted along the x-axis.
var xValues = ee.List(pixelVals.get('sur_refl_b01'));

// Define the chart and print it to the console.
var chart = ui.Chart.array.values({array: yValues, axis: 1, xLabels: xValues})
                .setSeriesNames(['NIR', 'SWIR'])
                .setOptions({
                  title: 'Relationship Among Spectral Bands for Forest Pixels',
                  colors: ['1d6b99', 'cf513e'],
                  pointSize: 4,
                  dataOpacity: 0.4,
                  hAxis: {
                    'title': 'Red reflectance (x1e4)',
                    titleTextStyle: {italic: false, bold: true}
                  },
                  vAxis: {
                    'title': 'Reflectance (x1e4)',
                    titleTextStyle: {italic: false, bold: true}
                  }
                });
print(chart);

ee.List অঞ্চল স্ক্যাটার প্লট

ui.Chart.array.values ​​ফাংশন ব্যবহার করে দুটি তালিকা বস্তু প্লট করা যেতে পারে। পূর্ববর্তী উদাহরণটি তৈরি করে, x- এবং y-অক্ষের মান তালিকাগুলি লাল এবং SWIR প্রতিফলনকে প্রতিনিধিত্ব করে একটি স্ক্যাটার প্লট হিসাবে রেন্ডার করা হয়েছে।

কোড এডিটর (জাভাস্ক্রিপ্ট)

// Get Red and SWIR value lists; to be plotted along x and y axes, respectively.
// Note that the pixelVals object is defined in the previous code block.
var x = ee.List(pixelVals.get('sur_refl_b01'));
var y = ee.List(pixelVals.get('sur_refl_b06'));

// Define the chart and print it to the console.
var chart = ui.Chart.array.values({array: y, axis: 0, xLabels: x}).setOptions({
  title: 'Relationship Among Spectral Bands for Forest Pixels',
  colors: ['cf513e'],
  hAxis: {
    title: 'Red reflectance (x1e4)',
    titleTextStyle: {italic: false, bold: true}
  },
  vAxis: {
    title: 'SWIR reflectance (x1e4)',
    titleTextStyle: {italic: false, bold: true}
  },
  pointSize: 4,
  dataOpacity: 0.4,
  legend: {position: 'none'},
});
print(chart);

ee.List ট্রান্সেক্ট লাইন প্লট

ee.Reducer.toList() দ্বারা চিত্র অঞ্চল হ্রাস পিক্সেল মান তালিকার একটি অভিধান তৈরি করে, প্রতিটি চিত্র ব্যান্ডের জন্য একটি। যদি অঞ্চলটি একটি রেখা হয়, যেমন এই ক্ষেত্রে, একটি ভৌগলিক ট্রানসেক্ট তৈরি করা যেতে পারে যখন অক্ষাংশ এবং দ্রাঘিমাংশ ব্যান্ডগুলি আগ্রহের ছবিতে ব্যান্ড হিসাবে অন্তর্ভুক্ত করা হয়। এখানে, ট্রানসেক্ট লাইন বরাবর থেকে দ্রাঘিমাংশ এবং উচ্চতা পিক্সেল মান তালিকাগুলি পৃথক ভেরিয়েবল হিসাবে বের করা হয় এবং যথাক্রমে x- এবং y-অক্ষে প্লট করা হয়।

কোড এডিটর (জাভাস্ক্রিপ্ট)

// Define a line across the Olympic Peninsula, USA.
var transect = ee.Geometry.LineString([[-122.8, 47.8], [-124.5, 47.8]]);

// Define a pixel coordinate image.
var latLonImg = ee.Image.pixelLonLat();

// Import a digital surface model and add latitude and longitude bands.
var elevImg =
    ee.Image('JAXA/ALOS/AW3D30/V2_2').select('AVE_DSM').addBands(latLonImg);

// Reduce elevation and coordinate bands by transect line; get a dictionary with
// band names as keys, pixel values as lists.
var elevTransect = elevImg.reduceRegion({
  reducer: ee.Reducer.toList(),
  geometry: transect,
  scale: 1000,
});

// Get longitude and elevation value lists from the reduction dictionary.
var lon = ee.List(elevTransect.get('longitude'));
var elev = ee.List(elevTransect.get('AVE_DSM'));

// Sort the longitude and elevation values by ascending longitude.
var lonSort = lon.sort(lon);
var elevSort = elev.sort(lon);

// Define the chart and print it to the console.
var chart = ui.Chart.array.values({array: elevSort, axis: 0, xLabels: lonSort})
                .setOptions({
                  title: 'Elevation Profile Across Longitude',
                  hAxis: {
                    title: 'Longitude',
                    viewWindow: {min: -124.50, max: -122.8},
                    titleTextStyle: {italic: false, bold: true}
                  },
                  vAxis: {
                    title: 'Elevation (m)',
                    titleTextStyle: {italic: false, bold: true}
                  },
                  colors: ['1d6b99'],
                  lineSize: 5,
                  pointSize: 0,
                  legend: {position: 'none'}
                });
print(chart);

লাইনের নিচে ছায়া যোগ করতে .setChartType('AreaChart') প্রয়োগ করুন:

print(chart.setChartType('AreaChart'));

ee.List মেটাডেটা স্ক্যাটার প্লট

ee.Reducer.toList() দ্বারা সংগ্রহ সম্পত্তি হ্রাস সম্পত্তি মূল্য তালিকার একটি অভিধান তৈরি করে, প্রতিটি নির্বাচিত সম্পত্তির জন্য একটি। এখানে, ক্লাউড কভার এবং জ্যামিতিক RMSE সম্পত্তি তালিকা পৃথক ভেরিয়েবল হিসাবে Landsat 8 চিত্রের একটি সেট থেকে তৈরি করা হয়। ক্লাউড কভার ভেরিয়েবলটি x-অক্ষ বরাবর এবং জ্যামিতিক RMSE বরাবর y-অক্ষ বরাবর প্লট করা হয়েছে।

কোড এডিটর (জাভাস্ক্রিপ্ট)

// Import a Landsat 8 collection and filter to a single path/row.
var col = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2')
              .filter(ee.Filter.expression('WRS_PATH ==  45 && WRS_ROW == 30'));

// Reduce image properties to a series of lists; one for each selected property.
var propVals = col.reduceColumns({
                    reducer: ee.Reducer.toList().repeat(2),
                    selectors: ['CLOUD_COVER', 'GEOMETRIC_RMSE_MODEL']
                  })
                   .get('list');

// Get selected image property value lists; to be plotted along x and y axes.
var x = ee.List(ee.List(propVals).get(0));
var y = ee.List(ee.List(propVals).get(1));

// Define the chart and print it to the console.
var chart = ui.Chart.array.values({array: y, axis: 0, xLabels: x})
                .setChartType('ScatterChart')
                .setOptions({
                  title: 'Landsat 8 Image Collection Metadata (045030)',
                  colors: ['96356f'],
                  hAxis: {
                    title: 'Cloud cover (%)',
                    titleTextStyle: {italic: false, bold: true}
                  },
                  vAxis: {
                    title: 'Geometric RMSE (m)',
                    titleTextStyle: {italic: false, bold: true}
                  },
                  pointSize: 5,
                  dataOpacity: 0.6,
                  legend: {position: 'none'},
                });
print(chart);

ee.List ম্যাপড ফাংশন স্ক্যাটার এবং লাইন প্লট

y মানগুলির একটি অনুরূপ তালিকা গণনা করতে x মানের তালিকার উপর একটি ফাংশন ম্যাপ করুন। এখানে, sin() ফাংশনটি x-অক্ষ মানগুলির একটি তালিকার উপর ম্যাপ করা হয়েছে যাতে y-অক্ষের মানগুলির একটি অনুরূপ তালিকা তৈরি করা হয়। সাইন ওয়েভের একটি নমুনা দেখানো হয় যখন x এবং y তালিকা প্লট করা হয়।

কোড এডিটর (জাভাস্ক্রিপ্ট)

// Define a sequence from -2pi to +2pi in 50 increments.
var start = -2 * Math.PI;
var end = 2 * Math.PI;
var points = ee.List.sequence(start, end, null, 50);

// Evaluate the sin() function for each value in the points sequence.
var values = points.map(function(val) {
  return ee.Number(val).sin();
});

// Define the chart and print it to the console.
var chart = ui.Chart.array.values({array: values, axis: 0, xLabels: points})
                .setOptions({
                  title: 'Sine Function',
                  hAxis: {
                    title: 'radians',
                    viewWindowMode: 'maximized',
                    ticks: [
                      {v: start, f: '-2π'},
                      {v: -Math.PI, f: '-π'},
                      {v: 0, f: '0'},
                      {v: Math.PI, f: 'π'},
                      {v: end, f: '2π'}
                    ],
                    titleTextStyle: {italic: false, bold: true}
                  },
                  vAxis: {
                    title: 'sin(x)',
                    titleTextStyle: {italic: false, bold: true}
                  },
                  colors: ['39a8a7'],
                  lineWidth: 3,
                  pointSize: 7,
                  viewWindow: {min: start, max: end},
                  legend: {position: 'none'}
                });
print(chart);