Home

Awesome

Disclaimer

Unless you are (a bit like me) still very fond of working in Matlab at times, I would recommend you to instead check out the more up to date and user friendly TopoPyScale over at https://github.com/ArcticSnow/TopoPyScale described in the recent JOSS paper led by Simon Filhol

Filhol et al., (2023). TopoPyScale: A Python Package for Hillslope Climate Downscaling. Journal of Open Source Software, 8(86), 5059, https://doi.org/10.21105/joss.05059

TopoLAB

Topography-based routines for generating terrain parameters (TopoPAR) as well as downscaling (TopoSCALE) and clustering (TopoSUB) meteorological forcing data. These routines have been ported and adapted to Matlab based on initial work by Joel Fiddes and routines in R and Python.

Alt text

To test the TopoLAB routines simply run the main.m script which goes through the steps of calculating terrain parameters (TopoPAR), splitting the domain into clusters (TopoSUB), and running TopoSCALE. Note that this requires downloading some input data (roughly 70 MB) in the form of processed DEMs and ERA5 data for 2019. The two example sites are the Brøgger peninsula (the area around Ny-Ålesund) on Svalbard and the area aroudn Terelj in central Mongolia. The figure above shows some results for the Brøgger example, run at 30 m resolution with 200 TopoSUB clusters (rather than 200 000 explicit grid cells) with obvious savings in run time and storage, with only small reductions in accuracy.

These TopoLAB routines have been tested in several sites including: Svalbard, Finnmark, Hokkaido, the Sierra Nevada, Finse, Mongolia, and the Pyrenees. The original TopoSUB and TopoSCALE code that TopoLAB is based on has been tested extensively in the Swiss Alps as well as in central Asia.

Contributors (both science & code): Kristoffer Aalstad, Joel Fiddes, Simon Filhol, Sebastian Westermann.

General recipe for running TopoSCALE

  1. Download ERA5 data using python scripts, then merge the .nc files using the Matlab script get_ERA5.m, resulting in a sturcutre ERA5_merged.mat
  2. Download the required SRTM (or ArcticDEM, or ASTER GDEM, or local) DEM tiles for your area of interest. Then run the matlab script get_SRTM.m to reproject (to UTM x,y coordinates), resample, and crop out a square padded domain (set pad accordingly) centered on your area of interest. You create your area of interest using the "mask" array (this can be a square area, or any arbitrary shape, as well as scattered points in the domain). TopoPAR and TopoSCALE will only run for points where mask=1. You can also define an arbitrary target spatial resolution when you resample the DEM, through first nearest neighbor resampling then spatial aggregation (averaging).
  3. Run TopoPAR (see the function TopoPAR.m) using get_TopoPAR.m, this calculates the terrain parameters (elevation, sky view factor, aspect, slope, and horizon angles in 36 bins) for the points in your domain.
  4. To ease the compuational burden, especially for large (>1000s of grid cells) domains consider running the TopoSUB routine. This will perform a dimensionality reduction on your topograhic parameters (from TopoPAR) by assigning them to clusters. Within each cluster, the different parameters should be relatively similar compared to across the clusters. The number of clusters is (by design) several orders of magnitude lower than the number of grid cells. Due to the within cluster similarity running TopoSCALE for the clusters rather than the full DEM will lead to only a minor reduction in performance, but with huge gains in run time and storage.
  5. Run TopoSCALE (see the function TopoSCALE.m) using get_TopoSCALE.m. Here you can set the time that you are interested in downscaling for. Note that this time vector (t) must be the completely contained within your ERA5 data (ERA5_merged.mat) and also be at the same resolution (typically hourly).

References

You can read more about the routines making up TopoLAB (TopoSCALE, TopoSUB, TopoPAR) in the following publications:

In addition, most of the equations in TopoLAB are outlined in Section 2.1 of my thesis:

Some examples of recent studies applying TopoSCALE and TopoSUB include:

with more on the way.

Related repositories

with more in the pipeline.

Acknowledgements

A big thanks to ECMWF and the Copernicus Climate Change Service (C3S) for providing the ERA5 reanalysis data (Hersbach et al. 2020). Thansk as well to the agencies that provide access to global or regional DEMs such as SRTM (USGS), ASTER GDEM (NASA), the ArcticDEM (Polar Geospatial Center), and DEMs of Svalbard (Norwegian Polar Institute). Thanks also to Crameri et al. (2020) for providing some nice colormaps.