ঘোষণা :
15 এপ্রিল, 2025 এর আগে আর্থ ইঞ্জিন ব্যবহার করার জন্য নিবন্ধিত সমস্ত অবাণিজ্যিক প্রকল্পগুলিকে অবশ্যই আর্থ ইঞ্জিন অ্যাক্সেস বজায় রাখার জন্য
অ-বাণিজ্যিক যোগ্যতা যাচাই করতে হবে।
ee.Array.slice
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
প্রদত্ত অক্ষ বরাবর 'স্টেপ' (অন্তর্ভুক্ত) থেকে 'শেষ' (এক্সক্লুসিভ) পর্যন্ত 'পদক্ষেপ' বৃদ্ধির মাধ্যমে প্রতিটি অবস্থানকে স্লাইস করে একটি সাবঅ্যারে তৈরি করে। ফলাফলে ইনপুট হিসাবে যতগুলি মাত্রা থাকবে, এবং স্লাইসিং অক্ষ ব্যতীত সমস্ত দিক থেকে একই দৈর্ঘ্য থাকবে, যেখানে দৈর্ঘ্য হবে 'স্টেপ' থেকে 'শেষ' পর্যন্ত অবস্থানের সংখ্যা যা 'অক্ষ' বরাবর ইনপুট অ্যারের দৈর্ঘ্যের সীমার মধ্যে রয়েছে। এর অর্থ হল ফলাফলটি প্রদত্ত অক্ষ বরাবর দৈর্ঘ্য 0 হতে পারে যদি start=end হয়, অথবা যদি শুরু বা শেষের মান সম্পূর্ণভাবে পরিসীমার বাইরে থাকে।
ব্যবহার | রিটার্নস | Array. slice ( axis , start , end , step ) | অ্যারে |
যুক্তি | টাইপ | বিস্তারিত | এই: array | অ্যারে | টুকরা টুকরা অ্যারে. |
axis | পূর্ণসংখ্যা, ডিফল্ট: 0 | স্লাইস করার জন্য অক্ষ। |
start | পূর্ণসংখ্যা, ডিফল্ট: 0 | 'অক্ষ' বরাবর প্রথম স্লাইসের (অন্তর্ভুক্ত) স্থানাঙ্ক। অ্যারের শেষের সাপেক্ষে স্লাইসিং শুরু করার জন্য নেতিবাচক সংখ্যা ব্যবহার করা হয়, যেখানে -1 অক্ষের শেষ অবস্থানে শুরু হয়, -2 শেষ অবস্থানের পরের থেকে শুরু হয় ইত্যাদি। |
end | পূর্ণসংখ্যা, ডিফল্ট: নাল | স্থানাঙ্ক (একচেটিয়া) যেখানে স্লাইস নেওয়া বন্ধ করতে হবে। ডিফল্টরূপে এটি প্রদত্ত অক্ষের দৈর্ঘ্য হবে। অ্যারের শেষের সাপেক্ষে স্লাইসিংয়ের শেষের অবস্থানের জন্য নেতিবাচক সংখ্যা ব্যবহার করা হয়, যেখানে -1 শেষ অবস্থানটি বাদ দেবে, -2 শেষ দুটি অবস্থান বাদ দেবে ইত্যাদি। |
step | পূর্ণসংখ্যা, ডিফল্ট: 1 | 'অক্ষ' বরাবর স্লাইস মধ্যে বিচ্ছেদ; 'স্টার্ট' (ইনক্লুসিভ) থেকে 'শেষ' (এক্সক্লুসিভ) পর্যন্ত 'স্টেপ'-এর প্রতিটি পুরো মাল্টিপলে একটি স্লাইস নেওয়া হবে। ইতিবাচক হতে হবে। |
উদাহরণ
কোড এডিটর (জাভাস্ক্রিপ্ট)
var array1x6 = ee.Array([1, 2, 3, 4, 5, 6]);
print(array1x6.slice()); // [1,2,3,4,5,6]
print(array1x6.slice(0)); // [1,2,3,4,5,6]
print(array1x6.slice(0, 0, 6, 1)); // [1,2,3,4,5,6]
print(array1x6.slice(0, 0, 10, 1)); // [1,2,3,4,5,6]
print(array1x6.slice(0, 2)); // [3,4,5,6]
print(array1x6.slice(0, 5)); // [6]
print(array1x6.slice(0, 6)); // []
print(array1x6.slice(0, 0, 2)); // [1,2]
print(array1x6.slice(0, 0, 0)); // []
// Negative start and end.
print(array1x6.slice(0, 0, -3)); // [1,2,3]
print(array1x6.slice(0, -2, 6)); // [5,6]
print(array1x6.slice(0, 0, 6, 2)); // [1,3,5]
print(array1x6.slice(0, 0, 6, 3)); // [1,4]
print(array1x6.slice(0, 0, 6, 4)); // [1,5]
print(array1x6.slice(0, 0, 6, 6)); // [1]
print(array1x6.slice(0, 2, 6, 2)); // [3,5]
var array3x2 = ee.Array([[1, 2], [3, 4], [5, 6]]);
print(array3x2.slice()); // [[1,2],[3,4],[5,6]]
print(array3x2.slice(0)); // [[1,2],[3,4],[5,6]]
print(array3x2.slice(0, 0)); // [[1,2],[3,4],[5,6]]
print(array3x2.slice(0, 0, 1)); // [[1,2]]
print(array3x2.slice(0, 0, 2)); // [[1,2],[3,4]]
print(array3x2.slice(0, 0, 3, 1)); // [[1,2],[3,4],[5,6]]
print(array3x2.slice(0, 0, 3, 2)); // [[1,2],[5,6]]
print(array3x2.slice(0, 1, 3, 2)); // [[3,4]]
print(array3x2.slice(0, 0, 3, 3)); // [[1,2]]
print(array3x2.slice(1)); // [[1,2],[3,4],[5,6]]
print(array3x2.slice(1, 1)); // [[2],[4],[6]]
print(array3x2.slice(1, 0, 1)); // [[1],[3],[5]]
var empty = ee.Array([], ee.PixelType.int8());
print(empty.slice()); // []
print(empty.slice(0)); // []
print(empty.slice(0, 0, 0, 1)); // []
পাইথন সেটআপ
পাইথন এপিআই এবং ইন্টারেক্টিভ ডেভেলপমেন্টের জন্য geemap
ব্যবহার করার জন্য পাইথন এনভায়রনমেন্ট পৃষ্ঠাটি দেখুন।
import ee
import geemap.core as geemap
Colab (পাইথন)
array1x6 = ee.Array([1, 2, 3, 4, 5, 6])
display(array1x6.slice()) # [1, 2, 3, 4, 5, 6]
display(array1x6.slice(0)) # [1, 2, 3, 4, 5, 6]
display(array1x6.slice(0, 0, 6, 1)) # [1, 2, 3, 4, 5, 6]
display(array1x6.slice(0, 0, 10, 1)) # [1, 2, 3, 4, 5, 6]
display(array1x6.slice(0, 2)) # [3, 4, 5, 6]
display(array1x6.slice(0, 5)) # [6]
display(array1x6.slice(0, 6)) # []
display(array1x6.slice(0, 0, 2)) # [1, 2]
display(array1x6.slice(0, 0, 0)) # []
# Negative start and end.
display(array1x6.slice(0, 0, -3)) # [1, 2, 3]
display(array1x6.slice(0, -2, 6)) # [5, 6]
display(array1x6.slice(0, 0, 6, 2)) # [1, 3, 5]
display(array1x6.slice(0, 0, 6, 3)) # [1, 4]
display(array1x6.slice(0, 0, 6, 4)) # [1, 5]
display(array1x6.slice(0, 0, 6, 6)) # [1]
display(array1x6.slice(0, 2, 6, 2)) # [3, 5]
array3x2 = ee.Array([[1, 2], [3, 4], [5, 6]])
display(array3x2.slice()) # [[1, 2], [3, 4], [5, 6]]
display(array3x2.slice(0)) # [[1, 2], [3, 4], [5, 6]]
display(array3x2.slice(0, 0)) # [[1, 2],[3, 4],[5, 6]]
display(array3x2.slice(0, 0, 1)) # [[1, 2]]
display(array3x2.slice(0, 0, 2)) # [[1, 2], [3, 4]]
display(array3x2.slice(0, 0, 3, 1)) # [[1, 2], [3, 4], [5, 6]]
display(array3x2.slice(0, 0, 3, 2)) # [[1, 2], [5, 6]]
display(array3x2.slice(0, 1, 3, 2)) # [[3, 4]]
display(array3x2.slice(0, 0, 3, 3)) # [[1, 2]]
display(array3x2.slice(1)) # [[1, 2], [3, 4], [5, 6]]
display(array3x2.slice(1, 1)) # [[2], [4], [6]]
display(array3x2.slice(1, 0, 1)) # [[1], [3], [5]]
empty = ee.Array([], ee.PixelType.int8())
display(empty.slice()) # []
display(empty.slice(0)) # []
display(empty.slice(0, 0, 0, 1)) # []
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-07-24 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-07-24 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003e\u003ccode\u003eArray.slice()\u003c/code\u003e extracts a subarray from an input array along a specified axis, similar to slicing in Python.\u003c/p\u003e\n"],["\u003cp\u003eIt uses \u003ccode\u003estart\u003c/code\u003e, \u003ccode\u003eend\u003c/code\u003e, and \u003ccode\u003estep\u003c/code\u003e parameters to define the portion of the array to extract, with negative indices referencing from the end.\u003c/p\u003e\n"],["\u003cp\u003eThe resulting subarray retains the original dimensions except along the sliced axis, where its length depends on the slice parameters.\u003c/p\u003e\n"],["\u003cp\u003eIf the slice parameters result in no elements being selected, an empty array is returned.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eArray.slice()\u003c/code\u003e can be used on multi-dimensional arrays by specifying the axis to slice along.\u003c/p\u003e\n"]]],[],null,["# ee.Array.slice\n\nCreates a subarray by slicing out each position along the given axis from the 'start' (inclusive) to 'end' (exclusive) by increments of 'step'. The result will have as many dimensions as the input, and the same length in all directions except the slicing axis, where the length will be the number of positions from 'start' to 'end' by 'step' that are in range of the input array's length along 'axis'. This means the result can be length 0 along the given axis if start=end, or if the start or end values are entirely out of range.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|----------------------------------------------------------|---------|\n| Array.slice`(`*axis* `, `*start* `, `*end* `, `*step*`)` | Array |\n\n| Argument | Type | Details |\n|---------------|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `array` | Array | Array to slice. |\n| `axis` | Integer, default: 0 | The axis to slice on. |\n| `start` | Integer, default: 0 | The coordinate of the first slice (inclusive) along 'axis'. Negative numbers are used to position the start of slicing relative to the end of the array, where -1 starts at the last position on the axis, -2 starts at the next to last position, etc. |\n| `end` | Integer, default: null | The coordinate (exclusive) at which to stop taking slices. By default this will be the length of the given axis. Negative numbers are used to position the end of slicing relative to the end of the array, where -1 will exclude the last position, -2 will exclude the last two positions, etc. |\n| `step` | Integer, default: 1 | The separation between slices along 'axis'; a slice will be taken at each whole multiple of 'step' from 'start' (inclusive) to 'end' (exclusive). Must be positive. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\nvar array1x6 = ee.Array([1, 2, 3, 4, 5, 6]);\nprint(array1x6.slice()); // [1,2,3,4,5,6]\nprint(array1x6.slice(0)); // [1,2,3,4,5,6]\nprint(array1x6.slice(0, 0, 6, 1)); // [1,2,3,4,5,6]\nprint(array1x6.slice(0, 0, 10, 1)); // [1,2,3,4,5,6]\n\nprint(array1x6.slice(0, 2)); // [3,4,5,6]\nprint(array1x6.slice(0, 5)); // [6]\nprint(array1x6.slice(0, 6)); // []\nprint(array1x6.slice(0, 0, 2)); // [1,2]\nprint(array1x6.slice(0, 0, 0)); // []\n\n// Negative start and end.\nprint(array1x6.slice(0, 0, -3)); // [1,2,3]\nprint(array1x6.slice(0, -2, 6)); // [5,6]\n\nprint(array1x6.slice(0, 0, 6, 2)); // [1,3,5]\nprint(array1x6.slice(0, 0, 6, 3)); // [1,4]\nprint(array1x6.slice(0, 0, 6, 4)); // [1,5]\nprint(array1x6.slice(0, 0, 6, 6)); // [1]\n\nprint(array1x6.slice(0, 2, 6, 2)); // [3,5]\n\nvar array3x2 = ee.Array([[1, 2], [3, 4], [5, 6]]);\nprint(array3x2.slice()); // [[1,2],[3,4],[5,6]]\nprint(array3x2.slice(0)); // [[1,2],[3,4],[5,6]]\nprint(array3x2.slice(0, 0)); // [[1,2],[3,4],[5,6]]\nprint(array3x2.slice(0, 0, 1)); // [[1,2]]\nprint(array3x2.slice(0, 0, 2)); // [[1,2],[3,4]]\nprint(array3x2.slice(0, 0, 3, 1)); // [[1,2],[3,4],[5,6]]\nprint(array3x2.slice(0, 0, 3, 2)); // [[1,2],[5,6]]\nprint(array3x2.slice(0, 1, 3, 2)); // [[3,4]]\nprint(array3x2.slice(0, 0, 3, 3)); // [[1,2]]\n\nprint(array3x2.slice(1)); // [[1,2],[3,4],[5,6]]\nprint(array3x2.slice(1, 1)); // [[2],[4],[6]]\nprint(array3x2.slice(1, 0, 1)); // [[1],[3],[5]]\n\nvar empty = ee.Array([], ee.PixelType.int8());\nprint(empty.slice()); // []\nprint(empty.slice(0)); // []\nprint(empty.slice(0, 0, 0, 1)); // []\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\narray1x6 = ee.Array([1, 2, 3, 4, 5, 6])\ndisplay(array1x6.slice()) # [1, 2, 3, 4, 5, 6]\ndisplay(array1x6.slice(0)) # [1, 2, 3, 4, 5, 6]\ndisplay(array1x6.slice(0, 0, 6, 1)) # [1, 2, 3, 4, 5, 6]\ndisplay(array1x6.slice(0, 0, 10, 1)) # [1, 2, 3, 4, 5, 6]\n\ndisplay(array1x6.slice(0, 2)) # [3, 4, 5, 6]\ndisplay(array1x6.slice(0, 5)) # [6]\ndisplay(array1x6.slice(0, 6)) # []\ndisplay(array1x6.slice(0, 0, 2)) # [1, 2]\ndisplay(array1x6.slice(0, 0, 0)) # []\n\n# Negative start and end.\ndisplay(array1x6.slice(0, 0, -3)) # [1, 2, 3]\ndisplay(array1x6.slice(0, -2, 6)) # [5, 6]\n\ndisplay(array1x6.slice(0, 0, 6, 2)) # [1, 3, 5]\ndisplay(array1x6.slice(0, 0, 6, 3)) # [1, 4]\ndisplay(array1x6.slice(0, 0, 6, 4)) # [1, 5]\ndisplay(array1x6.slice(0, 0, 6, 6)) # [1]\n\ndisplay(array1x6.slice(0, 2, 6, 2)) # [3, 5]\n\narray3x2 = ee.Array([[1, 2], [3, 4], [5, 6]])\ndisplay(array3x2.slice()) # [[1, 2], [3, 4], [5, 6]]\ndisplay(array3x2.slice(0)) # [[1, 2], [3, 4], [5, 6]]\ndisplay(array3x2.slice(0, 0)) # [[1, 2],[3, 4],[5, 6]]\ndisplay(array3x2.slice(0, 0, 1)) # [[1, 2]]\ndisplay(array3x2.slice(0, 0, 2)) # [[1, 2], [3, 4]]\ndisplay(array3x2.slice(0, 0, 3, 1)) # [[1, 2], [3, 4], [5, 6]]\ndisplay(array3x2.slice(0, 0, 3, 2)) # [[1, 2], [5, 6]]\ndisplay(array3x2.slice(0, 1, 3, 2)) # [[3, 4]]\ndisplay(array3x2.slice(0, 0, 3, 3)) # [[1, 2]]\n\ndisplay(array3x2.slice(1)) # [[1, 2], [3, 4], [5, 6]]\ndisplay(array3x2.slice(1, 1)) # [[2], [4], [6]]\ndisplay(array3x2.slice(1, 0, 1)) # [[1], [3], [5]]\n\nempty = ee.Array([], ee.PixelType.int8())\ndisplay(empty.slice()) # []\ndisplay(empty.slice(0)) # []\ndisplay(empty.slice(0, 0, 0, 1)) # []\n```"]]