Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Access SEN4Amazonas Data

EarthCODE data access example

ESA

This notebook opens a SEN4Amazonas tree-cover-change Zarr cube, selects a small Amazon region, computes the subset, and visualises time-varying forest change.

import xarray as xr

data_url = 'https://s3.waw4-1.cloudferro.com/EarthCODE/OSCAssets/s14science_amazonas/s14science_amazonas_tree_cover_change.zarr'

ds = xr.open_zarr(data_url)
ds
# note lat goes from max to min
min_x, min_y, max_x, max_y = (-64.8, -7.3, -64.7, -7.2)
aoi = ds.sel(lon=slice(min_x, max_x), lat=slice(max_y, min_y), time=slice('2017-01-02', '2021-01-14'))
aoi
aoi = aoi.compute()
import numpy as np
ds_sum = aoi['tree_cover_change'].sum(dim='time', skipna=True)
import hvplot.xarray
import cartopy.crs as ccrs
ds_sum.where(ds_sum > 0, drop=True).hvplot(
    x='lon', 
    y='lat', 
    crs=ccrs.PlateCarree(),
    tiles='OSM',
    title=f'Total change {aoi.time.min().values} - {aoi.time.max().values}',
    width=600,
    height=500
)