09.28.2006 15:44

xslt for ais

I finally had to give XSLT a try and I am using my prototype XML language for the AIS binary messages (6 and 8). The initial results are fantastic. First, here is a stripped down message in XML format.
<?xml version="1.0" encoding="utf-8"?>
 <?xml-stylesheet type="text/xsl" href="ais.xsl"?> 
<ais-binary-message version="1.0">
  <message name="waterlevel" aismsgnum="8" dac="366" fid="63" efid="1">
    <description>Water level report.  In this case from the NOAA Co-Ops 6 minute raw data</description>
    <note>Prototype only for the Hampton Roads/Elizabeth River 2007 demonstration project</note>
    <see-also>http://opendap.co-ops.nos.noaa.gov/axis/</see-also>


<field name="dac" numberofbits="16" type="uint"> <description>Designated Area Code</description> <required>366</required> </field> <field name="fid" numberofbits="4" type="uint"> <description>Functional Identifier</description> <required>1</required> </field> <field name="efid" numberofbits="12" type="uint"> <description>extended functional identifier</description> <required>12</required> </field>

<field name="stationid" numberofbits="6" arraylength="7" type="aisstr6"> <description>Character identifier of the station. Usually a number.</description> <note>station name should be taken from an external lookup table based on stationid</note> <unavailable>@@@@@@@</unavailable> </field> <field name="waterlevel" numberofbits="16" type="sdecimal"> <description>Water level in centimeters</description> <unavailable>-32768</unavailable> </field> <field name="sigma" numberofbits="32" type="float"> <description>Standard deviation of 1 second samples used to compute the water level height</description> <note>could easily be make a more compact decimal</note> <units>m</units> </field> <field name="link_down" numberofbits="1" type="bool"> <description>Unable to communicate with the tide system. All data invalid</description> </field> </message> <!-- waterlevel --> </ais-binary-message>
That is not the most fun to read. I then started to read the XSLT tutorial here:XSLT at w3schools.com. My first example stylesheet looks like this. Note that I added a line to the above xml to use this stylessheet transformation. ais.xsl:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <html>
  <body>
    <h2>AIS Message</h2>
    <table border="1">
    <tr bgcolor="#9acd32">
      <th align="left">Name</th>
      <th align="left">NumberOfBits</th>
      <th align="left">ArrayLength</th>
      <th align="left">Type</th>
      <th align="left">Description</th>
    </tr>
    <xsl:for-each select="ais-binary-message/message/field">
    <tr>
      <td><xsl:value-of select="@name"/></td>
      <td><xsl:value-of select="@numberofbits"/></td>
      <td><xsl:value-of select="@arraylength"/></td>
      <td><xsl:value-of select="@type"/></td>
      <td><xsl:value-of select="description"/></td>
    </tr>
    </xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>
To first look at the results, I just loaded the file into firefox. Then when it came to writing this up, I used
xsltproc waterlevel.xml > waterlevel.xml
Here are the very nice looking results. Hopefully the nanoblogger css does not mess with the look.

AIS Message


Name NumberOfBits ArrayLength Type Description
dac 16 uint Designated Area Code
fid 4 uint Functional Identifier
efid 12 uint extended functional identifier
stationid 6 7 aisstr6 Character identifier of the station. Usually a number.
waterlevel 16 sdecimal Water level in centimeters
sigma 32 float Standard deviation of 1 second samples used to compute the water level height
link_down 1 bool Unable to communicate with the tide system. All data invalid

Posted by Kurt | Permalink

09.28.2006 07:52

Portsmouth 1.2 Million for port security



NOTE: nano blogger does not like '$' in the title

seacoast online article
Port gets $1.2M to make water and bridges safer


By Adam Leech aleech@seacoastonline.com

PORTSMOUTH -- A $1.2 million homeland security grant will provide the Port of New Hampshire with sonar equipment that will allow for better surveillance of the port, both above and below the water's surface.

The Pease Development Authority Division of Ports and Harbors was one of 100 ports in the country on the U.S. Coast Guard's most critical seaport list and one of 50 to receive federal grants. In all, the Department of Homeland Security awarded $168 million for port infrastructure improvements.

The money will go toward permanent mounted sonar units that will enable port security to see the entire port, the river and bridges, according to Dick Green, executive director of Pease Development Authority. A portable sonar unit will also be purchased and placed on a small boat to enable port security to detect suspicious items underwater.

Posted by Kurt | Permalink

09.28.2006 07:36

python wsgi - web server gateway interface

wsgi on xml.com
Web Server Gateway Interface Part I: Getting Started


The recent Python 2.5 release features the addition of the Web Server Gateway Interface Utilities and Reference Implementation package (wsgiref) to Python's standard library.

In this two-part article, we will look at what the Web Server Gateway Interface is, how to use it to write web applications, and how to use middleware components to quickly add powerful functionality. Before diving into these topics, we will also take a brief look at why the specification was created in the first place.

Posted by Kurt | Permalink

09.22.2006 13:59

wxGlade for python GUIs

I think I am still stuck in the dark ages with the old SGI xforms from 1994/5. That was totally trivial to use, but not overly flexible. I gave wxGlade a try to day and it was not the most fun. The app crashed quite a few times and there is not the ability to just draw the widgets in place. Yes, it is much more powerful that xforms, but I was hoping to bang out a quick app. It looks like there are quite a few bugs. Things did not render right and were very confusing. I think I am going back to the command line generator. But at least Roland gave me enough of a tutorial that I can get going on things now if I need to come back to writing the little GUI that I want.

Posted by Kurt | Permalink

09.22.2006 08:29

python 2.5 packages - setuptools and lxml

It has begun... the great switch to python 2.5 for fink. This morning, I got setuptools and lxml out for python 2.5. I have only done trivial testing, but things seem to be ok. I am still not up for making python 2.5 be my default python.

Posted by Kurt | Permalink

09.21.2006 13:13

python 2.5 in fink

Woo hoo! Python 2.5 is on my mac via fink.
# python2.5
Python 2.5 (r25:51908, Sep 21 2006, 13:08:01) 
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print "yes" if True else "no"
yes
>>> print "yes" if False else "no"
no
>>>
It also seems that python 2.5 is much faster, but this probably has to do with me having absolutely no additional packages installed.
# time python2.5 -c "print 'hello'"
hello


real 0m0.081s user 0m0.012s sys 0m0.067s

# time python2.4 -c "print 'hello'" hello

real 0m0.211s user 0m0.012s sys 0m0.104s

Posted by Kurt | Permalink

09.20.2006 11:19

Dynamic streaming music - pandora.com

This is one of the coolest things that has come my way for music. I still do not buy music from iTunes, but this morning I discovered pandora.com. I picked an artist (in this case Depeche Mode) and pandora started playing similiar music. Surprisingly, it did a GREAT job. Then I tried some obscure industrial. That worked too. Now I am trying some punk using AFI and I am definitely enjoying the playlist. As you go, you rate the songs with a thumbs up/thumbs down. What a great way to discover new music!

Love it!

Posted by Kurt | Permalink

09.19.2006 06:20

GIS and Time

Time for Time in GIS [slashgeo]
Christian Spanring links to a FOSS4G2006 open document presentation
named It's About Time for Time. From the abstract: ""The weakness of
current cartography is its poor representation of time. The surface of
the earth is treated as a static thing." (Anselm Hook) [...] There are
numerous experiments, but little solid support in tools or data
structures for representing the 4th dimension (when we're still
getting used to the 3rd dimension in GIS)." The time capabilities of
GeoRSS and Google Earth are mentioned. Previous poll on time.

Posted by Kurt | Permalink

09.18.2006 10:18

braces in python

This should put a smile on the face of any python programmer:
In [1]: import __future__


In [2]: from __future__ import braces

Posted by Kurt | Permalink

09.12.2006 07:59

Then end of SVG?

Wherefore art thou, SVG? by Kurt Cagle
Adobe this week made an announcement that was, while not unexpected,
yet another blow - they were choosing to stop supporting the Adobe SVG
Viewer in any fashion, to make it unable for download by the end of
the year and to effectively dismantle the last vestiges of SVG outside
of the fairly secondary roles that that standard plays in Adobe
products in favor of their own FLEX language, acquired from Macromedia
during the merger last year.


Meanwhile, work has effectively stopped on the Mozilla Firefox SVG implementation, at least until after the release of Firefox 2.0, and while it is certainly hoped that the program will be continued the rumors at this point are somewhat grim, with the very real possibility that SVG is considered to be disliked politically by certain factions within the organization in favor of the WHATWG Canvas specification.

Posted by Kurt | Permalink

09.08.2006 08:27

Fledermaus 6.3

I just downloaded and installed Fledermaus 6.3. Seems to start up fine on my Mac 4xG5. I have yet to dig into the features. Hopefully this will solve some of the GMT grid reading trouble that I had with 6.2.

Posted by Kurt | Permalink

09.02.2006 10:41

visible shipwrecks in google earth

The title says it all. Ship wrecks as seen in google earth: http://www.gearthblog.com/blog/archives/2006/09/shipwrecks_arou.html

Posted by Kurt | Permalink

09.02.2006 10:22

gengetopt 2.17 fails for fink

Here is an error that I am really not sure about. Why is this not working?
Unpacking replacement gengetopt ...
Setting up gengetopt (2.17-1) ...


No `START-INFO-DIR-ENTRY' and no `This file documents'. install-info(/sw/share/info/gengetopt.info): unable to determine description for `dir' entry - giving up /sw/bin/dpkg: error processing gengetopt (--install): subprocess post-installation script returned error exit status 1 Errors were encountered while processing: gengetopt ### execution of /sw/bin/dpkg-lockwait failed, exit code 1 Failed: can't install package gengetopt-2.17-1
I guess I get to work on this now since it removed my working 2.15 gengetopt.

Posted by Kurt | Permalink

09.01.2006 11:55

geoscience cyberinfrastructure videos

http://www.geongrid.org/CSIG06/program_info.html

This site has videos of the workshop. I have yet to watch one, so I don't know how useful this info is. The quality of the video is not too bad. Just wish I knew how to download the file so it doesn't have to be streaming.

Posted by Kurt | Permalink