ImageCollection
को बनाने वाली इमेज को ऐनिमेशन या थंबनेल की सीरीज़ के तौर पर देखा जा सकता है. इसे “फ़िल्मस्ट्रिप” कहा जाता है. इन तरीकों से, ImageCollection
के कॉन्टेंट का तुरंत आकलन किया जा सकता है. साथ ही, समय और जगह के हिसाब से हुए बदलावों को देखने के लिए, यह एक असरदार तरीका है (पहला इमेज).
getVideoThumbURL()
ऐनिमेशन वाली इमेज की सीरीज़ बनाता हैgetFilmstripThumbURL()
, थंबनेल इमेज की सीरीज़ बनाता है
नीचे दिए गए सेक्शन में, विज़ुअलाइज़ेशन के लिए ImageCollection
को तैयार करने का तरीका बताया गया है. साथ ही, कलेक्शन को विज़ुअलाइज़ करने के हर तरीके के लिए कोड का उदाहरण दिया गया है. इनमें ऐनिमेशन की कई बेहतर तकनीकें भी शामिल हैं.
पहली इमेज. ऐनिमेशन में, सितंबर 2017 में अटलांटिक में आई तीन दिनों की आंधी के बारे में बताया गया है.
डेटा इकट्ठा करने की तैयारी
किसी कलेक्शन में मौजूद इमेज को फ़िल्टर करें, कंपोज़ करें, क्रम से लगाएं, और उनमें स्टाइल जोड़ें. इससे, सिर्फ़ अपनी पसंद की इमेज दिखाई जा सकती हैं या किसी घटना पर ज़ोर दिया जा सकता है. विज़ुअलाइज़ेशन फ़ंक्शन में किसी भी ImageCollection
को इनपुट के तौर पर दिया जा सकता है. हालांकि, साल के बीच और साल के अंदर की तारीख की सीमाओं, निगरानी के अंतराल, क्षेत्र के दायरे, क्वालिटी, और डेटा के टाइप को ध्यान में रखकर चुना गया कलेक्शन, बेहतर नतीजे दे सकता है.
फ़िल्टर करना
विज़ुअलाइज़ेशन के मकसद के हिसाब से काम का डेटा शामिल करने के लिए, इमेज कलेक्शन को फ़िल्टर करें. किसी डेटासेट के लिए तारीखें, स्पेसिएल एक्सटेंट, क्वालिटी, और अन्य प्रॉपर्टी का ध्यान रखें.
उदाहरण के लिए, Sentinel-2 के सतह के रेफ़्लेक्शन डेटा को इनके हिसाब से फ़िल्टर करें:
तारीख की एक सीमा,
कोड एडिटर (JavaScript)
var s2col = ee.ImageCollection('COPERNICUS/S2_SR') .filterDate('2018-01-01', '2019-01-01');
साल के दिन की सीरियल रेंज,
कोड एडिटर (JavaScript)
var s2col = ee.ImageCollection('COPERNICUS/S2_SR') .filter(ee.Filter.calendarRange(171, 242, 'day_of_year'));
दिलचस्पी का कोई इलाका,
कोड एडिटर (JavaScript)
var s2col = ee.ImageCollection('COPERNICUS/S2_SR') .filterBounds(ee.Geometry.Point(-122.1, 37.2));
या इमेज प्रॉपर्टी.
कोड एडिटर (JavaScript)
var s2col = ee.ImageCollection('COPERNICUS/S2_SR') .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 50));
एक से ज़्यादा फ़िल्टर को चेन में जोड़ना.
कोड एडिटर (JavaScript)
var s2col = ee.ImageCollection('COPERNICUS/S2_SR') .filterDate('2018-01-01', '2019-01-01') .filterBounds(ee.Geometry.Point(-122.1, 37.2)) .filter('CLOUDY_PIXEL_PERCENTAGE < 50');
कंपोज़िट करना
किसी कलेक्शन में इमेज की संख्या कम करने और क्वालिटी को बेहतर बनाने के लिए, साल के अंदर और साल के बीच की तारीख की सीमा को कंपोजिट करें. उदाहरण के लिए, मान लें कि आपको अफ़्रीका के लिए, सालाना एनडीवीआई का विज़ुअलाइज़ेशन बनाना है. एक विकल्प यह है कि 2018 के सभी अवलोकन शामिल करने के लिए, MODIS के 16 दिनों के एनडीवीआई कलेक्शन को फ़िल्टर करें.
कोड एडिटर (JavaScript)
var ndviCol = ee.ImageCollection('MODIS/006/MOD13A2') .filterDate('2018-01-01', '2019-01-01') .select('NDVI');
फ़िल्टर और कम करने के हिसाब से, साल-दर-साल का कंपोजिट
ऊपर दिए गए कलेक्शन के विज़ुअलाइज़ेशन से पता चलता है कि जंगल वाले उन इलाकों में काफ़ी नॉइज़ है जहां ज़्यादा बादल छाए हुए हैं (फ़िगर 2a). 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/006/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);
इस कलेक्शन से मिलने वाले ऐनिमेशन में कम गड़बड़ियां होती हैं, क्योंकि हर इमेज में 20 से ज़्यादा साल के डेटा के लिए, 16 दिनों के एनडीवीआई कंपोजिट का औसत दिखाया जाता है (पहला इमेज 1b). इस ऐनिमेशन के बारे में ज़्यादा जानकारी के लिए, यह ट्यूटोरियल देखें.
इमेज 2a. सालाना एनडीवीआई, जिसमें साल-दर-साल कॉम्पोज़िट करने की सुविधा नहीं है. | दूसरा चित्र. सालाना एनडीवीआई, जिसमें साल-दर-साल की कॉम्पोज़िटिंग की गई हो. |
फ़िल्टर और कम करने के हिसाब से साल के अंदर का कंपोजिट
पिछले उदाहरण में, साल-दर-साल कॉम्पोज़ करने की सुविधा का इस्तेमाल किया गया है. इससे, साल के दौरान होने वाली गतिविधियों की जानकारी को एक साथ इकट्ठा करने में भी मदद मिल सकती है. उदाहरण के लिए, Landsat डेटा को हर सेंसर के लिए, किसी खास सीन के लिए हर 16 दिन में इकट्ठा किया जाता है. हालांकि, अक्सर इमेज का कुछ हिस्सा बादलों से छिपा होता है. बादलों को मास्क करके और एक ही सीज़न की कई इमेज को कॉम्पोज़ करके, बादलों के बिना बेहतर इमेज बनाई जा सकती है. इस उदाहरण पर गौर करें. इसमें जुलाई और अगस्त की 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);
जॉइन और रिड्यूस करके, एक ही दिन का कंपोजिट
कॉम्पोज़ करने का एक और उदाहरण, एक ही जगह पर मौजूद इमेज के मोज़ेक बनाना है. मान लें कि आपकी दिलचस्पी का इलाका, एक ही पाथ में दो लैंडसैट पंक्तियों में है और आपका मकसद 2017 और 2018 में, हर लैंडसैट 8 ऑर्बिट के लिए, दो इमेज का इमेज मोज़ेक दिखाना है. यहां, पाथ और पंक्ति के हिसाब से कलेक्शन को फ़िल्टर करने के बाद, एक ही ऑब्जेक्ट की 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') .filterBounds(ee.Geometry.Point(-122.1, 37.2)) .sort('system:time_start');
इसके अलावा, हो सकता है कि क्रम को बादलों की बढ़ती संख्या के हिसाब से तय किया जाना चाहिए, जैसा कि Sentinel-2 इमेजरी के इस मामले में है.
कोड एडिटर (JavaScript)
var s2col = ee.ImageCollection('COPERNICUS/S2_SR') .filterBounds(ee.Geometry.Point(-122.1, 37.2)) .sort('CLOUDY_PIXEL_PERCENTAGE');
क्रम को किसी डेरिव्ड प्रॉपर्टी के हिसाब से भी तय किया जा सकता है. जैसे, क्षेत्र के हिसाब से औसत एनडीवीआई. यहां, मैप किए गए फ़ंक्शन में हर इमेज में रीजनल एनडीवीआई को प्रॉपर्टी के तौर पर जोड़ा गया है. इसके बाद, नई प्रॉपर्टी को क्रम से लगाया गया है.
कोड एडिटर (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
को विज़ुअलाइज़ेशन के आर्ग्युमेंट दें. getVideoThumbURL
औरgetFilmstripThumbURL
को लागू करने से पहले, इमेज कलेक्शन परvisualize
इमेज का तरीका मैप करें.getVideoThumbURL
औरgetFilmstripThumbURL
को लागू करने से पहले, इमेज कलेक्शन परsldStyle
इमेज का तरीका मैप करें. ज़्यादा जानकारी के लिए, स्टाइल वाली लेयर का ब्यौरा देखें.
इस गाइड में दिए गए उदाहरणों में, विकल्प 1 और 2 का इस्तेमाल किया गया है. इनमें, मल्टी-बैंड इमेज के तीन इमेज बैंड को लाल, हरे, और नीले रंग के चैनलों पर मैप करके विज़ुअलाइज़ेशन किया गया है. इसके अलावा, एक बैंड की वैल्यू को कलर पैलेट के साथ लीनियर तरीके से ग्रेड किया गया है. विज़ुअलाइज़ेशन पैरामीटर में ये शामिल हैं:
पैरामीटर | ब्यौरा | टाइप |
---|---|---|
बैंड | आरजीबी में मैप किए जाने वाले तीन बैंड के नामों की सूची, जिसमें कॉमा लगा हो | सूची |
मिनट | 0 पर मैप करने के लिए वैल्यू | तीन नंबरों की सूची या नंबर, हर बैंड के लिए एक |
max | 255 पर मैप करने के लिए वैल्यू | तीन नंबरों की सूची या नंबर, हर बैंड के लिए एक |
gain | वह वैल्यू जिससे हर पिक्सल वैल्यू को गुणा करना है | तीन नंबरों की सूची या नंबर, हर बैंड के लिए एक |
बायस | हर डीएन में जोड़ी जाने वाली वैल्यू | तीन नंबरों की सूची या नंबर, हर बैंड के लिए एक |
gamma | गामा सुधार फ़ैक्टर | तीन नंबरों की सूची या नंबर, हर बैंड के लिए एक |
पैलेट | सीएसएस-स्टाइल कलर स्ट्रिंग की सूची (सिर्फ़ सिंगल-बैंड इमेज के लिए) | हेक्स स्ट्रिंग की कॉमा से अलग की गई सूची |
ओपैसिटी | लेयर की ओपैसिटी (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
को ऐसी वैल्यू पर सेट करना चाहिए जो आपके काम के डेटा के 2nd और 98th percentile को दिखाती हों. डिजिटल एलिवेशन मॉडल के लिए इन वैल्यू का हिसाब लगाने का यह उदाहरण देखें.
कोड एडिटर (JavaScript)
// Import SRTM global elevation model. var demImg = ee.Image('USGS/SRTMGL1_003'); // 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
तरीके के लिए विज़ुअलाइज़ेशन आर्ग्युमेंट सेट किए जाते हैं, और NDVI कलेक्शन पर वैल्यू को RGB इमेज के तौर पर दिखाने वाले फ़ंक्शन को मैप किया जाता है.
कोड एडिटर (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') .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
पैरामीटर का इस्तेमाल किया गया है. इससे यह कंट्रोल किया जाता है कि किन वैल्यू को 8-बिट आरजीबी डेटा की सीमाओं तक स्ट्रेच किया जाए.
वीडियो का थंबनेल
getVideoThumbURL()
फ़ंक्शन, ImageCollection
में मौजूद सभी इमेज से ऐनिमेशन जनरेट करता है. इसमें हर इमेज एक फ़्रेम होती है. ऐनिमेशन बनाने का सामान्य वर्कफ़्लो इस तरह है:
- एक ऐसा
Geometry
तय करें जिसके दायरे से ऐनिमेशन के क्षेत्र की सीमा तय होती है. ImageCollection
की परिभाषा दें.- इमेज विज़ुअलाइज़ेशन का इस्तेमाल करें: कलेक्शन पर इमेज विज़ुअलाइज़ेशन फ़ंक्शन को मैप करें या ऐनिमेशन के आर्ग्युमेंट के सेट में इमेज विज़ुअलाइज़ेशन के आर्ग्युमेंट जोड़ें.
- ऐनिमेशन के आर्ग्युमेंट तय करें और
getVideoThumbURL
मेथड को कॉल करें.
getVideoThumbURL
का नतीजा एक यूआरएल है. यूआरएल को कंसोल पर प्रिंट करें और उस पर क्लिक करें. इससे Earth Engine सर्वर, नए ब्राउज़र टैब में ऐनिमेशन जनरेट करना शुरू कर देंगे. इसके अलावा, कलेक्शन और उससे जुड़े ऐनिमेशन के आर्ग्युमेंट पर ui.Thumbnail
फ़ंक्शन को कॉल करके, कोड एडिटर कंसोल में ऐनिमेशन देखें. रेंडर होने के बाद, ऐनिमेशन को डाउनलोड करने के लिए, उस पर राइट क्लिक करें और उसके कॉन्टेक्स्ट मेन्यू से सही विकल्प चुनें.
यहां दिए गए उदाहरण में, 24 घंटे के दौरान दुनिया भर के तापमान को दिखाने वाला एनिमेशन जनरेट करने का तरीका बताया गया है. ध्यान दें कि इस उदाहरण में ऐनिमेशन आर्ग्युमेंट के साथ-साथ विज़ुअलाइज़ेशन आर्ग्युमेंट भी शामिल हैं. इसके बजाय, पहले ImageCollection
पर विज़ुअलाइज़ेशन फ़ंक्शन को मैप किया जाता है. इस स्क्रिप्ट को चलाने पर, कोड एडिटर कंसोल में तीसरी इमेज जैसा ऐनिमेशन दिखना चाहिए.
कोड एडिटर (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));
तीसरा डायग्राम. उत्तरी गोलार्ध में, सर्दियों के सबसे छोटे दिन के लिए हर घंटे की सतह का तापमान, ऐनिमेटेड GIF इमेज के तौर पर दिखाया गया है.
फ़िल्मस्ट्रिप
getFilmstripThumbUrl
फ़ंक्शन, एक स्टैटिक इमेज जनरेट करता है. यह इमेज, ImageCollection
में मौजूद सभी इमेज को उत्तर-दक्षिण सीरीज़ में जोड़ती है. फ़िल्मस्ट्रिप फ़्रेम का क्रम, कलेक्शन के नैचुरल क्रम के मुताबिक होता है.
getFilmstripThumbUrl
का नतीजा एक यूआरएल है. यूआरएल को कंसोल पर प्रिंट करें और उस पर क्लिक करें. इससे Earth Engine सर्वर, नए ब्राउज़र टैब में तुरंत इमेज जनरेट करना शुरू कर देंगे. रेंडर होने के बाद, इमेज को डाउनलोड करने के लिए, उस पर राइट क्लिक करें और उसके संदर्भ मेन्यू से सही विकल्प चुनें.
नीचे दिया गया कोड स्निपेट, वीडियो के थंबनेल के ऊपर दिए गए उदाहरण के जैसे ही कलेक्शन का इस्तेमाल करता है. इस स्क्रिप्ट को चलाने पर, कोड एडिटर कंसोल में, चौथे चित्र जैसी फ़िल्मस्ट्रिप दिखनी चाहिए.
कोड एडिटर (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));
चौथी इमेज. उत्तरी गोलार्ध में, सर्दियों के सबसे छोटे दिन के लिए हर घंटे की सतह का तापमान, फ़िल्मस्ट्रिप 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
तरीके का इस्तेमाल करके, कई इमेज ओवरले की जा सकती हैं. इसमें, दो इमेज के ओवरलैप होने वाले पिक्सल को उनके मास्क (ओपैसिटी) के आधार पर ब्लेंड किया जाता है.
वेक्टर ओवरले
किसी इमेज में प्रशासनिक सीमा के पॉलीगॉन और अन्य ज्यामिति जोड़ने से, जगह के बारे में अहम जानकारी मिल सकती है. ऊपर दिए गए (तीसरा चित्र), दुनिया भर में हर दिन की सतह के तापमान के एनिमेशन को देखें. ज़मीन और समुद्र के बीच की सीमाओं को कुछ हद तक देखा जा सकता है. हालांकि, देशों के पॉलीगॉन ओवरले को जोड़कर, उन्हें साफ़ तौर पर दिखाया जा सकता है.
वेक्टर डेटा (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));
पांचवां चित्र. जगह की जानकारी देने के लिए, कलेक्शन में मौजूद इमेज में वेक्टर ओवरले जोड़ें.
इमेज ओवरले
अपनी पसंद का स्टाइल पाने के लिए, कई इमेज को ओवरले किया जा सकता है. मान लें कि आपको किसी दिलचस्प इलाके पर ज़ोर देना है. किसी इमेज विज़ुअलाइज़ेशन की म्यूट की गई कॉपी को बेस लेयर के तौर पर बनाया जा सकता है. इसके बाद, ओरिजनल विज़ुअलाइज़ेशन का क्लिप किया गया वर्शन ओवरले किया जा सकता है. पिछले उदाहरण के आधार पर, नीचे दी गई स्क्रिप्ट से, छठा चित्र बनता है.
कोड एडिटर (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));
छठी इमेज. इमेज को क्लिप करके और उसे म्यूट की गई कॉपी पर ओवरले करके, अपनी पसंद के किसी हिस्से पर ज़ोर दें.
इमेज डेटा को हिलशेड बेस लेयर के साथ ब्लेंड करके भी, इलाके की जानकारी दी जा सकती है और विज़ुअलाइज़ेशन को बेहतर बनाया जा सकता है (इमेज 7).
कोड एडिटर (JavaScript)
// Define a hillshade layer from SRTM digital elevation model. var hillshade = ee.Terrain.hillshade(ee.Image('USGS/SRTMGL1_003') // 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));
सातवीं इमेज. ढलान की जानकारी देने वाली लेयर पर, कुछ हद तक पारदर्शी इमेज डेटा को ओवरले करके इलाके की जानकारी दिखाएं.
ट्रांज़िशन
इमेज कलेक्शन को पसंद के मुताबिक बनाएं, ताकि फ़ेड, फ़्लिकर, और स्लाइड ट्रांज़िशन का इस्तेमाल करके, कलेक्शन में मौजूद दो इमेज के बीच के अंतर को दिखाने वाले ऐनिमेशन बनाए जा सकें. यहां दिए गए हर उदाहरण में, इस स्क्रिप्ट से जनरेट किए गए एक ही बेस विज़ुअलाइज़ेशन का इस्तेमाल किया गया है:
कोड एडिटर (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()); });
Flicker
अगर किसी कलेक्शन में सिर्फ़ दो इमेज हैं, तो कलेक्शन ऐनिमेशन के लिए, फ़्लिकर डिफ़ॉल्ट रूप से दिखता है. फ़्लिकर की दर को तेज़ या धीमा करने के लिए,
framesPerSecond
ऐनिमेशन आर्ग्युमेंट में बदलाव करें. ऊपर दिए गए कलेक्शन पर विज़ुअलाइज़ेशन के लिए इस्तेमाल किए गए ये आर्ग्युमेंट, आठवीं इमेज दिखाते हैं.
कोड एडिटर (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));
आठवीं इमेज. उत्तरी और शीतकालीन संक्रांति के लिए, जीएमटी के मुताबिक दोपहर 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));
नौवीं इमेज. जीएमटी के मुताबिक, दोपहर 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 बजे सतह के तापमान के बीच स्लाइडिंग ट्रांज़िशन का उदाहरण.