ee.Algorithms.If

একটি শর্তের উপর ভিত্তি করে এটির একটি ইনপুট নির্বাচন করে, একটি if-then-else নির্মাণের অনুরূপ।

ব্যবহার রিটার্নস
ee.Algorithms.If( condition , trueCase , falseCase ) অবজেক্ট
যুক্তি টাইপ বিস্তারিত
condition অবজেক্ট, ডিফল্ট: নাল শর্ত যা নির্ধারণ করে কোন ফলাফল ফেরত দেওয়া হবে। এটি একটি বুলিয়ান না হলে, নিম্নলিখিত নিয়ম দ্বারা এটি একটি বুলিয়ান হিসাবে ব্যাখ্যা করা হয়:
  • 0 বা একটি NaN এর সমান সংখ্যা মিথ্যা।
  • খালি স্ট্রিং, তালিকা এবং অভিধান মিথ্যা.
  • নাল মিথ্যা।
  • বাকি সব সত্য।
trueCase অবজেক্ট, ডিফল্ট: নাল শর্ত সত্য হলে ফলাফল ফেরত দিতে হবে।
falseCase অবজেক্ট, ডিফল্ট: নাল শর্ত মিথ্যা হলে ফলাফল ফেরত দিতে হবে।

উদাহরণ

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

print(ee.Algorithms.If(false, '*true*', '*false*'));  // The string "*false*"
print(ee.Algorithms.If(true, '*true*', '*false*'));  // The string "*true*"

// Consider using remap rather than If for tasks like numbers for classes.
print(ee.Algorithms.If(ee.String('Tree').compareTo('Tree'), 0, 1));
print(ee.Algorithms.If(ee.String('NotTree').compareTo('Tree'), 0, 1));

পাইথন সেটআপ

পাইথন এপিআই এবং ইন্টারেক্টিভ ডেভেলপমেন্টের জন্য geemap ব্যবহার করার জন্য পাইথন এনভায়রনমেন্ট পৃষ্ঠাটি দেখুন।

import ee
import geemap.core as geemap

Colab (পাইথন)

# The string "*false*"
print(ee.Algorithms.If(False, '*true*', '*false*').getInfo())

# The string "*true*"
print(ee.Algorithms.If(True, '*true*', '*false*').getInfo())

# Consider using remap rather than If for tasks like numbers for classes.
print(ee.Algorithms.If(ee.String('Tree').compareTo('Tree'), 0, 1).getInfo())
print(ee.Algorithms.If(ee.String('NotTree').compareTo('Tree'), 0, 1).getInfo())