Anúncio: todos os projetos não comerciais registrados para usar o Earth Engine antes de
15 de abril de 2025 precisam
verificar a qualificação não comercial para manter o acesso ao Earth Engine.
ee.DateRange.contains
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Retorna verdadeiro se a data ou o período especificado estiver dentro deste período.
Uso | Retorna |
---|
DateRange.contains(other) | Booleano |
Argumento | Tipo | Detalhes |
---|
isso: dateRange | DateRange | |
other | Objeto | |
Exemplos
Editor de código (JavaScript)
// A series of ee.DateRange objects.
var dateRange1 = ee.DateRange('2017-06-24', '2017-07-24');
var dateRange2 = ee.DateRange('2017-06-30', '2017-07-10');
var dateRange3 = ee.DateRange('2010-06-24', '2020-07-24');
// Determine if an ee.DateRange is contained within another.
print('Does dateRange1 contain dateRange2?', dateRange1.contains(dateRange2));
print('Does dateRange1 contain dateRange3?', dateRange1.contains(dateRange3));
Configuração do Python
Consulte a página
Ambiente Python para informações sobre a API Python e como usar
geemap
para desenvolvimento interativo.
import ee
import geemap.core as geemap
Colab (Python)
# A series of ee.DateRange objects.
date_range_1 = ee.DateRange('2017-06-24', '2017-07-24')
date_range_2 = ee.DateRange('2017-06-30', '2017-07-10')
date_range_3 = ee.DateRange('2010-06-24', '2020-07-24')
# Determine if an ee.DateRange is contained within another.
display(
'Does date_range_1 contain date_range_2?',
date_range_1.contains(date_range_2)
)
display(
'Does date_range_1 contain date_range_3?',
date_range_1.contains(date_range_3)
)
Exceto em caso de indicação contrária, o conteúdo desta página é licenciado de acordo com a Licença de atribuição 4.0 do Creative Commons, e as amostras de código são licenciadas de acordo com a Licença Apache 2.0. Para mais detalhes, consulte as políticas do site do Google Developers. Java é uma marca registrada da Oracle e/ou afiliadas.
Última atualização 2025-07-26 UTC.
[null,null,["Última atualização 2025-07-26 UTC."],[[["\u003cp\u003eThe \u003ccode\u003econtains()\u003c/code\u003e method determines if a given Date or DateRange falls entirely within another DateRange.\u003c/p\u003e\n"],["\u003cp\u003eIt returns \u003ccode\u003etrue\u003c/code\u003e if the provided Date or DateRange is fully enclosed by the target DateRange, otherwise it returns \u003ccode\u003efalse\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThis method is applicable to \u003ccode\u003eee.DateRange\u003c/code\u003e objects in Earth Engine.\u003c/p\u003e\n"],["\u003cp\u003eExamples are provided in both JavaScript and Python to illustrate the usage of \u003ccode\u003econtains()\u003c/code\u003e.\u003c/p\u003e\n"]]],["The `contains()` method checks if a given `Date` or `DateRange` falls within a specified `DateRange`. It takes an `other` object as an argument and returns a Boolean value. For example, if `dateRange1` is '2017-06-24' to '2017-07-24' and `dateRange2` is '2017-06-30' to '2017-07-10', `dateRange1.contains(dateRange2)` will return `true`. Otherwise it will return `false`. The method is used in both JavaScript and Python.\n"],null,["# ee.DateRange.contains\n\nReturns true if the given Date or DateRange is within this DateRange.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-----------------------------|---------|\n| DateRange.contains`(other)` | Boolean |\n\n| Argument | Type | Details |\n|-------------------|-----------|---------|\n| this: `dateRange` | DateRange | |\n| `other` | Object | |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// A series of ee.DateRange objects.\nvar dateRange1 = ee.DateRange('2017-06-24', '2017-07-24');\nvar dateRange2 = ee.DateRange('2017-06-30', '2017-07-10');\nvar dateRange3 = ee.DateRange('2010-06-24', '2020-07-24');\n\n// Determine if an ee.DateRange is contained within another.\nprint('Does dateRange1 contain dateRange2?', dateRange1.contains(dateRange2));\nprint('Does dateRange1 contain dateRange3?', dateRange1.contains(dateRange3));\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# A series of ee.DateRange objects.\ndate_range_1 = ee.DateRange('2017-06-24', '2017-07-24')\ndate_range_2 = ee.DateRange('2017-06-30', '2017-07-10')\ndate_range_3 = ee.DateRange('2010-06-24', '2020-07-24')\n\n# Determine if an ee.DateRange is contained within another.\ndisplay(\n 'Does date_range_1 contain date_range_2?',\n date_range_1.contains(date_range_2)\n)\ndisplay(\n 'Does date_range_1 contain date_range_3?',\n date_range_1.contains(date_range_3)\n)\n```"]]