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.

Build one local datacube for a small ROI

ESA

This notebook shows how to combine several datasets into a single cube in a simple way, based on nearest neighbours interpolation . It is similar to how the large 100m Antarctica cubes were built:

  1. Creating a regular target grid

  2. Transforming all the data to zarr raster datsets

  3. Interpolation to the target grid the using nearest neighbour method

The example uses an 80 km by 80 km Amundsen Sea region at 200 m spacing, for a specific date, which is small enough to run quickly. If you want to run it one a larger area, or time horizon youll have to update the code.

Loading...

1. Build the target grid template

Loading...

Check the grid location

The red square is the grid region every source will be clipped or interpolated to.

/home/krasen/micromamba/envs/pangeo/lib/python3.13/site-packages/cartopy/mpl/feature_artist.py:144: UserWarning: facecolor will have no effect as it has been defined as "never".
  warnings.warn('facecolor will have no effect as it has been '
<Figure size 900x900 with 1 Axes>

2. Interpolation and transormation

BedMachine layer

BedMachine is already on a projected x, y grid. Clip a slightly larger window, interpolate to the demo grid, and rename the variables for the final cube.

Loading...

Basal melt COG layer

The basal-melt map is a raster file, so read the overlapping window and reproject it directly onto the target grid.

Loading...

Vector mask layers

GeoParquet vector datasets become binary masks. Each feature is clipped to the AOI, rasterised onto the target grid, and stored as an xarray layer.

grounding_line_mask 9 supraglacial_lake_mask 0 subglacial_lake_mask 0 Name: features_in_aoi, dtype: int64

Latest calving-front mask

The calving-front file contains multiple times, for the this notebook we only select only the latest timestamp and then rasterise it.

calving_front_mask: 1 latest features intersect the AOI
Loading...

Surface elevation change layer

SEC is coarser than the target grid. Interpolate the continuous fields with linear and the class field with nearest.

/tmp/ipykernel_21488/3364620909.py:23: FutureWarning: In a future version of xarray the default value for compat will change from compat='no_conflicts' to compat='override'. This is likely to lead to different results when combining overlapping variables with the same name. To opt in to new defaults and get rid of these warnings now use `set_options(use_new_combine_kwarg_defaults=True) or set compat explicitly.
  sec_layer = xr.merge([sec_continuous.astype("float32"), sec_surface.to_dataset()])
Loading...

Ice velocity layer

Select the velocity data closest to the requested date, interpolate the easting/northing components, and recompute speed on the target grid.

Loading...

11. Ice temperature layer

The temperature dataset is curvilinear: it stores latitude and longitude arrays rather than regular x, y coordinates. Project those source points to EPSG:3031, then assign each target cell the nearest source value.

Loading...

3. Merge and write the cube

All layers now share the same coordinates. Merge them into one dataset, add CRS metadata, and write a local Zarr cube.

[########################################] | 100% Completed | 154.18 s
Loading...
Loading...
/home/krasen/micromamba/envs/pangeo/lib/python3.13/site-packages/cartopy/mpl/feature_artist.py:144: UserWarning: facecolor will have no effect as it has been defined as "never".
  warnings.warn('facecolor will have no effect as it has been '
/home/krasen/micromamba/envs/pangeo/lib/python3.13/site-packages/cartopy/mpl/feature_artist.py:144: UserWarning: facecolor will have no effect as it has been defined as "never".
  warnings.warn('facecolor will have no effect as it has been '
/home/krasen/micromamba/envs/pangeo/lib/python3.13/site-packages/cartopy/mpl/feature_artist.py:144: UserWarning: facecolor will have no effect as it has been defined as "never".
  warnings.warn('facecolor will have no effect as it has been '
/home/krasen/micromamba/envs/pangeo/lib/python3.13/site-packages/cartopy/mpl/feature_artist.py:144: UserWarning: facecolor will have no effect as it has been defined as "never".
  warnings.warn('facecolor will have no effect as it has been '
/home/krasen/micromamba/envs/pangeo/lib/python3.13/site-packages/cartopy/mpl/feature_artist.py:144: UserWarning: facecolor will have no effect as it has been defined as "never".
  warnings.warn('facecolor will have no effect as it has been '
/home/krasen/micromamba/envs/pangeo/lib/python3.13/site-packages/cartopy/mpl/feature_artist.py:144: UserWarning: facecolor will have no effect as it has been defined as "never".
  warnings.warn('facecolor will have no effect as it has been '
<Figure size 1600x1000 with 12 Axes>