Wednesday, 27 November 2013

Cartoon contributions to modelling real world physics

Movie physics

Numerical modelling is an important tool for most natural hazard researchers. Excellent codes now allow scientists and engineering practitioners the opportunity to simulate natural processes in both static and dynamic states. These codes typically grow from state-funded natural hazard research initiatives, and are principally aimed at understanding the 'bigger picture' in order to evaluate natural processes at the scale that poses a hazard to people and property.

Every now and then, however, it's worthwhile remembering the hazard researcher's not-so-distant, though often wealthier cousins in animation research. Although often dealing with smaller scale problems, the requirement for animators to come up with realistic-looking dynamic models for movies and computer games is currently driving a large amount of commercial research in scalable physics models. Physics-Based Animation is useful blog detailing recent advances in simulating physics for human visual consumption. This week Gizmodo featured work from the new movie Frozen, including an impressive Material Point Method snow simulation, applying real physical properties (compressibility, tensile strength, strain hardening, density, Young's modulus, and Poisson's ratio) to model snow as a dynamic, compressible granular material.

The models presented in the above video contain between 4x10^6 (snowplow) and 7x10^6 (rolling snowball) particles, sufficient for the evaluation of small to medium-scale rock or soil slope stability hazards, or possibly the design of protection structures which may interact with debris flows or snow avalanches. These simulations commonly use approximate solutions to replicate complex physical behaviors, however, as demonstrated in the above example, 'expert knowledge' (everyone's seen a snow plow in action) can provide good verification for such visual models.

As well as simulating situations with extremely large strains, models developed for animation purposes are also able to reproduce complex fracture behaviours, and examples such as that below may make their way into geohazard studies investigating, for example, particle fragmentation during rock avalanche, or rock slope failure as a result of earthquake shaking.

Blender - the free, open source alternative

Although the commercial nature of these codes often means the software itself is wrapped up in propriety licences, the maths and physics behind the above simulations are published in scientific journals (here and here). Blender is a free and open source 3D 'creation pipeline' (physics-based animation software) designed with fluid, rigid body physics, and particle tracking simulations in mind.

User-developed plugins and tutorials provide the opportunity for enthusiasts (or practitioners from generally unrelated fields) the opportunity to access these advanced simulation techniques, and drawing inspiration from commercial software, are often not far behind the state-of-the-art. Although limitations currently exist in terms of particle numbers and physical calibration, mean that animation software is currently no match for specifically designed and calibrated geohazard simulation software such as RAMMS, these are not insurmountable obstacles. As demonstrated by the simulation below, projects such as Blender may soon provide some exciting opportunities for research and mitigation of dynamic gravitational hazards, and at least so far, provides useful insight which may improve snowman mortality in the upcoming winter.  

Friday, 20 September 2013

Location and volume of the La Pintada landslide

Heavy rainfall from hurricane Manuel initiated a large landslide which struck the village of La Pintada (Mexico) this Monday. 58 people have been reported missing in the small village, and at least 20 buildings have been destroyed. Although helicopters have rescued most of the villagers, 45 people remain, and authorities are concerned that "The rest of the hill could fall.". It is almost inevitable that such a large landslide in the narrow valley will cause major difficulties for rescue crews in the coming days, and access into much of the remote coffee growing region is likely to be challenging in the wake of the storm.

An aerial view of the La Pintada landslide
Source: Amador Narcia/Twitter

The above image is one of the first released of the region, and clearly conveys the devastating effect of the landslide. Getting information out to concerned parties can be critically important in such situations, although an accurate sense of scale and location data for early social media images is rarely available. Using the 'Add Photo' dialogue in Google Earth, however, we can use media images to locate, map, and make early decisions regarding ongoing risks and emergency response very soon after disastrous events. Using the Google Earth API we are able to approximately locate the position from which the above photograph was taken, as well as the position of an image which seems to provide an overview of the deposit area prior to the failure. The interactive map below represents an initial interpretation of the spatial extent of the landslide deposit (outlined in brown), as well as an initial guess as to what may be the source of the failure (outlined in grey).

Interactive map indicating the estimated source (grey), and mapped deposit (brown), as well as two photographs covering the area of the damaged village (double click to view). An updated .kmz file (including additional aerial photographs and and revised map of the scarp from 21/09/13) is available as a Google Earth download here

As is evident above, the landslide initiated on a partially vegetated slope to the north of the village, and as reported, appears to have buried much of the eastern side of the community. Survivors report a loud rumbling, and very rapid failure, which is evident from the map as at least one building seems to have been pushed around 30 m from it's foundations (white arrow).  A depression formed at the back of the deposit (adjacent to the hillslope) indicates the energetic landslide mass probably scoured sediment out from the toe of the slope, and did not stop moving until the whole mass reached the valley floor. Calculation of the landslide volume using a combination of the measurement tools in Google Earth and an estimation of the deposit thickness from the aerial photograph suggests approximately 100,000 m^3 of debris remains in the village, although the failure may have been larger as there has been some erosion of the deposit adjacent to the river channel. 

An image taken looking east, across the village prior to the landslide. The mass travelled from left to right, through the buildings in the farground.
Source: gatopelu008\Panoramio

While it is not immediately apparent why this particular slope failed during the storm, there appears to be some evidence for planar failures on similarly oriented slopes elsewhere in the valley. Judging from the weathered appearance of the landslide deposit, it seems likely that bedrock degradation has been ongoing as part of the landscape's natural weathering and erosion cycle. As in many sub-tropical regions, it is possible that either historical, or recent, removal of vegetation led to a local acceleration of these natural processes, decreasing the stability of slope materials, and may have increased the chance of failure during the extreme environmental event.

Map of La Pintada landslide deposit (brown) and assumed source area (grey) derived from the above Twitter photograph

Although there is definitely room to streamline the process of mapping from media photographs, combining Google Earth with social media in this case provides important quantitative insights into the landslide occurrence in a relatively short period of time (~1 hr). Given the limited resources available in many remote or undeveloped regions, these technical aspects are often not addressed, and even more rarely published. Expanding on methods such as those presented here could therefore be a useful means for both local authorities, and the wider research community to investigate and document natural disasters in the future. 

Friday, 21 June 2013

Three simple ways to embed maps in a website or blog

Last week a major debris flow struck the town of Kedarnath, an important Hindu pilgrimage destination in the Uttarakhand region of northern India. One week on, details of the event are ever so slowly beginning to emerge, although the remoteness of Kedarnath, ongoing flooding within the region, and significant damage to infrastructure throughout Uttarakhand, means that much of the information necessary to evaluate both what took place, and assess ongoing risks, remains unknown. The government currently estimates perhaps 10,000 people remain isolated in the valley, while the number of casualties is likely to be in the thousands, and the nature of the hazard remains speculative.

A social media image of the temple at Kedarnath following the debris flow last week

Unfortunately this imprecise picture is common in the period immediately following such disasters, as the chaotic nature of the event disrupts critical infrastructure and information channels. Recently, however, social media networks have begun to fill the gap, as the unregulated nature of the networks allows the information channels to form somewhat organically, as in the case of Uttarakhand, where feeds from people on the ground via Twitter, governmental agencies on Facebook, affected communities using web resources such as Google Person Finder, and data collation on informal blogs are playing a critical role in shaping the response of the region.

The community-driven nature of these information channels means that they can better respond to suit community needs than more formally structured official information channels. Although both methods of communication are important, they serve different purposes, and in some cases the rapid evolution of community-developed information feeds can provide a better, more locally relevant service, than that provided by the state. An example of this is the Canterbury Quake Live website, which was privately set up after the 2010 Canterbury earthquake to collate and disseminate information from three government agencies. Despite these agencies all providing excellent online services, the unique combination and intuitive presentation of the information on a single site suited the residents of Canterbury - This played a key role in educating and informing residents, and three years on, this site remains a principal source of earthquake information, receiving hundreds of visitors daily.

A snapshot of 30 day TRMM rainfall anomalies projected onto Google Earth using the techniques described in this post (data credit: NASA, NOAA)

As natural disasters are inherently widespread events; accurate, clear, and up-to-date presentation of spatial data is an important component of developing information channels. Today we are fortunate to have a number of freely available global mapping services which offer the opportunity for users to relatively simply become involved in the mapping process, and in the case of natural disasters, develop tools to compile or present relevant data in real-time. Although the process is not difficult, these services still appear intimidating to most people. In this post I hope to show how simple it can be to take control of online geodata by presenting three ways to incorporate data on a website using the Google Maps API.

Static Maps API

The Static Maps API allows you to embed a Google Maps image on your webpage without requiring a screenshot or complicated code. This uses a single line of code (see the snippet below the map), within which you can include a number of parameters to style the map appearance. Google provides a handy description of the available parameters on their developers site, however, to quickly get started you can simply copy the code from below and paste it into your website.

Changing the numbers following the 'zoom=' (values from 1 to 21+) increase the zoom from the globe to individual buildings) and 'center=' (as decimal latitude and longitude) parameters will reposition the map. The 'maptype=' parameter is consistent for all the Maps API services, and allows you to change the style of the displayed map from 'roadmap' to 'terrain', 'satellite', or 'hybrid'.

Click to expand/collapse the code for the above map

HTML iframe

An HTML iframe is probably the most efficient means of embedding a custom interactive map into a website. As opposed to the static map above, using the API within an iframe allows users to interact with the map, scrolling, zooming, and changing view modes within the same map. The html required to embed an iframe map in a website also consists of a single line of text, which in this case you can generate using the 'Get link' button on the Google Maps page.

The frame provides a virtual container in which the map code can run, making layout simple, and reducing compatibility issues (see Line & Pixel for a more detailed description of iframes for Google Maps). The iframe uses the full Google Maps API, with abbreviated parameter names to keep the html short. In the example script below I specify the latitude and longitude of the map center following the 'll=' identifier, and use 'q=' to add a pointer at the same location. Strangely I can't find the Google link listing the available parameters, but they are described on this page.

Click to expand/collapse the code for the above map

Google Maps API

The third possibility is by far the most versatile, though requires a small amount of scripting to set up. This allows you to make full use of the Maps v3 API from Google, providing a large amount of creative control with the ability to incude features such as map overlays, historical imagery, and kml layers; although for (some complicated) compatibility issues an extension of the API is required to access to Google Earth functionality within the map window. The trade-off is a reduction in compatibility, as some mobile platforms do not fully support the additional data types, and the Earth API requires a free plug-in to operate in some browsers. One of the easiest resources to begin learning about Google Maps API is the tutorial at, their introduction is clear and simple, and combined with the fantastic example codes at the Google Code Playground provides more-or-less all the necessary details to start users creating their own maps.

Click to expand/collapse the code for the above map

Spatial data for the Uttarakhand monsoon

Although any of these methods can be useful for quickly presenting spatial information, the Maps API is particularly useful for bringing together some of the complex factors associated with the natural disaster. Below is an example created for the Uttarakhand monsoon using a slightly more complicated implementation of the API described above to present data from the Tropical Rainfall Measuring Mission (TRMM) alongside pre- and post-event Landsat 8 imagery provided to the Landslide Blog by Robert Simmon of the Earth Observatory at NASA. TRMM produces live updates of historical and forecast precipitation information as kml files which I have directly linked to the below map. The individual overlays can be switched on and off using the check boxes below, and viewed in 3D using the Earth style - this is particularly useful for the satellite images, though you need to zoom in to the placemark to see them. Any new geodata (such as new satellite images from the region, transport hazards, or flooding information) can be included with this method, which I think could relatively easily be adapted to provide diverse spatial information to people such as those in the Uttarakhand region.

A full-screen version of the map is available from this link.

Additional layers[-]

Disclaimer: All the code in this post was put together with just 1 week of internet research. I am not an HTML programmer, and welcome any comments to improve the content.

Wednesday, 5 June 2013

Five minutes from layout to landscape

The 'Image Overlay' tool is the key to an extremely simple, surprisingly powerful, and somehow little known trick in Google Earth. The tool allows anyone to copy maps out of print documents, drop them onto the terrain model in Google Earth, and then browse the maps in 3D - something that even the authors were often not able to do. It takes less than 5 minutes to import the maps in this way, and as it's so easy, I often use it while reading scientific papers or reports in order to better understand the sites and context of the figures. In the example presented here, I refer to a useful paper from G.J. Hearn (2002) summarizing the practical challenges of mapping and road engineering in some of the most difficult terrain in the world. The experience and insight conveyed in papers like this are very important for the future avoidance and mitigation of geohazards, a quality that becomes particularly apparent when reading the paper in association with 3D maps created using the Image Overlay tool.  

The steps required to transfer a map from paper (or almost-paper) to a 3D relief are described below.

The .kmz maps for this example can be downloaded for Google Earth here. As well as these being nice examples of geomorphological mapping for geotechnical applications, it's interesting to compare the proposed  roads to those now constructed (see the GE 'Roads' layer), and in particular see how both projects were directed by the results of the mapping investigations.

So, while this isn't a difficult process, hopefully the comparison of the 2D map in the first image with the 3D representation above gives an idea how useful this technique can be. And as usual, (thanks to Google) this technique is free for everyone to use, provided the original publishers are wise enough to embrace the benefits of open access - but that's another story!

Hearn, 2002, Engineering geomorphology for road design in unstable mountainous areas: lessons learnt after 25 years in Nepal. Quarterly Journal of Engineering Geology & Hydrogeology v. 35 no. 2 p. 143-154 doi: 10.1144/1470-9236/2000-56