Multiple colormaps in one axis

Posted on Updated on

I recently mentioned that MATLAB now lets you easily use different colormaps in one figure. The trick is to provide the axis handle as first input argument to the colormap function call.

DEM = GRIDobj('srtm_bigtujunga30m_utm11.tif');
ax(1) = subplot(2,1,1);
imagesc(DEM); 
colorbar;

ax(2) = subplot(2,1,2);
imagesc(DEM); 
% Use the axis handle as first input argument
% to colormap
colormap(ax(2),landcolor); 
colorbar
multiplecmaps.png
Multiple colormaps in one figure.

However, how do you use multiple colormaps in one axes? That’s a little more tricky. Below, you find commented code that shows how to plot a colored and hillshaded DEM together with a stream network colored with ksn-values.

% Some data (DEM and ksn of river network)
DEM = GRIDobj('srtm_bigtujunga30m_utm11.tif');
FD  = FLOWobj(DEM);
A   = flowacc(FD);
S   = STREAMobj(FD,'minarea',1000);
k   = smooth(S,ksn(S,DEM,A),'K',1000);

% Create a new figure
hFig = figure;
% Call imageschs which has some parameter/value pairs
% to control colormap and colorbar appearance 
imageschs(DEM,[],'colormap','landcolor',...
                 'colorbar',true,...
                 'colorbarylabel','Elevation');

% Get the current axes
h_ax = gca;
% Create a new axes in the same position as the
% first one, overlaid on top.
h_ax_stream = axes('position', get(h_ax, 'position'),...
                   'Color','none'); 
% Plot the stream network               
plotc(S,k,'LineWidth',2);
% Make axis invisible
set(h_ax_stream,'Color','none');
% Create a colorbar
hc = colorbar(h_ax_stream,'Location','southoutside');
% ... and label it
hc.Label.String = 'ksn';
% Adjust color range
caxis(h_ax_stream,[0 200])
% Perfectly align both axes
set(h_ax_stream,'position', get(h_ax, 'position'),...
                'XLim',xlim(h_ax),...
                'YLim',ylim(h_ax),...
                'DataAspectRatio',[1 1 1]...
                );
% Link both axes so that you can zoom in and out            
linkaxes([h_ax,h_ax_stream],'xy');

% Resizing the figure may screw it all. Using the figure
% property ResizeFcn makes sure both axes remain perfectly
% aligned
hFig.ResizeFcn = @(varargin) ...
    set(h_ax_stream,'Position',get(h_ax, 'position'));
multipleaxes.png
Multiple colormaps in one axis.

The trick is to use additional axes. The difficulty lies in perfectly aligning them and to make alignment robust against resizing the figure.

Advertisements

Limits to hydropower expansion in the Himalayas

Posted on Updated on

Fig_S1_GEARTH_blog
The Upper Trishuli 3A hydropower project following the Gorkha Earthquake in 2015. Red lines are mapped coseismic landslides.

The 2015 Gorkha earthquake in Nepal caused severe losses in the hydropower sector. The country temporarily lost ~20% of its hydropower capacity, and >30 hydropower projects were damaged. In our paper that was just published in Geophysical Research Letters, we show that the projects hit hardest were those that were affected by earthquake‐triggered landslides. These projects are located along very steep rivers with towering sidewalls that are prone to become unstable during strong seismic ground shaking. A statistical classification based on a topographic metric that expresses river steepness and earthquake ground acceleration is able to approximately predict hydropower damage during future earthquakes, based on successful testing of past cases. Thus, our model enables us to estimate earthquake damages to hydropower projects in other parts of the Himalayas. We find that >10% of the Himalayan drainage network may be unsuitable for hydropower infrastructure given high probabilities of high earthquake damages.

Of course, we conducted the analysis primarily using TopoToolbox. A few functions that we used and partly developed for the purpose of our analysis are

  • STREAMobj/chitransform
  • STREAMobj/mchi
  • STREAMobj/smooth
  • STREAMobj/hillslopearea

References

Schwanghart, W., Ryan, M., Korup, O., 2018. Topographic and seismic constraints on the vulnerability of Himalayan hydropower. Geophysical Research Letters, in press. [DOI: 10.1029/2018GL079173]

see also Nature News article by Jane Qiu, 2018. Landslides pose threat to Himalayan hydropower dream. [DOI: 10.1038/d41586-018-06212-8]

Overview of scientific colormaps

Posted on

Visualization is a vital part of scientific presentation and communication. This is why I have recently added some utilities that support making plots in TopoToolbox (see also my previous blogs “Jet is dead” and “Better colormaps with TopoToolbox”). One of the major additions has been Fabio Crameri’s scientific colormaps which are accessible through the function ttscm that you’ll find in the folder colormaps.

Fabio recently amended his compilation by a number of color schemes that I have now added. Please see an overview of the available colormaps in the figure below which I created by following lines of code.

DEM = GRIDobj('srtm_bigtujunga30m_utm11.tif');
cmaps = ttscm;
for r = 1:numel(cmaps); 
   subplot(6,4,r); 
   imageschs(DEM,[],'colormap', ttscm(cmaps{r}),...
                    'colorbar',false,'ticklabels','none');
   title(cmaps{r});
end
scm_colormaps.png
Shaded topography of the Big Tujunga Catchment visualized by different scientific colormaps.

You can find some more information about these colormaps here and here.

Finding knickpoints in river profiles

Posted on Updated on

Did you know that TopoToolbox has a function to identify knickpoints in river profiles? Well, if you don’t know, now you know.

The function is called knickpointfinder. It uses an algorithm that adjusts a strictly concave upward profile to the actual profile. Offsets between the actual and the concave upward profile occur where the actual profile has convexities. Relaxing the concavity constraint where offsets attain a maximum will adjust the concave profile to the actual profile. knickpointfinder adjusts the profile iteratively until offsets fall below a specified tolerance value. Look at the animation below which probably explains more than a thousand words.

knickpointfinder
Animation of the example found in the knickpointfinder help.

Using knickpointfinder is easy. Just see the function help to run the example whose results are shown above.

knickpointfinder.png
Final result with adjusted network and identified knickpoints (red squares). The size of the squares relates to the offset between the actual profile and the strictly upward concave profile.

Let us know how well knickpointfinder suits your needs. Note that this algorithm is not yet published, so please give credits to our TopoToolbox paper if you are using this algorithm in your work.

Jet is dead

Posted on

Jet is dead, long live parula! The criticism of MATLAB’s former default colormap is all around. Jet is perceptually non-uniform. Our brains tend to detect changes between particular kinds of colors better than the transition between others. The colormap jet is thus misguiding, it accentuates parts of your data and thus misrepresents it.

I have to admit that I used jet for quite a while. And it was the default colormap of imageschs, one of the core visualization tools in TopoToolbox. These days are over now. The default colormap is now parula which you’ll find in the folder colormaps. In addition, you’ll find other colormaps:

– landcolor
– flowcolor
– magmacolor
– and a whole bunch of terrain coloring maps in ttcmap

And the good thing: Now you can have multiple colormaps in one figure…

DEM = GRIDobj('srtm_bigtujunga30m_utm11.tif');
subplot(2,2,1);
imageschs(DEM,[],'colormap','landcolor','ticklabels','nice')
title('DEM - landcolor')
subplot(2,2,2);
G = gradient8(DEM);
imageschs(DEM,G,'colormap',flipud(magmacolor(255)),'ticklabels','nice')
title('Gradient - magmacolor')
subplot(2,2,3);
FD = FLOWobj(DEM);
A  = flowacc(FD);
A  = dilate(A,ones(5));
imageschs(DEM,sqrt(A),'colormap','flowcolor','ticklabels','nice')
title('Flow accumulation - flowcolor')
subplot(2,2,4)
[clr,lims] = ttcmap(DEM,'cmap','gmtglobe');
imageschs(DEM,[],'colormap',clr,'caxis',lims,'ticklabels','nice')
title('DEM - gmtglobe')

 

colormaps.png

Of course, you can use all kinds of colormaps with imageschs such as hot, spring, etc. If you use custom colormaps, remember that

  • imageschs requires colormaps with less than or equal 256 colors or 255 if there are nans in the data.
  • you can easily flip colormaps, e.g. flipud(gray(255)).
  • you can easily build your own colormaps using colormapeditor.

Do you have a favourite colormap that you want to share with others and that should be included in a future release of TopoToolbox. TopoToolbox could need a bipolar colormap for displaying curvature, for example.

Open Ph.D. position at the University of Roma

Posted on

Here is an advertisement for an open PhD position at the University of Roma for a project led by Paolo Ballato and Claudio Faccenna. I am collaborating in the project.

Ph.D. position at the Department of Science (Section Geology) of the University of Roma

Deciphering the Mantle Contribution on Surface uplift in the Atlas-Meseta system (Morocco).

The idea that mantle flow dynamics may contribute to the topographic development of orogens has changed our vision on mountain building processes and inspired an increasing number of modelling studies. Isolating and documenting such a contribution however, has been proved to be difficult, especially in continental settings where the paleontological record is not as determinant as in marine systems. This research proposal aims to decipher the influence of mantle flow on the topographic growth of the Atlas-Meseta system of Morocco. There, the occurrence of several hundred of meters of mantle driven uplift, offers the possibility to investigate magnitude, timing and rates of surface uplift, by means of a multidisciplinary approach involving recent advancements on stratigraphy, geomorphology, geochronology, and low-temperature thermochronology. The outcome of this field- and laboratory-based approach will be finally integrated for developing an analogue geodynamic model and gain more insights into the mechanisms of mantle flow. Specifically, the candidate student will quantify longitudinal and latitudinal spatio-temporal patterns of surface uplift and regional tilting induced by mantle flow along two transects across the Atlas-Meseta system. In addition, the expected results will provide geological information that will be used for calibrating a final geodynamic analogue model, which will be of general interest for unravelling the evolution of mountain belts that are not supported by orogenic roots.

Supervisors

Paolo Ballato and Claudio Faccenna (University of Roma Tre)

Collaborators

Taylor Schildgen (GFZ Poytsdam), Wolfgang Schwanghart (University of Potsdam), Giuditta Fellin (ETH Zurich), Francesca Funiciello and Federico Rossetti (University of Roma Tre)

Requirements

The successful candidate must have high motivation, a MSc degree in Geology, Earth Sciences or equivalent, solid basic knowledge in field geology, geomorphology, stratigraphy and tectonics. Basic knowledge in ArcGIS and MATLAB are also required. Applicants must be also proficient in spoken and written English and have teamwork skills.

Information and application

To apply, please send a cover letter clarifying your overall motivation together with your curriculum vitae and names, telephone numbers, and e-mail addresses of two referees to Paolo Ballato (paolo.ballato@uniroma3.it), before June 18th.

Conditions of employment

The project will start on November 1st as part of the University of Roma Tre Ph.D. programme (34th cycle) and will last 3 years. The scholarship has an annual amount of 13.638,47 Euro (social security fee included) and is increased (+50%) for periods of study or research abroad.

If you have any questions regarding this offer please feel free to contact Paolo Ballato (paolo.ballato@uniroma3.it) and/or Claudio Faccenna (claudio.faccenna@uniroma3.it).

Crowd-solving problems in earth science research

Posted on

Diving under the scientific iceberg

This year’s EGU featured a new and interesting event format: SC1.29/GM12.1 Crowd-solving problems in earth science research organized by the early-career geomorphologists Anne Voigtländer, Anna Schoch, Elisa Giaccone, Harry Sanders, Richard Mason and Johannes Buckel. I was among the lucky participants.

In their blog post, the organizers summarize the event and highlight its role in stimulating active participation and communication. When I was a young PhD, active participation and communication was something I missed at these large conferences. Rather, I found myself consuming talks rather than being an active part of the discussion. After a few years I now feel more at ease, I actively contribute, and the EGU assembly has become a place to meet colleages and friends.

I think that an event format like the crowd-sourcing session could stimulate this process in particular for young researchers. This doesn’t mean, however, that — if the session was happening next year — only young researchers should attend. Rather, this event would benefit a lot from the exchange of the young and experienced scientists. I’ll definitely take part next year, and I hope you’ll do so, too.