[cig-commits] r4224 - in cs/framework/trunk/cig: seismo web
web/seismo web/seismo/events web/seismo/events/templates
web/seismo/events/templates/events web/seismo/stations
web/seismo/stations/templates web/seismo/stations/templates/stations
leif at geodynamics.org
leif at geodynamics.org
Thu Aug 3 19:20:14 PDT 2006
Author: leif
Date: 2006-08-03 19:20:14 -0700 (Thu, 03 Aug 2006)
New Revision: 4224
Added:
cs/framework/trunk/cig/seismo/events.py
cs/framework/trunk/cig/web/seismo/
cs/framework/trunk/cig/web/seismo/__init__.py
cs/framework/trunk/cig/web/seismo/events/
cs/framework/trunk/cig/web/seismo/events/__init__.py
cs/framework/trunk/cig/web/seismo/events/models.py
cs/framework/trunk/cig/web/seismo/events/templates/
cs/framework/trunk/cig/web/seismo/events/templates/events/
cs/framework/trunk/cig/web/seismo/events/templates/events/event_form.html
cs/framework/trunk/cig/web/seismo/events/templates/events/event_list.html
cs/framework/trunk/cig/web/seismo/events/templates/events/event_search.html
cs/framework/trunk/cig/web/seismo/events/templates/events/event_search_results.html
cs/framework/trunk/cig/web/seismo/events/urls.py
cs/framework/trunk/cig/web/seismo/events/views.py
cs/framework/trunk/cig/web/seismo/stations/
cs/framework/trunk/cig/web/seismo/stations/__init__.py
cs/framework/trunk/cig/web/seismo/stations/models.py
cs/framework/trunk/cig/web/seismo/stations/templates/
cs/framework/trunk/cig/web/seismo/stations/templates/stations/
cs/framework/trunk/cig/web/seismo/stations/templates/stations/station_search.html
cs/framework/trunk/cig/web/seismo/stations/urls.py
cs/framework/trunk/cig/web/seismo/stations/views.py
Log:
Added the Django mini-application 'events', for selecting
CMTSOLUTION data from the Harvard CMT Catalog. Also added
the skeleton for the mini-app 'stations', which will allow
users to select seismo stations. These two mini-apps are,
of course, used as components in building the SPECFEM3D
web portal (but they are generic enough for any portal).
Added: cs/framework/trunk/cig/seismo/events.py
===================================================================
--- cs/framework/trunk/cig/seismo/events.py 2006-08-03 23:01:10 UTC (rev 4223)
+++ cs/framework/trunk/cig/seismo/events.py 2006-08-04 02:20:14 UTC (rev 4224)
@@ -0,0 +1,157 @@
+#!/usr/bin/env python
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# cig.seismo
+#
+# Copyright (c) 2006, Computational Infrastructure for Geodynamics
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+#
+# * Neither the name of the Computational Infrastructure for
+# Geodynamics nor the names of its contributors may be used to
+# endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+
+class CMTSolution(object):
+
+ def __init__(self):
+
+ self.dataSource = ''
+ self.year = 0000
+ self.month = 00
+ self.day = 00
+ self.hour = 00
+ self.minute = 00
+ self._second = 00.0
+ self.sourceLatitude = 0.0
+ self.sourceLongitude = 0.0
+ self.sourceDepth = 0.0
+ self.sourceMB = 0.0
+ self.sourceMs = 0.0
+ self.regionName = ""
+
+ self.eventName = ''
+ self.timeShift = 0.0
+ self.halfDuration = 0.0
+ self.latitude = 0.0
+ self.longitude = 0.0
+ self.depth = 0.0
+ self.Mrr = 0.0
+ self.Mtt = 0.0
+ self.Mpp = 0.0
+ self.Mrt = 0.0
+ self.Mrp = 0.0
+ self.Mtp = 0.0
+
+
+ def parse(cls, data):
+ cmtList = []
+ cmtSolution = None
+ for line in data.splitlines():
+ tokens = line.split(':')
+ if len(tokens) == 1:
+ if tokens[0]:
+ cmtSolution = CMTSolution()
+ tokens = tokens[0].split()
+ cmtSolution.dataSource = tokens[0]
+ cmtSolution.year = int(tokens[1])
+ cmtSolution.month = int(tokens[2])
+ cmtSolution.day = int(tokens[3])
+ cmtSolution.hour = int(tokens[4])
+ cmtSolution.minute = int(tokens[5])
+ cmtSolution._second = float(tokens[6])
+ cmtSolution.sourceLatitude = float(tokens[7])
+ cmtSolution.sourceLongitude = float(tokens[8])
+ cmtSolution.sourceDepth = float(tokens[9])
+ cmtSolution.sourceMB = float(tokens[10])
+ cmtSolution.sourceMs = float(tokens[11])
+ cmtSolution.regionName = ' '.join(tokens[12:])
+ elif len(tokens) == 2:
+ attrName = tokens[0]
+ s = attrName.split()
+ if len(s) > 1:
+ attrName = s[0]
+ for n in s[1:]:
+ attrName += n.capitalize()
+ attrValue = tokens[1]
+ if attrName == 'eventName':
+ attrValue = attrValue.strip()
+ else:
+ attrValue = float(attrValue)
+ setattr(cmtSolution, attrName, attrValue)
+ if attrName == 'Mtp':
+ cmtList.append(cmtSolution)
+ cmtSolution = None
+ return cmtList
+ parse = classmethod(parse)
+
+ def _getMrrStr2f(self): return "%.2f" % (self.Mrr * 1.0e-26)
+ def _getMttStr2f(self): return "%.2f" % (self.Mtt * 1.0e-26)
+ def _getMppStr2f(self): return "%.2f" % (self.Mpp * 1.0e-26)
+ def _getMrtStr2f(self): return "%.2f" % (self.Mrt * 1.0e-26)
+ def _getMrpStr2f(self): return "%.2f" % (self.Mrp * 1.0e-26)
+ def _getMtpStr2f(self): return "%.2f" % (self.Mtp * 1.0e-26)
+
+ def _getSecond(self): return int(self._second)
+ def _getSecondStr(self): return "%02d" % self.second
+ def _getMicrosecond(self): return int((self._second - float(int(self._second))) * 1000000)
+
+ mrr = property(_getMrrStr2f)
+ mtt = property(_getMttStr2f)
+ mpp = property(_getMppStr2f)
+ mrt = property(_getMrtStr2f)
+ mrp = property(_getMrpStr2f)
+ mtp = property(_getMtpStr2f)
+
+ second = property(_getSecond)
+ secondStr = property(_getSecondStr)
+ microsecond = property(_getMicrosecond)
+
+ def __str__(self):
+ return """%(dataSource)s %(year)d %(month)2d %(day)2d %(hour)2d %(minute)2d %(_second)5.2f %(sourceLatitude)8.4f %(sourceLongitude)9.4f %(sourceDepth)5.1f %(sourceMB)3.1f %(sourceMs)3.1f %(regionName)s
+event name: %(eventName)11s
+time shift: %(timeShift)11.4f
+half duration: %(halfDuration)8.4f
+latitude: %(latitude)13.4f
+longitude: %(longitude)12.4f
+depth: %(depth)16.4f
+Mrr: %(Mrr)18e
+Mtt: %(Mtt)18e
+Mpp: %(Mpp)18e
+Mrt: %(Mrt)18e
+Mrp: %(Mrp)18e
+Mtp: %(Mtp)18e
+""" % self.__dict__
+
+
+# end of file
Added: cs/framework/trunk/cig/web/seismo/__init__.py
===================================================================
Added: cs/framework/trunk/cig/web/seismo/events/__init__.py
===================================================================
Added: cs/framework/trunk/cig/web/seismo/events/models.py
===================================================================
--- cs/framework/trunk/cig/web/seismo/events/models.py 2006-08-03 23:01:10 UTC (rev 4223)
+++ cs/framework/trunk/cig/web/seismo/events/models.py 2006-08-04 02:20:14 UTC (rev 4224)
@@ -0,0 +1,87 @@
+#!/usr/bin/env python
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# cig.web.seismo.events
+#
+# Copyright (c) 2006, Computational Infrastructure for Geodynamics
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+#
+# * Neither the name of the Computational Infrastructure for
+# Geodynamics nor the names of its contributors may be used to
+# endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+
+from django.db import models
+
+
+class Region(models.Model):
+ name = models.CharField(maxlength=100, primary_key=True)
+ def __str__(self): return self.name
+
+
+class DataSource(models.Model):
+ name = models.CharField(maxlength=100, primary_key=True)
+ def __str__(self): return self.name
+
+
+class Event(models.Model):
+
+ dataSource = models.ForeignKey(DataSource)
+
+ when = models.DateTimeField()
+ microsecond = models.IntegerField()
+
+ sourceLatitude = models.FloatField(max_digits=19, decimal_places=10)
+ sourceLongitude = models.FloatField(max_digits=19, decimal_places=10)
+ sourceDepth = models.FloatField(max_digits=19, decimal_places=10)
+ sourceMB = models.FloatField(max_digits=19, decimal_places=10)
+ sourceMs = models.FloatField(max_digits=19, decimal_places=10)
+ region = models.ForeignKey(Region)
+
+ eventName = models.CharField(maxlength=100)
+ timeShift = models.FloatField(max_digits=19, decimal_places=10)
+ halfDuration = models.FloatField(max_digits=19, decimal_places=10)
+ latitude = models.FloatField(max_digits=19, decimal_places=10)
+ longitude = models.FloatField(max_digits=19, decimal_places=10)
+ depth = models.FloatField(max_digits=19, decimal_places=10)
+ Mrr = models.FloatField(max_digits=19, decimal_places=10)
+ Mtt = models.FloatField(max_digits=19, decimal_places=10)
+ Mpp = models.FloatField(max_digits=19, decimal_places=10)
+ Mrt = models.FloatField(max_digits=19, decimal_places=10)
+ Mrp = models.FloatField(max_digits=19, decimal_places=10)
+ Mtp = models.FloatField(max_digits=19, decimal_places=10)
+
+ def __str__(self): return self.eventName
+
+# end of file
Added: cs/framework/trunk/cig/web/seismo/events/templates/events/event_form.html
===================================================================
--- cs/framework/trunk/cig/web/seismo/events/templates/events/event_form.html 2006-08-03 23:01:10 UTC (rev 4223)
+++ cs/framework/trunk/cig/web/seismo/events/templates/events/event_form.html 2006-08-04 02:20:14 UTC (rev 4224)
@@ -0,0 +1,150 @@
+
+{% extends "Specfem3DGlobe/base.html" %}
+
+{% block content %}
+
+<h1>Event</h1>
+
+{% if form.has_errors %}
+<p><b class=error>Please correct the following error{{ form.error_dict|pluralize }}:</b>
+{% endif %}
+
+<form method="post" action=".">
+ <table border="0">
+
+ <tr>
+ <td align="right" valign="top"><label for="id_dataSource">data source:</label></td>
+ <td valign="top">{{ form.dataSource }}</td>
+ <td valign="top">{% if form.dataSource.errors %}<span class=error>{{ form.dataSource.errors|join:", " }}</span>{% endif %}</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><label for="id_when_date">when_date:</label></td>
+ <td valign="top">{{ form.when_date }}</td>
+ <td valign="top">{% if form.when_date.errors %}<span class=error>{{ form.when_date.errors|join:", " }}</span>{% endif %}</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><label for="id_when_time">when_time:</label></td>
+ <td valign="top">{{ form.when_time }}</td>
+ <td valign="top">{% if form.when_time.errors %}<span class=error>{{ form.when_time.errors|join:", " }}</span>{% endif %}</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><label for="id_microsecond">microsecond:</label></td>
+ <td valign="top">{{ form.microsecond }}</td>
+ <td valign="top">{% if form.microsecond.errors %}<span class=error>{{ form.microsecond.errors|join:", " }}</span>{% endif %}</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><label for="id_sourceLatitude">sourceLatitude:</label></td>
+ <td valign="top">{{ form.sourceLatitude }}</td>
+ <td valign="top">{% if form.sourceLatitude.errors %}<span class=error>{{ form.sourceLatitude.errors|join:", " }}</span>{% endif %}</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><label for="id_sourceLongitude">sourceLongitude:</label></td>
+ <td valign="top">{{ form.sourceLongitude }}</td>
+ <td valign="top">{% if form.sourceLongitude.errors %}<span class=error>{{ form.sourceLongitude.errors|join:", " }}</span>{% endif %}</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><label for="id_sourceDepth">sourceDepth:</label></td>
+ <td valign="top">{{ form.sourceDepth }}</td>
+ <td valign="top">{% if form.sourceDepth.errors %}<span class=error>{{ form.sourceDepth.errors|join:", " }}</span>{% endif %}</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><label for="id_sourceMB">sourceMB:</label></td>
+ <td valign="top">{{ form.sourceMB }}</td>
+ <td valign="top">{% if form.sourceMB.errors %}<span class=error>{{ form.sourceMB.errors|join:", " }}</span>{% endif %}</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><label for="id_sourceMs">sourceMs:</label></td>
+ <td valign="top">{{ form.sourceMs }}</td>
+ <td valign="top">{% if form.sourceMs.errors %}<span class=error>{{ form.sourceMs.errors|join:", " }}</span>{% endif %}</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><label for="id_region">region:</label></td>
+ <td valign="top">{{ form.region }}</td>
+ <td valign="top">{% if form.region.errors %}<span class=error>{{ form.region.errors|join:", " }}</span>{% endif %}</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><label for="id_eventName">event name:</label></td>
+ <td valign="top">{{ form.eventName }}</td>
+ <td valign="top">{% if form.eventName.errors %}<span class=error>{{ form.eventName.errors|join:", " }}</span>{% endif %}</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><label for="id_timeShift">time shift:</label></td>
+ <td valign="top">{{ form.timeShift }}</td>
+ <td valign="top">{% if form.timeShift.errors %}<span class=error>{{ form.timeShift.errors|join:", " }}</span>{% endif %}</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><label for="id_halfDuration">half duration:</label></td>
+ <td valign="top">{{ form.halfDuration }}</td>
+ <td valign="top">{% if form.halfDuration.errors %}<span class=error>{{ form.halfDuration.errors|join:", " }}</span>{% endif %}</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><label for="id_latitude">latitude:</label></td>
+ <td valign="top">{{ form.latitude }}</td>
+ <td valign="top">{% if form.latitude.errors %}<span class=error>{{ form.latitude.errors|join:", " }}</span>{% endif %}</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><label for="id_longitude">longitude:</label></td>
+ <td valign="top">{{ form.longitude }}</td>
+ <td valign="top">{% if form.longitude.errors %}<span class=error>{{ form.longitude.errors|join:", " }}</span>{% endif %}</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><label for="id_depth">depth:</label></td>
+ <td valign="top">{{ form.depth }}</td>
+ <td valign="top">{% if form.depth.errors %}<span class=error>{{ form.depth.errors|join:", " }}</span>{% endif %}</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><label for="id_Mrr">Mrr:</label></td>
+ <td valign="top">{{ form.Mrr }}</td>
+ <td valign="top">{% if form.Mrr.errors %}<span class=error>{{ form.Mrr.errors|join:", " }}</span>{% endif %}</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><label for="id_Mtt">Mtt:</label></td>
+ <td valign="top">{{ form.Mtt }}</td>
+ <td valign="top">{% if form.Mtt.errors %}<span class=error>{{ form.Mtt.errors|join:", " }}</span>{% endif %}</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><label for="id_Mpp">Mpp:</label></td>
+ <td valign="top">{{ form.Mpp }}</td>
+ <td valign="top">{% if form.Mpp.errors %}<span class=error>{{ form.Mpp.errors|join:", " }}</span>{% endif %}</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><label for="id_Mrt">Mrt:</label></td>
+ <td valign="top">{{ form.Mrt }}</td>
+ <td valign="top">{% if form.Mrt.errors %}<span class=error>{{ form.Mrt.errors|join:", " }}</span>{% endif %}</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><label for="id_Mrp">Mrp:</label></td>
+ <td valign="top">{{ form.Mrp }}</td>
+ <td valign="top">{% if form.Mrp.errors %}<span class=error>{{ form.Mrp.errors|join:", " }}</span>{% endif %}</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><label for="id_Mtp">Mtp:</label></td>
+ <td valign="top">{{ form.Mtp }}</td>
+ <td valign="top">{% if form.Mtp.errors %}<span class=error>{{ form.Mtp.errors|join:", " }}</span>{% endif %}</td>
+ </tr>
+
+ </table>
+ <p><input type="submit" value="Save" />
+</form>
+{% endblock %}
Added: cs/framework/trunk/cig/web/seismo/events/templates/events/event_list.html
===================================================================
--- cs/framework/trunk/cig/web/seismo/events/templates/events/event_list.html 2006-08-03 23:01:10 UTC (rev 4223)
+++ cs/framework/trunk/cig/web/seismo/events/templates/events/event_list.html 2006-08-04 02:20:14 UTC (rev 4224)
@@ -0,0 +1,43 @@
+
+{% extends "Specfem3DGlobe/base.html" %}
+
+{% block content %}
+
+<h1>Events</h1>
+
+{% if object_list %}
+ <table border="0">
+ <tr>
+ <th align="left" valign="top"></th>
+ <th align="left" valign="top"></th>
+ <th align="left" valign="top">data source</th>
+ <th align="left" valign="top">when</th>
+ <th align="left" valign="top">region</th>
+ <th align="left" valign="top">latitude</th>
+ <th align="left" valign="top">longitude</th>
+ <th align="left" valign="top">depth</th>
+
+ </tr>
+
+ {% for object in object_list %}
+ <tr>
+ <td valign="top"><a href="{{ object.id }}/">Edit</a> <a href="{{ object.id }}/delete/">Delete</a></td>
+ <td valign="top"><img width=49 height=49 src="http://www.seismology.harvard.edu/cgi-bin/webCMTgif/form?mrr={{object.Mrr}}&mtt={{object.Mtt}}&mpp={{object.Mpp}}&mrt={{object.Mrt}}&mrp={{object.Mrp}}&mtp={{object.Mtp}}"></td>
+ <td valign="top">{{ object.dataSource.name }}</td>
+ <td valign="top">{{ object.when }}</td>
+ <td valign="top">{{ object.region.name }}</td>
+ <td valign="top">{{ object.latitude }}</td>
+ <td valign="top">{{ object.longitude }}</td>
+ <td valign="top">{{ object.depth }}</td>
+ </tr>
+ {% endfor %}
+
+ </table>
+{% else %}
+ <p>You have no events.</p>
+{% endif %}
+
+<p><a href="add/">Add event</a>
+<p><a href="search/">Search for an event</a>
+
+{% endblock %}
Added: cs/framework/trunk/cig/web/seismo/events/templates/events/event_search.html
===================================================================
--- cs/framework/trunk/cig/web/seismo/events/templates/events/event_search.html 2006-08-03 23:01:10 UTC (rev 4223)
+++ cs/framework/trunk/cig/web/seismo/events/templates/events/event_search.html 2006-08-04 02:20:14 UTC (rev 4224)
@@ -0,0 +1,110 @@
+
+{% extends "events/base.html" %}
+
+{% block content %}
+
+<h1>Event Search</h1>
+
+{% if form.has_errors %}
+<p><b class=error>Please correct the following error{{ form.error_dict|pluralize }}:</b>
+{% endif %}
+
+<p>Powered by<br>
+<a href="http://www.seismology.harvard.edu"><img src="http://www.seismology.harvard.edu/top_sm.gif" height=54 width=302 alt="H A R V A R D S E I S M O L O G Y" border=0></a>
+
+ <FORM ACTION="." METHOD="POST">
+
+ <table border=0 width="100%">
+ <tr>
+ <td>Enter parameters for CMT catalog search. All constraints are 'AND' logic.</td>
+ <td align="right"><INPUT TYPE="reset" VALUE="Reset"></td>
+ </tr>
+ </table>
+
+ <b>Date constraints:</b> catalog starts in 1976 and goes through present<br>
+ <small>There are several methods to choose date ranges--use the radio buttons to select which method you want to use</small>
+ <table border=0 cellpadding=4>
+ <tr>
+ <th width="40%" align=center>Starting Date:</th>
+ <th width="40%" align=center>Ending Date:</th>
+ </tr>
+
+ <tr>
+ <td ><i>
+ <input type=radio checked name="itype" value="ymd"></input>
+ Year: <input type="text" name="yr" value="1976" size="4" maxlength="4"></input>
+ Month: <input type="text" name="mo" value="1" size="2" maxlength="2"></input>
+ Day: <input type="text" name="day" value="1" size="2" maxlength="2"></input></i>
+ </td>
+
+ <td>
+ <input type=radio name="otype" value="ymd"></input>
+ <i>Year: <input type="text" name="oyr" value="1976" size="4" maxlength="4"></input>
+ Month: <input type="text" name="omo" value="1" size="2" maxlength="2"></input>
+ Day: <input type="text" name="oday" value="1" size="2" maxlength="2"></input></i>
+ </td>
+
+ </tr>
+ <td></td>
+ <tr>
+ <td>
+ <input type=radio name="itype" value="jul"></input>
+ <i>Year:<input type="text" name="jyr" value="1976" size="4" maxlength="4"></input>
+ Julian Day: <input type="text" name="jday" value="1" size="3" maxlength="4"></input></i>
+ </td>
+
+ <td >
+ <input type=radio name="otype" value="jul"></input>
+ <i>Year:<input type="text" name="ojyr" value="1976" size="4" maxlength="4"></input>
+ Julian Day: <input type="text" name="ojday" value="1" size="3" maxlength="4"></input></i>
+ </td>
+ </tr>
+ <tr><td></td>
+
+ <td ><input type=radio checked name="otype" value="nd"></input>
+ <i>Number of days:</i> <input type="text" name="nday" value="1" size="5" maxlength="6"></input> <small>Including starting day</small>
+ </td>
+ </tr>
+ </table>
+ <br>
+
+ <p>
+ <b>Magnitude constraints:</b> catalog includes moderate to large earthquakes only<br>
+ <small>
+ (see <a href="CMTsearch.html#MWnote">note on calculation of magnitudes</a>)
+ </small><br>
+ <i>Moment magnitude:</i> <input name="lmw" value="0" size="4" maxlength="4"> <= Mw <= <input name="umw" value="10" size="4" maxlength="4">
+ <br>
+
+ <i>Surface wave magnitude:</i> <input name="lms" value="0" size="4" maxlength="4"> <= Ms <= <input name="ums" value="10" size="4" maxlength="4">
+ <br>
+ <i>Body wave magnitude:</i> <input name="lmb" value="0" size="4" maxlength="4"><= mb <= <input name="umb" value="10" size="4" maxlength="4">
+ </p>
+ <p>
+
+ <b>Location constraints:</b><br>
+ <i>Latitude: (degrees) </i> from <input name="llat" value="-90" size="6" maxlength="6"> to <input name="ulat" value="90" size="6" maxlength="6"> <small>Must be between -90 and 90</small><br>
+ <i>Longitude: (degrees) </i> from <input name="llon" value="-180" size="7" maxlength="7"> to <input name="ulon" value="180" size="7" maxlength="7"> <small>Must be between -180 and 180</small><br>
+
+ <i>Depth: (kilometers) </i> from <input name="lhd" value="0" size="7" maxlength="7"> to <input name="uhd" value="1000" size="7" maxlength="7"> <small></small>
+ </p>
+ <p>
+ <b>Source time and mechanism constraints:</b><br>
+ <i>Centroid time shift: (seconds)</i> from <input name="lts" value="-9999" size="6" maxlength="6"> to <input name="uts" value="9999" size="6" maxlength="6"><br>
+ <i>Tension axis plunge: (degrees)</i> from <input name="lpe1" value="0" size="2" maxlength="2"> to <input name="upe1" value="90" size="2" maxlength="2"><br>
+ <i>Null axis plunge: (degrees)</i> from <input name="lpe2" value="0" size="2" maxlength="2"> to <input name="upe2" value="90" size="2" maxlength="2"><br>
+ <small>Use tension and null axis plunge to search by
+ mechanism. For example, thrust faults have large plunge
+ (>45) of tension axis, strike-slip faults have large
+ plunge of null axis, and normal faults have small (<45)
+ for both tension and null axes.</small>
+
+ </p>
+
+ <p>
+ <input type="hidden" name="list" value="4">
+
+ <INPUT TYPE="submit" VALUE="Search">
+ </p>
+
+{% endblock %}
Added: cs/framework/trunk/cig/web/seismo/events/templates/events/event_search_results.html
===================================================================
--- cs/framework/trunk/cig/web/seismo/events/templates/events/event_search_results.html 2006-08-03 23:01:10 UTC (rev 4223)
+++ cs/framework/trunk/cig/web/seismo/events/templates/events/event_search_results.html 2006-08-04 02:20:14 UTC (rev 4224)
@@ -0,0 +1,81 @@
+
+{% extends "events/base.html" %}
+
+{% block content %}
+
+<h1>Event Search Results</h1>
+
+{% if event_list %}
+ <table border="0">
+ <tr>
+ <th align="left" valign="top"></th>
+ <th align="left" valign="top"></th>
+ <th align="left" valign="top">event name</th>
+ <th align="left" valign="top">time shift</th>
+ <th align="left" valign="top">half duration</th>
+ <th align="left" valign="top">latitude</th>
+ <th align="left" valign="top">longitude</th>
+ <th align="left" valign="top">depth</th>
+ <th align="left" valign="top">Mrr</th>
+ <th align="left" valign="top">Mtt</th>
+ <th align="left" valign="top">Mpp</th>
+ <th align="left" valign="top">Mrt</th>
+ <th align="left" valign="top">Mrp</th>
+ <th align="left" valign="top">Mtp</th>
+ </tr>
+
+ {% for event in event_list %}
+ <tr>
+ <td valign="top">
+ <!-- an inline events/add form, already filled-out -->
+ <form method="post" action="../add/">
+ <input type="hidden" name="dataSource" value="{{ event.dataSource }}"/>
+ <input type="hidden" name="when_date" value="{{ event.year }}-{{ event.month }}-{{ event.day }}"/>
+ <input type="hidden" name="when_time" value="{{ event.hour }}:{{ event.minute }}:{{ event.secondStr }}"/>
+ <input type="hidden" name="microsecond" value="{{ event.microsecond }}"/>
+ <input type="hidden" name="sourceLatitude" value="{{ event.sourceLatitude }}"/>
+ <input type="hidden" name="sourceLongitude" value="{{ event.sourceLongitude }}"/>
+ <input type="hidden" name="sourceDepth" value="{{ event.sourceDepth }}"/>
+ <input type="hidden" name="sourceMB" value="{{ event.sourceMB }}"/>
+ <input type="hidden" name="sourceMs" value="{{ event.sourceMs }}"/>
+ <input type="hidden" name="region" value="{{ event.regionName }}"/>
+ <input type="hidden" name="eventName" value="{{ event.eventName }}"/>
+ <input type="hidden" name="timeShift" value="{{ event.timeShift }}"/>
+ <input type="hidden" name="halfDuration" value="{{ event.halfDuration }}"/>
+ <input type="hidden" name="latitude" value="{{ event.latitude }}"/>
+ <input type="hidden" name="longitude" value="{{ event.longitude }}"/>
+ <input type="hidden" name="depth" value="{{ event.depth }}"/>
+ <input type="hidden" name="Mrr" value="{{ event.Mrr }}"/>
+ <input type="hidden" name="Mtt" value="{{ event.Mtt }}"/>
+ <input type="hidden" name="Mpp" value="{{ event.Mpp }}"/>
+ <input type="hidden" name="Mrt" value="{{ event.Mrt }}"/>
+ <input type="hidden" name="Mrp" value="{{ event.Mrp }}"/>
+ <input type="hidden" name="Mtp" value="{{ event.Mtp }}"/>
+ <input type="submit" value="Add" />
+ </form>
+ </td>
+ <td valign="top"><img width=49 height=49 src="http://www.seismology.harvard.edu/cgi-bin/webCMTgif/form?mrr={{event.mrr}}&mtt={{event.mtt}}&mpp={{event.mpp}}&mrt={{event.mrt}}&mrp={{event.mrp}}&mtp={{event.mtp}}"></td>
+ <td valign="top">{{ event.eventName }}</td>
+ <td valign="top">{{ event.timeShift }}</td>
+ <td valign="top">{{ event.halfDuration }}</td>
+ <td valign="top">{{ event.latitude }}</td>
+ <td valign="top">{{ event.longitude }}</td>
+ <td valign="top">{{ event.depth }}</td>
+ <td valign="top">{{ event.Mrr }}</td>
+ <td valign="top">{{ event.Mtt }}</td>
+ <td valign="top">{{ event.Mpp }}</td>
+ <td valign="top">{{ event.Mrt }}</td>
+ <td valign="top">{{ event.Mrp }}</td>
+ <td valign="top">{{ event.Mtp }}</td>
+ </tr>
+ {% endfor %}
+
+ </table>
+{% else %}
+ <p>No events found.</p>
+{% endif %}
+
+<p>Powered by<br>
+<a href="http://www.seismology.harvard.edu"><img src="http://www.seismology.harvard.edu/top_sm.gif" height=54 width=302 alt="H A R V A R D S E I S M O L O G Y" border=0></a>
+
+{% endblock %}
Added: cs/framework/trunk/cig/web/seismo/events/urls.py
===================================================================
--- cs/framework/trunk/cig/web/seismo/events/urls.py 2006-08-03 23:01:10 UTC (rev 4223)
+++ cs/framework/trunk/cig/web/seismo/events/urls.py 2006-08-04 02:20:14 UTC (rev 4224)
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# cig.web.seismo.events
+#
+# Copyright (c) 2006, Computational Infrastructure for Geodynamics
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+#
+# * Neither the name of the Computational Infrastructure for
+# Geodynamics nor the names of its contributors may be used to
+# endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+
+from django.conf.urls.defaults import *
+from models import Event
+
+
+event_list_detail_args = {
+ 'queryset': Event.objects.all(),
+ 'allow_empty': True,
+}
+
+event_create_update_args = {
+ 'model': Event,
+ 'post_save_redirect': '/specfem3dglobe/events/',
+ }
+
+event_delete_args = {
+ 'model': Event,
+ 'post_delete_redirect': '/specfem3dglobe/events/',
+ }
+
+
+urlpatterns = patterns('',
+ (r'^$', 'django.views.generic.list_detail.object_list', event_list_detail_args),
+ (r'^search/$', 'cig.web.seismo.events.views.search'),
+ (r'^add/$', 'django.views.generic.create_update.create_object', event_create_update_args),
+ (r'^(?P<object_id>\d+)/$', 'django.views.generic.create_update.update_object', event_create_update_args),
+ (r'^(?P<object_id>\d+)/delete/$', 'django.views.generic.create_update.delete_object', event_delete_args),
+)
+
+
+# end of file
Added: cs/framework/trunk/cig/web/seismo/events/views.py
===================================================================
--- cs/framework/trunk/cig/web/seismo/events/views.py 2006-08-03 23:01:10 UTC (rev 4223)
+++ cs/framework/trunk/cig/web/seismo/events/views.py 2006-08-04 02:20:14 UTC (rev 4224)
@@ -0,0 +1,121 @@
+#!/usr/bin/env python
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# cig.web.seismo.events
+#
+# Copyright (c) 2006, Computational Infrastructure for Geodynamics
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+#
+# * Neither the name of the Computational Infrastructure for
+# Geodynamics nor the names of its contributors may be used to
+# endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+
+from cig.seismo.events import CMTSolution
+from django.shortcuts import render_to_response
+from HTMLParser import HTMLParser
+from models import DataSource, Region
+
+
+def search(request):
+ import urllib2
+
+ if request.method == 'GET':
+ return render_to_response('events/event_search.html')
+
+ # Simply forward the search request to Harvard.
+ query = request.POST.urlencode()
+ url = "http://www.seismology.harvard.edu/cgi-bin/CMT3/form?" + query
+ src = urllib2.urlopen(url)
+
+ # Parse the results.
+ parser = HarvardCMTSearchResultsParser()
+ parser.feed(src.read())
+
+ parser.close()
+ src.close()
+
+ # Make sure secondary objects exist in the database.
+ for event in parser.cmtList:
+ # The try-get()-except shouldn't be necessary, but simply
+ # using save() causes Django to die in the database backend.
+ try:
+ ds = DataSource.objects.get(name=event.dataSource)
+ except DataSource.DoesNotExist:
+ ds = DataSource(event.dataSource)
+ ds.save()
+ try:
+ ds = Region.objects.get(name=event.regionName)
+ except:
+ r = Region(event.regionName)
+ r.save()
+
+ return render_to_response('events/event_search_results.html',
+ {'event_list': parser.cmtList })
+
+
+class HarvardCMTSearchResultsParser(HTMLParser):
+
+ def __init__(self):
+ HTMLParser.__init__(self)
+ self.state = 0
+ self.cmtList = None
+
+ def handle_starttag(self, tag, attrs):
+ if self.state == 0:
+ if tag == 'body':
+ self.state = 1
+ elif self.state == 2:
+ if tag == 'pre':
+ self.state = 3
+ return
+
+ def handle_endtag(self, tag):
+ if tag == 'body':
+ self.state = 0
+ elif self.state == 3:
+ if tag == 'pre':
+ self.state = 1
+ return
+
+ def handle_data(self, data):
+ if self.state == 1:
+ if data.find('Output in CMTSOLUTION format') != -1:
+ self.state = 2
+ elif self.state == 3:
+ self.cmtList = CMTSolution.parse(data)
+ return
+
+
+# end of file
Added: cs/framework/trunk/cig/web/seismo/stations/__init__.py
===================================================================
Added: cs/framework/trunk/cig/web/seismo/stations/models.py
===================================================================
--- cs/framework/trunk/cig/web/seismo/stations/models.py 2006-08-03 23:01:10 UTC (rev 4223)
+++ cs/framework/trunk/cig/web/seismo/stations/models.py 2006-08-04 02:20:14 UTC (rev 4224)
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# cig.seismo
+#
+# Copyright (c) 2006, Computational Infrastructure for Geodynamics
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+#
+# * Neither the name of the Computational Infrastructure for
+# Geodynamics nor the names of its contributors may be used to
+# endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+
+from django.db import models
+
+
+class StationNetwork(models.Model):
+ name = models.CharField(maxlength=100)
+
+
+class Station(models.Model):
+ name = models.CharField(maxlength=100)
+ network = models.ForeignKey(StationNetwork)
+ latitude = models.FloatField(max_digits=19, decimal_places=10)
+ longitude = models.FloatField(max_digits=19, decimal_places=10)
+ ele = models.FloatField(max_digits=19, decimal_places=10)
+ bur = models.FloatField(max_digits=19, decimal_places=10)
+
+
+# end of file
Added: cs/framework/trunk/cig/web/seismo/stations/templates/stations/station_search.html
===================================================================
--- cs/framework/trunk/cig/web/seismo/stations/templates/stations/station_search.html 2006-08-03 23:01:10 UTC (rev 4223)
+++ cs/framework/trunk/cig/web/seismo/stations/templates/stations/station_search.html 2006-08-04 02:20:14 UTC (rev 4224)
@@ -0,0 +1,12 @@
+
+{% extends "stations/base.html" %}
+
+{% block content %}
+
+<h1>Station Search</h1>
+
+{% if form.has_errors %}
+<p><b class=error>Please correct the following error{{ form.error_dict|pluralize }}:</b>
+{% endif %}
+
+{% endblock %}
Added: cs/framework/trunk/cig/web/seismo/stations/urls.py
===================================================================
--- cs/framework/trunk/cig/web/seismo/stations/urls.py 2006-08-03 23:01:10 UTC (rev 4223)
+++ cs/framework/trunk/cig/web/seismo/stations/urls.py 2006-08-04 02:20:14 UTC (rev 4224)
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# cig.seismo
+#
+# Copyright (c) 2006, Computational Infrastructure for Geodynamics
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+#
+# * Neither the name of the Computational Infrastructure for
+# Geodynamics nor the names of its contributors may be used to
+# endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+
+from django.conf.urls.defaults import *
+
+
+urlpatterns = patterns('',
+ (r'^$', 'cig.seismo.web.stations.views.index'),
+)
+
+
+# end of file
Added: cs/framework/trunk/cig/web/seismo/stations/views.py
===================================================================
--- cs/framework/trunk/cig/web/seismo/stations/views.py 2006-08-03 23:01:10 UTC (rev 4223)
+++ cs/framework/trunk/cig/web/seismo/stations/views.py 2006-08-04 02:20:14 UTC (rev 4224)
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# cig.seismo
+#
+# Copyright (c) 2006, Computational Infrastructure for Geodynamics
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+#
+# * Neither the name of the Computational Infrastructure for
+# Geodynamics nor the names of its contributors may be used to
+# endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+
+from django.shortcuts import render_to_response
+
+
+def index(request):
+ tomato = "<b>Hey</b> you guys!"
+ return render_to_response('station_search.html',
+ {'tomato': tomato})
+
+
+# end of file
More information about the cig-commits
mailing list