Narwhal comes up for air

ocean data from a fishes' eye point of view

Narwhal is a geoscience-focused Developer Toolkit that simplifies getting data into WWT. I wrote the prototype and Nels Oscar created the first release last summer (2012). Narwhal is available for download here. While the next Narwhal release will probably be October 2013 I wanted to take a minute to catalog what Narwhal can do together with ideas of what it could do. To make sense of this it may help to have the one line overview of how a programming interface to WWT works first!

Overview: My program (which loads and manipulates data) opens a connection to WWT (so WWT must be running as well) and converses through this connection. Most commonly this conversation includes two steps: I create a destination inside WWT for my data, called a Layer, and then I send my data as a formatted string to WWT where it resides in that Layer. The data is then rendered according to our agreed upon rules; for example if I say a Marker is to be blue, is to be located in the Galapagos, and persists from 1831 to 1835 then WWT obligingly draws that marker in that location, provided its internal calendar date is in that time range.

Note: The WWT User Interface enables one to do a lot: Create Reference Frames, add Layers, build Tours, change Properties affecting how data is rendered. While this is essential, a User Interface becomes tedious when a task must be repeated 79 times in a row, each a complex sequence of interactions (right clicks, menu choices, typing in parameters, etc etc). I can handle 2, maybe 3 repetitions... 76 more to go. But no problem, that is what the WWT Layer Control API (LCAPI) is for: Enabling a computer program to do what a person can do manually. The LCAPI has a lot of functionality today, which is why we could write Narwhal, to help out on the external program side.  My vision for the LCAPI is eventual full automation, including access to Reference Frame and Tour creation/manipulation capabilities that are currently still User-only. But today the LCAPI allows us to do a lot, like sending data and changing how it is viewed. This lets us concentrate on helping the research scientist see their data in new ways quickly; and then we get to focus on what that data means. Towards reducing Development time we built and released Narwhal, which has a frame of mind closer to that of the scientist while (under the hood) speaking fluent WWT.

Narwhal review, class by class

Class Scope

Allows you to create a Scope object, a programming proxy for Worldwide Telescope. Your subsequent interactions with WWT are done through this object (much simpler than trying to keep track of ip addresses and WebClient protocols).

Class Layer

Acts as a proxy for a data layer in WWT. You will tend to establish a Layer, then set its properties (for example: Make sure the data in this layer are visible when you are looking up at that data from below), then send the data over.

Class Annotation

Allows one to write text of a given height, location, altitude and color into the Earth. In this way we can build persistent labels near data that indicate what it is. We can also do fanciful things like the Star Wars title crawl from Episode IV (see this link).

Comet PanSTARRS arc through the ecliptic plane

Class Bespoke Marker

Contains customized/bespoke/one-off methods of drawing data particular to visualizations we have built. The first such (Stardust()) created a representation of a comet trajectory (PanSTARRS) passing near the sun. Bespoke Marker tends to use a very common Marker data format: x, y, z, start date, end date, magnitude, color. The coordinates x, y, z might be Cartesian (as in the comet) or Geographical (longitude, latitude, altitude). Those details are typically managed using the Layer object. 

Class Colorizer

Convert data values on some range into a color scheme such as a heat map. If you want temperature probe data rendered in shades of blue, green, orange and red as your probe moves about in space: This is how you would create the color-to-temperature correspondence.

Class Image Layer

Image Layers are distinct from Spreadsheet Layers for the obvious reason that they contain individual images rather than large sets of points, lines and polygons. As such they require different care and feeding.

Class Sensor Platform

Anticipates that you have a robotic submarine.. with multiple sensors on board, each recording its particular data at its own pace. We built this for working with LRAUV data provided by the Monterey Bay Aquarium Research Institute (MBARI).

Class Trajectory

To paraphrase one of the greatest minds of the 20th century: Trajectories allow you to get from point A to point B without all that tedious mucking about in for-loops. So suppose you have the location of a Mako shark on June 1 and another fix on June 17, and they are 130 km apart. You know that your shark did not swim in a straight line but you can imply the connectivity (it is, after all, the same shark) by drawing a dotted line that travels that distance in 16 days. Since the distance is about a degree of latitude you can interpolate those points linearly and now when your shark Tour plays back the connection between fixes will be clear. Which will be nice if you have another 30 or 40 sharks to keep track of at the same time. You can even add bright purple flashes at the two endpoints to emphasize where the actual fixes occurred.

Things To Come

Class Bespoke Segment

The class that will correspond to Bespoke Marker: One-off visualizations that we anticipate would be more than one-off. For example: Vector fields. And for a further example, my favorite variant on a vector field which is a collection of field lines, for example the magnetic field of the sun. Or the magnetic field of Jupiter in relation to its moons... gotta go find that data.

Class Segment Trajectory

The corresponding extension of trajectories to segments and hence vector fields. Let's show the time evolution of the sun's magnetic field during a Coronal Mass Ejection, for example. Any takers??

Class Tour

The class that enables one to create, edit and save Tours. One imagines: Even publish them to Layerscape! (LCAPI correspondence is pending.)

Class Cartesian Segment

An idiosyncrasy of WWT is that Markers can be placed in Cartesian coordinates but line segments (in WKT) are not supported. No problem, this is why we went to high school, to learn trigonometry.

Class Reference Frame

This class will enable one to call into existence a Reference Frame and manipulate its properties. (LCAPI correspondence is pending.)

Class Query

This class enables a Layer to be indexed by element and then queried using the WWT perspective vector. To express this as narrative: The scientist pushes a large volume of data into WWT, then "flies" to that data and inspects it. She looks at a particular data point and thinks 'this is interesting... I wonder which data point this is!' So being careful to put that data point directly in her line of sight, she returns to her data applications and executes a Query: "What data point am I looking at?" The Query class returns her answer, or in fact several answers if there are more than one data point in direct view. She might then change her view angle and ask again. If we are clever about it, the Query class will regenerate the answer (another set of data) and even perform an intersection to reduce (intersect) both query answer sets down to a single data point.