Announcement: All noncommercial projects registered to use Earth Engine before April 15, 2025 must verify noncommercial eligibility to maintain Earth Engine access.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-06 UTC."],[[["\u003cp\u003eThe \u003ccode\u003emod()\u003c/code\u003e function calculates the remainder when one number (\u003ccode\u003eleft\u003c/code\u003e) is divided by another (\u003ccode\u003eright\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eIt accepts two arguments: \u003ccode\u003eleft\u003c/code\u003e, the dividend, and \u003ccode\u003eright\u003c/code\u003e, the divisor, both of which must be numbers.\u003c/p\u003e\n"],["\u003cp\u003eThe function returns the remainder as a number, which can be positive, negative, or zero depending on the input values.\u003c/p\u003e\n"],["\u003cp\u003eIt's available in both JavaScript and Python environments within the Earth Engine ecosystem.\u003c/p\u003e\n"],["\u003cp\u003eUsage follows the syntax \u003ccode\u003eee.Number(left).mod(ee.Number(right))\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# ee.Number.mod\n\nCalculates the remainder of the first value divided by the second.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|---------------------|---------|\n| Number.mod`(right)` | Number |\n\n| Argument | Type | Details |\n|--------------|--------|-----------------------|\n| this: `left` | Number | The left-hand value. |\n| `right` | Number | The right-hand value. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Remainder with positive dividend.\nprint('Remainder of 12/5', ee.Number(12).mod(ee.Number(5))); // 2\nprint('Remainder of 1/-2', ee.Number(1).mod(ee.Number(-2))); // 1\nprint('Remainder of 1/2', ee.Number(1).mod(ee.Number(2))); // 1\nprint('Remainder of 2/3', ee.Number(2).mod(ee.Number(3))); // 2\nprint('Remainder of 5.5/2', ee.Number(5.5).mod(ee.Number(2))); // 1.5\n\n// Remainder with negative dividend.\nprint('Remainder of -12/5', ee.Number(-12).mod(ee.Number(5))); // -2\nprint('Remainder of -1/2', ee.Number(-1).mod(ee.Number(2))); // -1\nprint('Remainder of -4/2', ee.Number(-4).mod(ee.Number(2))); // 0\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\n# Remainder with positive dividend.\nprint('Remainder of 12/5:', ee.Number(12).mod(ee.Number(5)).getInfo()) # 2\nprint('Remainder of 1/-2:', ee.Number(1).mod(ee.Number(-2)).getInfo()) # 1\nprint('Remainder of 1/2:', ee.Number(1).mod(ee.Number(2)).getInfo()) # 1\nprint('Remainder of 2/3:', ee.Number(2).mod(ee.Number(3)).getInfo()) # 2\nprint('Remainder of 5.5/2:', ee.Number(5.5).mod(ee.Number(2)).getInfo()) # 1.5\n\n# Remainder with negative dividend.\nprint('Remainder of -12/5:', ee.Number(-12).mod(ee.Number(5)).getInfo()) # -2\nprint('Remainder of -1/2:', ee.Number(-1).mod(ee.Number(2)).getInfo()) # -1\nprint('Remainder of -4/2:', ee.Number(-4).mod(ee.Number(2)).getInfo()) # 0\n```"]]