Examples

Traversing a Service

This example shows how to traverse the list of coverages in a service:

# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
#

"""This example shows how to traverse the list of coverages in a service."""

from wtss import *

service = WTSS('https://brazildatacube.dpi.inpe.br/')

for cv in service:
    print(cv)

List Available Coverages

This example shows the list of coverages in a service:

# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
#

"""This example shows the list of coverages in a service."""

from wtss import *

service = WTSS('https://brazildatacube.dpi.inpe.br/')

print(service.coverages)

Time Series

This example shows how to retrieve and plot a time series:

# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
#

"""This example shows how to retrieve and plot a time series."""

from wtss import *

service = WTSS('https://brazildatacube.dpi.inpe.br/', access_token='change-me')

coverage = service['MOD13Q1-6']

ts = coverage.ts(attributes=('red_reflectance', 'NIR_reflectance', 'blue_reflectance'),
                 latitude=-12.0, longitude=-54.0,
                 start_date='2001-01-01', end_date='2001-12-31')

print(ts.red_reflectance)

print(ts.NIR_reflectance)

print(ts.timeline)

ts.plot(attributes=['blue_reflectance'])

Text Representations

This example shows how the various text representation for services and coverages:

# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
#

"""This example shows how the various text representation for services and coverages."""

from wtss import *

service = WTSS('https://brazildatacube.dpi.inpe.br/', access_token='change-me')

print(service)
print(str(service))
print(repr(service))
print(service._repr_html_())


print(service['CB4_64_16D_STK-1'])
print(str(service['CB4_64_16D_STK-1']))
print(repr(service['CB4_64_16D_STK-1']))
print(service['CB4_64_16D_STK-1']._repr_html_())

coverage = service['MOD13Q1-6']

ts = coverage.ts(attributes=('red_reflectance', 'NIR_reflectance'),
                        latitude=-12, longitude=-54,
                        start_date='2001-01-01', end_date='2001-12-31')
print(ts)
print(str(ts))
print(repr(ts))
print(ts._repr_html_())