يمكن عرض الصور التي يتألف منها ImageCollection إما كصورة متحركة أو كسلسلة من الصور المصغّرة يُشار إليها باسم "شريط سينمائي". تتيح هذه الطرق تقييمًا سريعًا لمحتوى ImageCollection ووسيلة فعّالة لمشاهدة التغيير المكاني الزمني (الشكل 1).
getVideoThumbURL()ينتج سلسلة صور متحركة-
getFilmstripThumbURL()لإنشاء سلسلة صور مصغّرة
توضّح الأقسام التالية كيفية إعداد ImageCollection
للعرض، وتقدّم أمثلة على الرموز البرمجية لكل طريقة عرض للمجموعة،
وتتناول العديد من أساليب الصور المتحركة المتقدّمة.

الشكل 1: صورة متحركة تعرض تقدّم الأعاصير الأطلسية على مدار ثلاثة أيام في سبتمبر 2017
التحضير لجمع البيانات
يمكنك فلترة الصور ودمجها وترتيبها وتنسيقها ضمن مجموعة لعرض الصور التي تهمّك فقط أو لتسليط الضوء على ظاهرة معيّنة. يمكن تقديم أي ImageCollection كإدخال لدوال العرض المرئي، ولكن يمكن تحقيق نتائج أفضل من خلال مجموعة منظَّمة تأخذ في الاعتبار النطاقات الزمنية بين السنوات وداخلها، وفترة الملاحظة، والامتداد الإقليمي، والجودة والتمثيل.
تصفية
فلترة مجموعة صور لتضمين البيانات ذات الصلة فقط التي تدعم الغرض من العرض المرئي ضع في اعتبارك التواريخ والمدى المكاني والجودة والخصائص الأخرى الخاصة بمجموعة بيانات معينة.
على سبيل المثال، يمكنك فلترة مجموعة انعكاس سطح Sentinel-2 حسب:
نطاق زمني واحد
أداة تعديل الرموز (JavaScript)
var s2col = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED') .filterDate('2018-01-01', '2019-01-01');
نطاق تسلسلي لليوم من السنة
أداة تعديل الرموز (JavaScript)
var s2col = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED') .filter(ee.Filter.calendarRange(171, 242, 'day_of_year'));
لمنطقة نريدها،
أداة تعديل الرموز (JavaScript)
var s2col = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED') .filterBounds(ee.Geometry.Point(-122.1, 37.2));
أو سمة صورة
أداة تعديل الرموز (JavaScript)
var s2col = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED') .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 50));
يمكنك ربط فلاتر متعددة.
أداة تعديل الرموز (JavaScript)
var s2col = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED') .filterDate('2018-01-01', '2019-01-01') .filterBounds(ee.Geometry.Point(-122.1, 37.2)) .filter('CLOUDY_PIXEL_PERCENTAGE < 50');
مُركَّب
يمكنك دمج النطاقات الزمنية السنوية وبين السنوات لتقليل عدد الصور في مجموعة وتحسين الجودة. على سبيل المثال، لنفترض أنّك تريد إنشاء تمثيل مرئي لمؤشر NDVI السنوي في أفريقيا. أحد الخيارات هو ببساطة تصفية مجموعة MODIS 16-day NDVI لتشمل جميع ملاحظات عام 2018.
أداة تعديل الرموز (JavaScript)
var ndviCol = ee.ImageCollection('MODIS/061/MOD13A2') .filterDate('2018-01-01', '2019-01-01') .select('NDVI');
صورة مركّبة بين السنوات باستخدام الفلترة والتقليل
يُظهر عرض المجموعة أعلاه تشويشًا كبيرًا في المناطق الحرجية التي يكون فيها الغطاء السحابي كثيفًا (الشكل 2 أ). يمكن تحقيق تمثيل أفضل من خلال تقليل النطاقات الزمنية التسلسلية حسب المتوسط على مدار جميع السنوات في مجموعة MODIS.
أداة تعديل الرموز (JavaScript)
// Make a day-of-year sequence from 1 to 365 with a 16-day step. var doyList = ee.List.sequence(1, 365, 16); // Import a MODIS NDVI collection. var ndviCol = ee.ImageCollection('MODIS/061/MOD13A2').select('NDVI'); // Map over the list of days to build a list of image composites. var ndviCompList = doyList.map(function(startDoy) { // Ensure that startDoy is a number. startDoy = ee.Number(startDoy); // Filter images by date range; starting with the current startDate and // ending 15 days later. Reduce the resulting image collection by median. return ndviCol .filter(ee.Filter.calendarRange(startDoy, startDoy.add(15), 'day_of_year')) .reduce(ee.Reducer.median()); }); // Convert the image List to an ImageCollection. var ndviCompCol = ee.ImageCollection.fromImages(ndviCompList);
تكون الصورة المتحركة الناتجة عن هذه المجموعة أقل تشويشًا، لأنّ كل صورة تمثّل متوسط مؤشر NDVI المركّب لمدة 16 يومًا لأكثر من 20 عامًا من البيانات (الشكل 1 ب). يمكنك الاطّلاع على هذا البرنامج التعليمي لمزيد من المعلومات حول هذه الحركة.
![]() |
![]() |
|---|---|
| الشكل 2 (أ). مؤشر NDVI السنوي بدون دمج البيانات بين السنوات | الشكل 2 (ب). مؤشر NDVI السنوي مع التركيب السنوي |
صورة مركّبة سنوية حسب الفلترة والتقليل
يطبّق المثال السابق التركيب بين السنوات. ويمكن أن يكون من المفيد أيضًا تجميع سلسلة من الملاحظات السنوية. على سبيل المثال، يتم جمع بيانات Landsat كل ستة عشر يومًا لمشهد معين لكل أداة استشعار، ولكن غالبًا ما يتم حجب جزء من الصور بواسطة السحب. Masking out the clouds and compositing several images from the same season can produce a more cloud-free representation. لنفترض المثال التالي حيث يتم تجميع صور Landsat 5 من شهري يوليو وأغسطس باستخدام المتوسط لكل عام من 1985 إلى 2011.
أداة تعديل الرموز (JavaScript)
// Assemble a collection of Landsat surface reflectance images for a given // region and day-of-year range. var lsCol = ee.ImageCollection('LANDSAT/LT05/C02/T1_L2') .filterBounds(ee.Geometry.Point(-122.9, 43.6)) .filter(ee.Filter.dayOfYear(182, 243)) // Add the observation year as a property to each image. .map(function(img) { return img.set('year', ee.Image(img).date().get('year')); }); // Define a function to scale the data and mask unwanted pixels. function maskL457sr(image) { // Bit 0 - Fill // Bit 1 - Dilated Cloud // Bit 2 - Unused // Bit 3 - Cloud // Bit 4 - Cloud Shadow var qaMask = image.select('QA_PIXEL').bitwiseAnd(parseInt('11111', 2)).eq(0); var saturationMask = image.select('QA_RADSAT').eq(0); // Apply the scaling factors to the appropriate bands. var opticalBands = image.select('SR_B.').multiply(0.0000275).add(-0.2); var thermalBand = image.select('ST_B6').multiply(0.00341802).add(149.0); // Replace the original bands with the scaled ones and apply the masks. return image.addBands(opticalBands, null, true) .addBands(thermalBand, null, true) .updateMask(qaMask) .updateMask(saturationMask); } // Define a list of unique observation years from the image collection. var years = ee.List(lsCol.aggregate_array('year')).distinct().sort(); // Map over the list of years to build a list of annual image composites. var lsCompList = years.map(function(year) { return lsCol // Filter image collection by year. .filterMetadata('year', 'equals', year) // Apply cloud mask. .map(maskL457sr) // Reduce image collection by median. .reduce(ee.Reducer.median()) // Set composite year as an image property. .set('year', year); }); // Convert the image List to an ImageCollection. var lsCompCol = ee.ImageCollection.fromImages(lsCompList);
صورة مركّبة خلال العام من خلال الدمج والتقليل
يُرجى العِلم أنّ طريقتَي التركيب السابقتَين يتم تطبيقهما على List من الأيام
والسنوات لتحديد تواريخ جديدة بشكل تدريجي من أجل الفلترة والتركيب.
يُعد تطبيق الدمج طريقة أخرى لتحقيق هذه العملية. في المقتطف التالي، يتم تحديد مجموعة فريدة من السنوات ثم يتم تطبيق عملية دمج saveAll لتحديد جميع الصور التي تتوافق مع سنة معيّنة.
يتم تجميع الصور التي تنتمي إلى سنة معينة في كائن List يتم تخزينه كخاصية لممثل السنة المعنية في مجموعة السنة المميزة. يتم إنشاء الصور المركّبة السنوية من هذه القوائم عن طريق تقليل
ImageCollections المحدّدة من خلالها في دالة تم ربطها بمجموعة
السنوات المميّزة.
أداة تعديل الرموز (JavaScript)
// Assemble a collection of Landsat surface reflectance images for a given // region and day-of-year range. var lsCol = ee.ImageCollection('LANDSAT/LT05/C02/T1_L2') .filterBounds(ee.Geometry.Point(-122.9, 43.6)) .filter(ee.Filter.dayOfYear(182, 243)) // Add the observation year as a property to each image. .map(function(img) { return img.set('year', ee.Image(img).date().get('year')); }); // Make a distinct year collection; one image representative per year. var distinctYears = lsCol.distinct('year').sort('year'); // Define a join filter; one-to-many join on ‘year’ property. var filter = ee.Filter.equals({leftField: 'year', rightField: 'year'}); // Define a join. var join = ee.Join.saveAll('year_match'); // Apply the join; results in 'year_match' property being added to each distinct // year representative image. The list includes all images in the collection // belonging to the respective year. var joinCol = join.apply(distinctYears, lsCol, filter); // Define a function to scale the data and mask unwanted pixels. function maskL457sr(image) { // Bit 0 - Fill // Bit 1 - Dilated Cloud // Bit 2 - Unused // Bit 3 - Cloud // Bit 4 - Cloud Shadow var qaMask = image.select('QA_PIXEL').bitwiseAnd(parseInt('11111', 2)).eq(0); var saturationMask = image.select('QA_RADSAT').eq(0); // Apply the scaling factors to the appropriate bands. var opticalBands = image.select('SR_B.').multiply(0.0000275).add(-0.2); var thermalBand = image.select('ST_B6').multiply(0.00341802).add(149.0); // Replace the original bands with the scaled ones and apply the masks. return image.addBands(opticalBands, null, true) .addBands(thermalBand, null, true) .updateMask(qaMask) .updateMask(saturationMask); } // Map over the distinct years collection to build a list of annual image // composites. var lsCompList = joinCol.map(function(img) { // Get the list of images belonging to the given year. return ee.ImageCollection.fromImages(img.get('year_match')) // Apply cloud mask. .map(maskL457sr) // Reduce image collection by median. .reduce(ee.Reducer.median()) // Set composite year as an image property. .copyProperties(img, ['year']); }); // Convert the image List to an ImageCollection. var lsCompCol = ee.ImageCollection(lsCompList);
صورة مركّبة في اليوم نفسه من خلال الدمج والتقليل
هناك حالة أخرى للتركيب وهي إنشاء فسيفساء صور متجاورة مكانيًا. لنفترض أنّ المنطقة التي تهمّك تمتد على صفَّين من Landsat ضمن المسار نفسه، وأنّ هدفك هو عرض فسيفساء من الصورتَين لكل مدار من Landsat 8 في عامَي 2017 و2018. هنا، بعد تصفية المجموعة حسب المسار والصف، يتم استخدام عملية دمج لفسيفساء صور Landsat من نفس المدار، المحددة حسب تاريخ الاستحواذ.
أداة تعديل الرموز (JavaScript)
var lsCol = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2') .filterDate('2017-01-01', '2019-01-01') .filter('WRS_PATH == 38 && (WRS_ROW == 28 || WRS_ROW == 29)') .map(function(img) { var date = img.date().format('yyyy-MM-dd'); return img.set('date', date); }); var distinctDates = lsCol.distinct('date').sort('date'); var filter = ee.Filter.equals({leftField: 'date', rightField: 'date'}); var join = ee.Join.saveAll('date_match'); var joinCol = join.apply(distinctDates, lsCol, filter); var lsColMos = ee.ImageCollection(joinCol.map(function(col) { return ee.ImageCollection.fromImages(col.get('date_match')).mosaic(); }));
ترتيب
يمكنك فرز مجموعة حسب الوقت لضمان التسلسل الزمني الصحيح، أو الترتيب
حسب سمة من اختيارك. يتم ترتيب سلسلة إطارات العرض المرئي تلقائيًا
حسب الترتيب الطبيعي للمجموعة. يمكن تغيير ترتيب السلسلة باستخدام طريقة التجميع sort، حيث يتم اختيار سمة Image للترتيب إما تصاعديًا أو تنازليًا. على سبيل المثال، للترتيب حسب وقت الرصد، استخدِم السمة system:time_start الشائعة.
أداة تعديل الرموز (JavaScript)
var s2col = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED') .filterBounds(ee.Geometry.Point(-122.1, 37.2)) .sort('system:time_start');
أو ربما يجب تحديد الترتيب من خلال زيادة الغيوم، كما هو الحال في صور Sentinel-2.
أداة تعديل الرموز (JavaScript)
var s2col = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED') .filterBounds(ee.Geometry.Point(-122.1, 37.2)) .sort('CLOUDY_PIXEL_PERCENTAGE');
يمكن أيضًا تحديد الترتيب من خلال سمة مشتقة، مثل متوسط مؤشر NDVI الإقليمي. هنا، تتم إضافة مؤشر NDVI الإقليمي كسمة لكل صورة في دالة معيّنة، ثم يتم الفرز حسب السمة الجديدة.
أداة تعديل الرموز (JavaScript)
// Define an area of interest geometry. var aoi = ee.Geometry.Point(-122.1, 37.2).buffer(1e4); // Filter MODIS NDVI image collection by a date range. var ndviCol = ee.ImageCollection('MODIS/061/MOD13A1') .filterDate('2018-01-01', '2019-01-01') .select('NDVI') // Map over the image collection to calculate regional mean NDVI and add // the result to each image as a property. .map(function(img) { var meanNdvi = img.reduceRegion({ reducer: ee.Reducer.mean(), geometry: aoi, scale: 500}); return img.set('meanNdvi', meanNdvi.get('NDVI')); }) // Sort the collection by descending regional mean NDVI. .sort('meanNdvi', false);
العرض المرئي للصور
يحوّل عرض الصور الأرقام إلى ألوان. هناك ثلاث طرق للتحكّم في كيفية تمثيل بيانات الصور كألوان في طرق العرض المرئي للمجموعة:
- قدِّم وسيطات العرض المرئي مباشرةً إلى
getVideoThumbURLوgetFilmstripThumbURL. - يجب ربط طريقة الصورة
visualizeبمجموعة الصور قبل تطبيقgetVideoThumbURLوgetFilmstripThumbURL. - يجب ربط طريقة الصورة
sldStyleبمجموعة الصور قبل تطبيقgetVideoThumbURLوgetFilmstripThumbURL. يمكنك الاطّلاع على Styled Layer Descriptor لمزيد من المعلومات.
تستخدم الأمثلة في هذا الدليل الخيارَين 1 و2، حيث يتم تحقيق التصور من خلال ربط ثلاثة نطاقات صور لصورة متعددة النطاقات بقنوات الألوان الأحمر والأخضر والأزرق أو قيم التدرج لنطاق واحد خطيًا على طول لوحة الألوان. تشمل مَعلمات العرض المرئي ما يلي:
| المَعلمة | الوصف | النوع |
|---|---|---|
| فرق موسيقية | قائمة مفصولة بفواصل لثلاثة أسماء نطاقات يتم ربطها بالنموذج اللوني أحمر أخضر أزرق | قائمة |
| دقيقة | القيم المطلوب ربطها بالرقم 0 | رقم أو قائمة من ثلاثة أرقام، رقم واحد لكل نطاق |
| max | القيم التي سيتم ربطها بـ 255 | رقم أو قائمة من ثلاثة أرقام، رقم واحد لكل نطاق |
| gain | القيم التي سيتم ضرب كل قيمة بكسل بها | رقم أو قائمة من ثلاثة أرقام، رقم واحد لكل نطاق |
| bias | القيم المطلوب إضافتها إلى كل اسم مميّز | رقم أو قائمة من ثلاثة أرقام، رقم واحد لكل نطاق |
| gamma | عوامل تصحيح غاما | رقم أو قائمة من ثلاثة أرقام، رقم واحد لكل نطاق |
| palette | قائمة بسلاسل الألوان بنمط CSS (صور النطاق الفردي فقط) | قائمة قيم مفصولة بفاصلة لسلاسل سداسية عشرية |
| opacity | تعتيم الطبقة (0.0 شفاف تمامًا و1.0 معتم تمامًا) | الرقم |
استخدِم الوسيطة bands لاختيار النطاقات التي تريد عرضها. قدِّم قائمة بأسماء فرقة واحدة أو ثلاث فرق. بالنسبة إلى الصور المتعددة النطاقات،
يتم اختيار النطاقات الثلاثة الأولى تلقائيًا. يحدّد ترتيب أسماء النطاقات
تخصيص الألوان، حيث يتم ربط النطاقات الأولى والثانية والثالثة المدرَجة
بالألوان الأحمر والأخضر والأزرق على التوالي.
يُعدّ تحديد نطاق البيانات من الاعتبارات المهمة عند عرض الصور. بشكل تلقائي، يتم تغيير حجم قيم بيانات النقاط العائمة بين 0 و1 (بما في ذلك) بين 0 و255 (بما في ذلك). يتم فرض القيم خارج هذا النطاق على 0 و255 اعتمادًا على ما إذا كانت أقل من 0 أو أكبر من 1، على التوالي. في ما يتعلق ببيانات الأعداد الصحيحة، يتم تحويل السعة الكاملة المحدّدة حسب نوعها إلى مقياس بين 0 و255 (على سبيل المثال، تتراوح بيانات 16 بت الموقَّعة بين -32,768 و32,767، ويتم تحويلها تلقائيًا إلى مقياس بين [0 و255]). غالبًا ما يؤدي قبول الإعدادات التلقائية إلى إنشاء عروض مرئية ذات تباين ضئيل أو معدوم بين ميزات الصورة. استخدم min وmax لتحسين التباين والتأكيد على
نطاق بيانات معين. من الأفضل ضبط min وmax على قيم تمثّل الشريحة المئوية الثانية والشريحة المئوية الثامنة والتسعين للبيانات ضمن المنطقة التي تهمّك. انظر المثال التالي لحساب هذه القيم لنموذج الارتفاع الرقمي.
أداة تعديل الرموز (JavaScript)
// Import NASADEM global elevation model. var demImg = ee.Image('NASA/NASADEM_HGT/001').select('elevation'); // Define a rectangular area of interest. var aoi = ee.Geometry.Polygon( [[ [-103.84153083119054, 49.083004219142886], [-103.84153083119054, 25.06838270664608], [-85.64817145619054, 25.06838270664608], [-85.64817145619054, 49.083004219142886] ]], null, false); // Calculate the 2nd and 98th percentile elevation values from rescaled (to // 500m) pixels intersecting the area of interest. A Dictionary is returned. var percentClip = demImg.reduceRegion({ reducer: ee.Reducer.percentile([2, 98]), geometry: aoi, scale: 500, maxPixels: 3e7 }); // Print the regional 2nd and 98th percentile elevation values. Get the // dictionary keys and use them to get the values for each percentile summary. var keys = percentClip.keys(); print('Set vis min to:', ee.Number(percentClip.get(keys.get(0))).round()); print('Set vis max to:', ee.Number(percentClip.get(keys.get(1))).round());
تحدّد المَعلمة palette الألوان التي تمثّل صورة العرض المرئي بدقة 8 بت. وينطبق ذلك فقط على تمثيلات النطاق الواحد،
ويؤدي تحديده باستخدام صورة متعددة النطاقات إلى حدوث خطأ.
إذا كانت البيانات أحادية النطاق أو إذا أردت عرض نطاق واحد من صورة متعددة النطاقات، اضبط المَعلمة forceRgbOutput على true (غير ضروري إذا تم تقديم الوسيطة palette). استخدِم المَعلمتَين min وmax لتحديد نطاق القيم التي سيتم تغيير حجمها خطيًا بين 0 و255.
في ما يلي مثال على ربط دالة تصور بمجموعة صور أحادية النطاق. يتم استيراد مجموعة MODIS NDVI، ويتم ضبط وسيطات العرض المرئي لطريقة visualization، ويتم ربط دالة تحوّل القيم إلى تمثيلات صور النموذج اللوني أحمر أخضر أزرق (RGB) على مجموعة NDVI.
أداة تعديل الرموز (JavaScript)
// Filter MODIS NDVI image collection by a date range. var ndviCol = ee.ImageCollection('MODIS/061/MOD13A1') .filterDate('2018-01-01', '2019-01-01') .select('NDVI'); // Define visualization arguments. var visArgs = { min: 0, max: 9000, palette: [ 'FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901', '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01', '012E01', '011D01', '011301' ] }; // Define a function to convert an image to an RGB visualization image and copy // properties from the original image to the RGB image. var visFun = function(img) { return img.visualize(visArgs).copyProperties(img, img.propertyNames()); }; // Map over the image collection to convert each image to an RGB visualization // using the previously defined visualization function. var ndviColVis = ndviCol.map(visFun);
في ما يلي مثال على ربط دالة عرض بمجموعة صور متعددة النطاقات:
أداة تعديل الرموز (JavaScript)
// Assemble a collection of Sentinel-2 surface reflectance images for a given // region and date range. var s2col = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED') .filterBounds(ee.Geometry.Point(-96.9037, 48.0395)) .filterDate('2019-06-01', '2019-10-01'); // Define visualization arguments. var visArgs = {bands: ['B11', 'B8', 'B3'], min: 300, max: 3500}; // Define a function to convert an image to an RGB visualization image and copy // properties from the original image to the RGB image. var visFun = function(img) { return img.visualize(visArgs).copyProperties(img, img.propertyNames()); }; // Map over the image collection to convert each image to an RGB visualization // using the previously defined visualization function. var s2colVis = s2col.map(visFun);
في هذه الحالة، لا يتم تقديم وسيطة لوحة ألوان لأنّه يتم تقديم ثلاث حزم،
والتي تحدّد مستوى الجهد لكل طبقة من النموذج اللوني أحمر أخضر أزرق. يُرجى العِلم أنّ كلا المثالَين يستخدمان المَعلمتَين min وmax للتحكّم في القيم التي يتم تمديدها إلى حدود بيانات النموذج اللوني أحمر أخضر أزرق (RGB) ذات الـ 8 بت.
صورة مصغّرة للفيديو
تنشئ الدالة getVideoThumbURL() صورة متحركة من جميع الصور في
ImageCollection حيث تمثّل كل صورة إطارًا. في ما يلي سير العمل العام لإنشاء صورة متحركة:
- حدِّد
Geometryتحدّد حدوده النطاق الإقليمي للحركة. - تحديد
ImageCollection - Consider image visualization: either map an image visualization function over the collection or add image visualization arguments to the set of animation arguments.
- حدِّد وسيطات الحركة واستدعِ طريقة
getVideoThumbURL.
نتيجة getVideoThumbURL هي عنوان URL. اطبع عنوان URL إلى وحدة التحكّم وانقر عليه لبدء خوادم Earth Engine في إنشاء الصورة المتحركة بسرعة في علامة تبويب متصفّح جديدة. يمكنك بدلاً من ذلك عرض الصورة المتحركة في وحدة تحكّم "أداة تعديل الرموز" من خلال استدعاء الدالة ui.Thumbnail في المجموعة ووسيطات الصور المتحركة المقابلة لها. عند العرض، تكون الرسوم المتحركة متاحة للتنزيل عن طريق النقر بزر الماوس الأيمن عليها وتحديد الخيارات المناسبة من قائمة السياق الخاصة بها.
يوضّح المثال التالي كيفية إنشاء صورة متحركة تصوّر درجات الحرارة العالمية على مدار 24 ساعة. يُرجى العِلم أنّ هذا المثال يتضمّن وسيطات العرض المرئي مع وسيطات الصور المتحركة، بدلاً من ربط دالة العرض المرئي أولاً بـ ImageCollection. عند تشغيل هذا النص البرمجي، من المفترض أن تظهر صورة متحركة مشابهة للشكل 3 في وحدة تحكّم "أداة تعديل الرموز".
أداة تعديل الرموز (JavaScript)
// Define an area of interest geometry with a global non-polar extent. var aoi = ee.Geometry.Polygon( [[[-179.0, 78.0], [-179.0, -58.0], [179.0, -58.0], [179.0, 78.0]]], null, false); // Import hourly predicted temperature image collection for northern winter // solstice. Note that predictions extend for 384 hours; limit the collection // to the first 24 hours. var tempCol = ee.ImageCollection('NOAA/GFS0P25') .filterDate('2018-12-22', '2018-12-23') .limit(24) .select('temperature_2m_above_ground'); // Define arguments for animation function parameters. var videoArgs = { dimensions: 768, region: aoi, framesPerSecond: 7, crs: 'EPSG:3857', min: -40.0, max: 35.0, palette: ['blue', 'purple', 'cyan', 'green', 'yellow', 'red'] }; // Print the animation to the console as a ui.Thumbnail using the above defined // arguments. Note that ui.Thumbnail produces an animation when the first input // is an ee.ImageCollection instead of an ee.Image. print(ui.Thumbnail(tempCol, videoArgs)); // Alternatively, print a URL that will produce the animation when accessed. print(tempCol.getVideoThumbURL(videoArgs));

الشكل 3: درجة حرارة السطح لكل ساعة في الانقلاب الشتوي الشمالي
ممثلة كصورة GIF متحركة.
شريط الصور
تُنشئ الدالة getFilmstripThumbUrl صورة ثابتة واحدة تمثّل دمج جميع الصور في ImageCollection في سلسلة من الشمال إلى الجنوب. يتبع تسلسل إطارات شريط الصور الترتيب الطبيعي
للمجموعة.
نتيجة getFilmstripThumbUrl هي عنوان URL. اطبع عنوان URL إلى وحدة التحكم
وانقر فوقه لبدء خوادم Earth Engine في إنشاء الصورة بسرعة في
علامة تبويب متصفح جديدة. عند العرض، تكون الصورة متاحة للتنزيل من خلال
النقر بزر الماوس الأيمن عليها واختيار الخيارات المناسبة من قائمة السياق الخاصة بها.
يستخدم مقتطف الرمز التالي المجموعة نفسها المستخدَمة في مثال الصورة المصغّرة للفيديو أعلاه. Upon running this script, a filmstrip similar to Figure 4 should appear in the Code Editor console.
أداة تعديل الرموز (JavaScript)
// Define an area of interest geometry with a global non-polar extent. var aoi = ee.Geometry.Polygon( [[[-179.0, 78.0], [-179.0, -58.0], [179.0, -58.0], [179.0, 78.0]]], null, false); // Import hourly predicted temperature image collection for northern winter // solstice. Note that predictions extend for 384 hours; limit the collection // to the first 24 hours. var tempCol = ee.ImageCollection('NOAA/GFS0P25') .filterDate('2018-12-22', '2018-12-23') .limit(24) .select('temperature_2m_above_ground'); // Define arguments for the getFilmstripThumbURL function parameters. var filmArgs = { dimensions: 128, region: aoi, crs: 'EPSG:3857', min: -40.0, max: 35.0, palette: ['blue', 'purple', 'cyan', 'green', 'yellow', 'red'] }; // Print a URL that will produce the filmstrip when accessed. print(tempCol.getFilmstripThumbURL(filmArgs));

الشكل 4. درجة الحرارة السطحية لكل ساعة للانقلاب الشتوي الشمالي
ممثلة كصورة PNG لشريط فيلم. يُرجى العِلم أنّه تم تقسيم شريط الصور إلى أربعة أقسام للعرض، والنتيجة التي تظهر في getFilmstripThumbURL هي سلسلة واحدة من صور المجموعة المجمّعة من الشمال إلى الجنوب.
أساليب متقدّمة
توضّح الأقسام التالية كيفية استخدام الاقتصاص والشفافية وتركيب الطبقات لتحسين العروض المرئية من خلال إضافة حدود المضلّعات والتركيز على المناطق محل الاهتمام ومقارنة الصور ضمن مجموعة.
يُرجى العِلم أنّ جميع الأمثلة التالية في هذا القسم تستخدم نفس قيمة ImageCollection الأساسية المحدّدة هنا:
أداة تعديل الرموز (JavaScript)
// Import hourly predicted temperature image collection for northern winter // solstice. Note that predictions extend for 384 hours; limit the collection // to the first 24 hours. var tempCol = ee.ImageCollection('NOAA/GFS0P25') .filterDate('2018-12-22', '2018-12-23') .limit(24) .select('temperature_2m_above_ground'); // Define visualization arguments to control the stretch and color gradient // of the data. var visArgs = { min: -40.0, max: 35.0, palette: ['blue', 'purple', 'cyan', 'green', 'yellow', 'red'] }; // Convert each image to an RGB visualization image by mapping the visualize // function over the image collection using the arguments defined previously. var tempColVis = tempCol.map(function(img) { return img.visualize(visArgs); }); // Import country features and filter to South American countries. var southAmCol = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017') .filterMetadata('wld_rgn', 'equals', 'South America'); // Define animation region (South America with buffer). var southAmAoi = ee.Geometry.Rectangle({ coords: [-103.6, -58.8, -18.4, 17.4], geodesic: false});
تراكبات
يمكن تركيب صور متعددة باستخدام طريقة blend Image حيث يتم دمج وحدات البكسل المتداخلة من صورتين استنادًا إلى أقنعتهما (مستوى التعتيم).
تراكُب المتّجهات
يمكن أن توفّر إضافة مضلّعات الحدود الإدارية والأشكال الهندسية الأخرى إلى صورة سياقًا مكانيًا قيّمًا. لنتأمّل الصورة المتحركة أعلاه التي تعرض درجة حرارة سطح الأرض اليومية على مستوى العالم (الشكل 3). يمكن تمييز الحدود بين اليابسة والمحيط إلى حد ما، ولكن يمكن جعلها واضحة من خلال إضافة تراكب مضلع للبلدان.
يتم رسم بيانات المتّجهات (Features) على الصور من خلال تطبيق طريقة paint.
يمكن رسم الميزات على صورة موجودة، ولكن الممارسة الأفضل هي
رسمها على صورة فارغة، وتصميمها، ثم مزج النتيجة مع
طبقات الصور المصممة الأخرى. إنّ التعامل مع كل طبقة من طبقات العرض المرئي
بشكل مستقل يتيح مزيدًا من التحكّم في التصميم.
يوضّح المثال التالي رسم حدود بلدان أمريكا الجنوبية على Image فارغ ودمج النتيجة مع كل Image من مجموعة درجات الحرارة اليومية العالمية (الشكل 5). تساعد حدود البلدان المتراكبة في تمييز اليابسة عن المياه وتوفير سياق لأنماط درجات الحرارة.
أداة تعديل الرموز (JavaScript)
// Define an empty image to paint features to. var empty = ee.Image().byte(); // Paint country feature edges to the empty image. var southAmOutline = empty .paint({featureCollection: southAmCol, color: 1, width: 1}) // Convert to an RGB visualization image; set line color to black. .visualize({palette: '000000'}); // Map a blend operation over the temperature collection to overlay the country // border outline image on all collection images. var tempColOutline = tempColVis.map(function(img) { return img.blend(southAmOutline); }); // Define animation arguments. var videoArgs = { dimensions: 768, region: southAmAoi, framesPerSecond: 7, crs: 'EPSG:3857' }; // Display the animation. print(ui.Thumbnail(tempColOutline, videoArgs));

الشكل 5: أضِف تراكبات متّجهة إلى الصور في مجموعة لتوفير سياق مكاني.
صورة فوق صورة
ويمكن تركيب عدة صور للحصول على النمط المطلوب. لنفترض أنّك تريد التركيز على منطقة معيّنة. يمكنك إنشاء نسخة صامتة من تصور الصورة كطبقة أساسية ثم تراكب نسخة مقصوصة من التصور الأصلي. استنادًا إلى المثال السابق، ينتج عن النص البرمجي التالي الشكل 6.
أداة تعديل الرموز (JavaScript)
// Define an empty image to paint features to. var empty = ee.Image().byte(); // Paint country feature edges to the empty image. var southAmOutline = empty .paint({featureCollection: southAmCol, color: 1, width: 1}) // Convert to an RGB visualization image; set line color to black. .visualize({palette: '000000'}); // Map a blend operation over the temperature collection to overlay the country // border outline image on all collection images. var tempColOutline = tempColVis.map(function(img) { return img.blend(southAmOutline); }); // Define a partially opaque grey RGB image to dull the underlying image when // blended as an overlay. var dullLayer = ee.Image.constant(175).visualize({ opacity: 0.6, min: 0, max: 255, forceRgbOutput: true}); // Map a two-part blending operation over the country outline temperature // collection for final styling. var finalVisCol = tempColOutline.map(function(img) { return img // Blend the dulling layer with the given country outline temperature image. .blend(dullLayer) // Blend a clipped copy of the country outline temperature image with the // dulled background image. .blend(img.clipToCollection(southAmCol)); }); // Define animation arguments. var videoArgs = { dimensions: 768, region: southAmAoi, framesPerSecond: 7, crs: 'EPSG:3857' }; // Display the animation. print(ui.Thumbnail(finalVisCol, videoArgs));

الشكل 6: يمكنك التركيز على منطقة معيّنة من خلال اقتصاص الصورة ووضعها فوق نسخة صامتة.
يمكنك أيضًا دمج بيانات الصورة مع طبقة أساسية للتظليل الجبلي للإشارة إلى التضاريس وإعطاء التصور بعض العمق (الشكل 7).
أداة تعديل الرموز (JavaScript)
// Define a hillshade layer from NASADEM digital elevation model. var hillshade = ee.Terrain.hillshade(ee.Image('NASA/NASADEM_HGT/001') // Exaggerate the elevation to increase contrast in hillshade. .multiply(100)) // Clip the DEM by South American boundary to clean boundary between // land and ocean. .clipToCollection(southAmCol); // Map a blend operation over the temperature collection to overlay a partially // opaque temperature layer on the hillshade layer. var finalVisCol = tempColVis.map(function(img) { return hillshade .blend(img.clipToCollection(southAmCol).visualize({opacity: 0.6})); }); // Define animation arguments. var videoArgs = { dimensions: 768, region: southAmAoi, framesPerSecond: 7, crs: 'EPSG:3857' }; // Display the animation. print(ui.Thumbnail(finalVisCol, videoArgs));

الشكل 7: يمكنك عرض التضاريس من خلال تراكب بيانات الصور الشفافة جزئيًا على
طبقة تظليل التلال.
الانتقالات
يمكنك تخصيص مجموعة صور لإنشاء صور متحركة تكشف عن الاختلافات بين صورتين ضمن مجموعة باستخدام تأثيرات التلاشي والوميض والانتقال بين الشرائح. يستخدم كل من الأمثلة التالية نفس التصور الأساسي الذي تم إنشاؤه بواسطة النص البرمجي التالي:
أداة تعديل الرموز (JavaScript)
// Define an area of interest geometry with a global non-polar extent. var aoi = ee.Geometry.Polygon( [[[-179.0, 78.0], [-179.0, -58.0], [179.0, -58.0], [179.0, 78.0]]], null, false); // Import hourly predicted temperature image collection. var temp = ee.ImageCollection('NOAA/GFS0P25') // Define a northern summer solstice temperature image. var summerSolTemp = temp .filterDate('2018-06-21', '2018-06-22') .filterMetadata('forecast_hours', 'equals', 12) .first() .select('temperature_2m_above_ground'); // Define a northern winter solstice temperature image. var winterSolTemp = temp .filterDate('2018-12-22', '2018-12-23') .filterMetadata('forecast_hours', 'equals', 12) .first() .select('temperature_2m_above_ground'); // Combine the solstice images into a collection. var tempCol = ee.ImageCollection([ summerSolTemp.set('season', 'summer'), winterSolTemp.set('season', 'winter') ]); // Import international boundaries feature collection. var countries = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017'); // Define visualization arguments. var visArgs = { min: -40.0, max: 35.0, palette: ['blue', 'purple', 'cyan', 'green', 'yellow', 'red'] }; // Convert the image data to RGB visualization images. // The clip and unmask combination sets ocean pixels to black. var tempColVis = tempCol.map(function(img) { return img .visualize(visArgs) .clipToCollection(countries) .unmask(0) .copyProperties(img, img.propertyNames()); });
تأثير وامض
عندما تتضمّن المجموعة صورتَين فقط، كما هو الحال هنا، يكون الوميض هو
التمثيل التلقائي عند تحريك المجموعة. اضبط وسيطة الحركة framesPerSecond لزيادة معدّل الوميض أو إبطائه. تؤدي وسيطات العرض التالية المطبّقة على المجموعة أعلاه إلى إنشاء الشكل 8.
أداة تعديل الرموز (JavaScript)
// Define arguments for animation function parameters. var videoArgs = { dimensions: 768, region: aoi, framesPerSecond: 2, crs: 'EPSG:3857' }; // Display animation to the Code Editor console. print(ui.Thumbnail(tempColVis, videoArgs));

الشكل 8: مثال على التبديل بين درجة حرارة السطح عند الساعة 12 ظهرًا بتوقيت غرينتش في الانقلاب الشتوي والانقلاب الصيفي في نصف الكرة الشمالي
تلاشي
يتم الانتقال بين طبقتين باستخدام تأثير التلاشي من خلال تقليل عتامة إحدى الطبقتين وزيادة عتامة الطبقة الأخرى في الوقت نفسه من خلال سلسلة من الزيادات في العتامة من 0 إلى 1 تقريبًا (الشكل 9).
أداة تعديل الرموز (JavaScript)
// Define a sequence of decreasing opacity increments. Note that opacity cannot // be 0, so near 1 and 0 are used. Near 1 is needed because a compliment is // calculated in a following step that can result in 0 if 1 is an element of the // list. var opacityList = ee.List.sequence({start: 0.99999, end: 0.00001, count: 20}); // Filter the summer and winter solstice images from the collection and set as // image objects. var summerImg = tempColVis.filter(ee.Filter.eq('season', 'summer')).first(); var winterImg = tempColVis.filter(ee.Filter.eq('season', 'winter')).first(); // Map over the list of opacity increments to iteratively adjust the opacity of // the two solstice images. Returns a list of images. var imgList = opacityList.map(function(opacity) { var opacityCompliment = ee.Number(1).subtract(ee.Number(opacity)); var winterImgFade = winterImg.visualize({opacity: opacity}); var summerImgFade = summerImg.visualize({opacity: opacityCompliment}); return summerImgFade.blend(winterImgFade).set('opacity', opacity); }); // Convert the image list to an image collection; the forward phase. var fadeForward = ee.ImageCollection.fromImages(imgList); // Make a copy of the collection that is sorted by ascending opacity to // represent the reverse phase. var fadeBackward = fadeForward.sort({property: 'opacity'}); // Merge the forward and reverse phase frame collections. var fadeCol = fadeForward.merge(fadeBackward); // Define animation arguments. var videoArgs = { dimensions: 768, region: aoi, framesPerSecond: 25, crs: 'EPSG:3857' }; // Display the animation. print(ui.Thumbnail(fadeCol, videoArgs));

الشكل 9: مثال على التلاشي بين درجة حرارة السطح عند الساعة 12 ظهرًا بتوقيت غرينتش في الانقلاب الصيفي والشتوي
شريط التمرير
يعرض انتقال شريط التمرير طبقة الصورة الأساسية ويخفيها تدريجيًا. ويتم ذلك من خلال ضبط مستوى تعتيم الصورة العلوية بشكل متكرر عبر نطاق من خطوط الطول (الشكل 10).
أداة تعديل الرموز (JavaScript)
// Define a sequence of longitude increments. Start and end are defined by the // min and max longitude of the feature to be provided to the region parameter // of the animation arguments dictionary. var lonSeq = ee.List.sequence({start: -179, end: 179, count: 20}); // Define a longitude image. var longitude = ee.Image.pixelLonLat().select('longitude'); // Filter the summer and winter solstice images from the collection and set as // image objects. var summerImg = tempColVis.filter(ee.Filter.eq('season', 'summer')).first(); var winterImg = tempColVis.filter(ee.Filter.eq('season', 'winter')).first(); // Map over the list of longitude increments to iteratively adjust the mask // (opacity) of the overlying image layer. Returns a list of images. var imgList = lonSeq.map(function(lon) { lon = ee.Number(lon); var mask = longitude.gt(lon); return summerImg.blend(winterImg.updateMask(mask)).set('lon', lon); }); // Convert the image list to an image collection; concealing phase. var sliderColForward = ee.ImageCollection.fromImages(imgList); // Make a copy of the collection that is sorted by descending longitude to // represent the revealing phase. var sliderColbackward = sliderColForward .sort({property: 'lon', ascending: false}); // Merge the forward and backward phase frame collections. var sliderCol = sliderColForward.merge(sliderColbackward); // Define animation arguments. var videoArgs = { dimensions: 768, region: aoi, framesPerSecond: 25, crs: 'EPSG:3857' }; // Display the animation. print(ui.Thumbnail(sliderCol, videoArgs));

الشكل 10: مثال على انتقال منزلق بين درجة حرارة السطح عند الساعة 12 ظهرًا بتوقيت غرينتش
في الانقلاب الصيفي والشتوي

