Wednesday, July 14, 2010

Redwoods - Day 1

We have begun growing some Coastal Redwoods (Sequoia sempervirens) from seedlings.

The two seedlings arrived in the mail today from a grower in Michigan. Found them on eBay for about $4 each. They were packed in a cardboard box with shredded newspapers to keep them protected and wet?. They apparently are in good health after that trip. My uneducated guess, from reading about growing these online, these two are probably several months old at least.

Specimen B2
Approximately 9" tall


Specimen J2
Approximately 10" tall



I have been using a number of resources online for tips on growing redwoods. We'll see how they do and I'll continue to post updates here to track their progress.

http://www.virtualsecrets.com/redwood_and_pines.html
http://www.redwoodworld.co.uk/faqs.htm
http://www.ehow.com/how_4421951_plant-grow-redwood-seedling.html

Sunday, June 27, 2010

GeoDjango review - part 2

In order to have a real understanding of what GeoDjango could offer I needed to get my hands dirty.

Following this installation guide I went about creating my own GeoDjango stack locally.

My stack included the following components:

  • Windows Vista Home Premium x64

  • Python 2.6.2

  • PostgreSQL 8.3.11-1 (PostGIS not available for 8.4 yet[1])

  • PostGIS 1.3.6

  • psycopg2-2.0.10.win32

  • GeoDjango installer[2] (for windows , bundles together Django 1.1, GDAL 1.6.0, PROJ 4.6.1 and the GeoDjango components)



Following installing the software I went through the basic GeoDjango tutorial to load the a sample "World Borders" shape file data set to PostGIS and create necessary models in the Django db.

Following these steps worked perfectly for me, there is nothing I can really add. I would say that one feature that is missing from the tutorials, sample projects online and I would daresay, geodjango itself is a default viewer for viewing your entire layer set on one map. I couldn't find any such advice on taking this to the next step and it was not included in their default admin site, you can only view the world border records one at a time on individual screens.

To get a better sense of the Django framework's features I went through some of those "Hello World" style examples to build some basic templates and views with their framework, which I have to say being new to Python and modern webframeworks in general was quite easy.

Essentially I went through chapters 1 - 4 of the online The Django Book in an afternoon.

GeoDjango review

Recently I was asked to present my evaluation of a geospatial web framework called GeoDjango. This was in the context of a job interview with a center for geographical analysis at a local university.

I had to come up with a presentation based on benefits or features relative to a proposed system that the center wanted to develop for allowing users(researchers presumeably) to upload and manage map related data for geospatial analysis. Not knowing anything about GeoDjango or much about the whole geospatial research domain outside of my limited WorldWind exposure this was quite a test. As part of this presentation and my own attempt to show my skills for the interview, I set up a demo installing GeoDjango locally following some basic tutorials. The following is a summary of my analysis taken from my presentation.

GeoDjango - Summary

• Built as extension to the Django web framework written in Python.

• Open Source

• Includes related Geospatial Python libraries: GDAL/OGR(subset of full GDAL features, vector only), GEOS (geometry operations), PROJ.4(map coordinate projections)

• Support for spatial databases, PostGIS, Oracle, MySQL, etc…

• Extends Django Admin Site for directly editing models

• Built in cmd-line utilities for importing data into your database

GeoDjango – Some Useful Features

Based on the requirements I was given I took a look at the various features you get out of the box by using this framework over any of the other general frameworks of which there countless numbers these days or other “similar” products written in Java, Ruby, etc.

You do get some useful features, mostly the big draw that Django provides is it’s default CRUD administration interface where you can directly modify database records or just view them. In addition to CRUD representation for your “Models” (essentially a Model is the Django representation of a db table), you get a user admin interface for adding/updating user accounts as well as groups of users. The Django framework includes a basic permission model, where you can assign users or groups to the pre-defined permissions. The permissions allow you to grant users the ability to add records, update records or delete records. These permissions are enforced by the admin UI, though you would have the methods to check user’s permissions when creating your own UI pages. One missing privilege in my opinion is a “view” permission.

Beyond the front end the Django model provides various libraries set up for some common features of any web framework such as user authentication, a comment framework with automated moderation. On the geospatial side there seems to be the useful inclusion of the various geospatial libraries. What seems to be useful, not being an expert, were the inclusion of libraries for simplifying queries to the spatial database, supposedly no SQL required. There is also good support for conversion of your spatial data into various output formats such as the GML or KML formats.

Analysis of GeoDjango supporting requirements

These were some of the requirements the center had, and my evaluation of them.

User to upload spatial data (Shape, GeoTiff at a minimum)

• Shape Files

▫ Possible, Python utilities exist for importing Shape files

▫ Different Shape file attributes require coding Python models

• Geotiff

▫ Raster formats are not supported in GeoDjango

▫ Possible other 3rd party libraries could be leveraged (WKTRaster for PostGIS)

User to control visibility of data (who can see my data, public, private, shared)

• Django administration UI allows configuring permissions for user access to a Model type, but not by “owner” or “creator” of instances of Models.

• Only administrators have ability to add or remove permissions from other users. No way to specify which permissions they could grant or take away.

• Would require some extension of Django security model to provide this feature as well as change to UI screens.

User to control access to who can interact with their data

• Can restrict who could see or edit through the admin UI by Models but not by a user’s own content.

• Permissions not granular enough for mark-up / edit distinction in admin screen.

• Would require extension of security model and rework of current admin UI.

Conclusion

• Some of the central requirements are not available in GeoDjango off the shelf.

• Implementing the required features could still be done in GeoDjango framework.

• Most useful features of GeoDjango seem to be on server-side relating to interacting with the geospatial data.

• Django itself provides useful framework for dynamic website creation.

References

Couldn’t possibly list every site I visited to find all this data, and some of it came from my own observations. Here are few useful sites for more information

· http://geodjango.org/presentations/

· http://groups.google.com/group/geodjango

· http://docs.djangoproject.com/en/1.2/ref/contrib/gis/install/#windows-xp

· http://www.ohloh.net/p/geodjango

· A day with GeoDjango - Thinking in GIS

· http://www.geowebguru.com/articles/99-overview-geodjango

Tuesday, June 15, 2010

Dojo filteringselect popup out of position on window resize

There is an issue(or enhancement request if you want to be specific) with the Dojo dijit.form.FilteringSelect widget where if you resize your browser window while the popup containing the dropdown options is open the popup retains it's original positioning relative to the browser window edge not it's parent widget e.g. the FilteringSelect text box.

This is documented fairly well at Ticket #5777 popups: close when window resized.

In the case of filtering select I feel it is a valid workaround to close the popup on window resize.

My workaround is here, although I am sure there may be more elegant ways. This assumes some familiarity with dojo and the FilteringSelect widget.

Start with the widget itself, assume you have necessary infrastructure for this FilteringSelect i.e. data store, dojo.requires, etc...
<input dojoType="dijit.form.FilteringSelect"
searchAttr="name" store="principalRisk1DataStore" class="medium" id="principalrisk1" name="principalrisk1" />


In order to close the popup containing the drop down selections for this FilteringSelect I need an onResize method


function onWindowResize()
{
//get the popup created when you click the widget, by default this seems to be the id of your input + _popup
var principalRisk1 = dijit.byId('principalrisk1_popup');
//useful for firebug to see what you get
console.debug(principalRisk1);
//this method closes the popup node you retrieved
dijit.popup.close(principalRisk1);
}


Now, lastly add this to the body tag's handler for onresize

<body class="tundra" onresize="onWindowResize()">

Saturday, May 15, 2010

Exploring the Milky Way

I was sent to South Africa for work during April for about three weeks. I brought a long plenty of reading material (not safe to walk outside supposedly). The first book I read was Exploring the Milky Way by Donald Goldsmith (1999) which I checked out of my local public library. Let's just say that reading this book lit a fire under me, I want to learn more about how they actually write software for a probe that is millions of miles away and 10hrs away from any instruction from Earth. So how do they actually write that code? Did they program an AI in C++? Is it some crazy assembly language? I am guessing Java or .NET isn't a skill that would be particularly useful for the Cassini and Galileo missions. I think my basic questions are echoed by others, for example this poster(Developer.*: "Code for Nasa space probes" By berrydoo)
I've been reading a lot lately about the two Mars rovers, and the Galileo space probe thats orbiting Saturn's moon Titan. And I'm really curious to read about the software design of those machines. That must be some of the most complicated code ever written. These machines have to be "smart" enough to manage navigation through space, communication with earth, management of sensors and storage of sensor information, create and possibly interpret diagnostic data, and be smart enough to recover if a problem occurs. What should it do if it cant communicate with earth any more? What should it do if one of it's systems fails? I'd venture to say that code is about as close as we come right now to artificially intelligent machines.

Does anybody know where I could read more about this topic? I've looked around, but I cant find anything on the internet. That information might be classified, but I just thought I'd ask.


Well sir, I had the exact same questions, so I started to google it. My own particular interest had more to do with the deep space missions to the outer solar system, Jupiter, Saturn, etc. That limits it down to the Voyagers (software probably written in the 70s), Galileo (Jupiter mission, 1989 - 2003), Cassini (Saturn, 1997 - present). Certainly there a couple missions underway or to be launched (e.g. Juno).

I decided to look into Cassini. In the end I found a number of resources that help explain how the software was designed and what it does. (Cassini software was written in Ada)

So if you want to know more about Cassini or other spacecraft implementation details these are some useful resources I've found:


  • Basics of Space Flight, JPL
    http://www2.jpl.nasa.gov/basics/index.php
    Top to bottom introduction to physics, mission operations and spacecraft components. Useful reference or for putting it all together. Much higher level than many of the technical papers describing the actual software or components that assumes this knowledge.

  • The Cassini Spacecraft: Object Oriented Flight Control Software, Hackney, J., Bernard, D.Rasmussen, R.
    http://hdl.handle.net/2014/34861
    Article about how they used OO methodology for design of components to steer/orient the spacecraft.

  • An Attitude Control Design for the Cassini Spacecraft, Wong, Edward
    http://hdl.handle.net/2014/30851
    How the spacecraft determines attittude and estimates attitude for pointing (Star-sensor, sun-sensor, gyros, etc..)

  • System Fault Protection Design for the Cassini Spacecraft, Slonski, John P.
    http://hdl.handle.net/2014/31814
    Attempts at generic or reusable fault protection models, designs and algorithms for fault protection.

  • Cassini Star Tracking and Identification Algorithms, Scene Simulation, and Testing, Alexander, James W.
    Chang, Daniel H.
    http://hdl.handle.net/2014/26388
    How the spacecraft's star tracker, literally takes an "image" of the sky, on the fly looks up the configuration of stars in an on-board "database", calculates relative distance between stars, and then based on that can give an estimate of where it is pointing. Amazing stuff.


More public domain, articles in PDF format are also available for many subjects on BEACON eSpace at Jet Propulsion Labratory.

Enter the Dojo

I was struggling with a project at work last week involving Dojo, and elements of AJAX, JSON.

One downside, the Dojo documentation is all over the place, a lot of it is incomplete and when you google search you often see out of date pages or broken links come up first.

My project was cool in a way and I can go into what it involved. But first to give credit where credit is due, I found this really helpful tutorial to add checkbox inputs to a Dojo/Dijit tree (yes it is much harder than one would think)

http://www.thejekels.com/dojo/Dijit_Tree_Chkbox.html

Examples were easy to follow and worked (note that the first steps in the tutorial don't actually work in Dojo 1.4, but he helpfully points that out the workarounds near the end).

Wednesday, March 3, 2010

Best Coffee Blend

Recipe for the best ice-coffee I've ever tasted.

Prerequisite: Home filter-brewing coffee maker.

2 spoons of Trader Joe's Dark Sumatra
2 spoons of New England Coffee Blueberry cobbler
2 spoons of Trader Joe's Colombia Supremo medium roast

4 cups of water

Brew with coffee maker

Mix the brewed coffee with 6-7 packets of Splenda

Chill for until needed.

Serve with plenty of ice and a decent amount of half & half