istSOS Package

istsoslib core library module

sosDatabase

class istsoslib.sosDatabase.Database

Connect to a database

closeConnection()

Close a database connection

dbName = None
getConnection()

Return a database connection

host = None
password = None
port = None
user = None
class istsoslib.sosDatabase.PgDB(user, password, dbName, host='localhost', port='5432', tz=None)

Bases: istsoslib.sosDatabase.Database

Connect to a PostgreSQL database

commitTransaction()

Commit current transaction

execute(sql, par=None)

Execute an sql statement

executeInTransaction(sql, par=None)

Execute an sql statement in an open session

host = None
insertMany(sql, dict)

Insert many values at once

insertManyInTransaction(sql, dict)

Insert many values at once

mogrify(sql, par=None)

Mogrify an sql statement (print the actual sql query that will be executed)

rollbackTransaction()

Rollback current transaction

select(sql, par=None)

Execute a select statement

setTimeTZ(tz)

Set the database Time Zone for this connection:

@param tz: object that define the Time Zone

Note

The input parameter can be af differents types: 1. A String that can be handled by postgresql (see Time Zone at http://www.postgresql.org/docs/current/static/sql-set.html) 2. An integer, for instance -7. The time zone 7 hours west from UTC (equivalent to PDT / -07:00). Positive values are east from UTC. 3. A datetime with timezone information

sos_version

istsoslib.renderers core library module

DSresponseRender

istsoslib.renderers.DSresponseRender.parse_and_get_ns(filename)
istsoslib.renderers.DSresponseRender.render(DS, sosConfig)

IOresponseRender

istsoslib.renderers.IOresponseRender.render(IO, sosConfig)

GOresponseRender

istsoslib.renderers.GOresponseRender.CSVformat(GO)
istsoslib.renderers.GOresponseRender.JSONformat(GO)
istsoslib.renderers.GOresponseRender.XMLformat(GO)
istsoslib.renderers.GOresponseRender.render(GO, sosConfig)

RSresponseRender

istsoslib.renderers.RSresponseRender.render(RS, sosConfig)

GFresponseRender

istsoslib.renderers.GFresponseRender.render(GF, sosConfig)

USDresponseRender

istsoslib.renderers.USDresponseRender.render(USD, sosConfig)

factory_render

istsoslib.renderers.factory_render.sosFactoryRender(response, sosConfig)

istsoslib.responders core library module

IOresponse

class istsoslib.responders.IOresponse.InsertObservationResponse(filter, pgdb)
procConstr = None

oprNames= [“urn:ogc:def:parameter:x-istsos:1.0:meteo:air:temperature” , ...] oprUoms= [“mm” , ...] oprIds= [id_opr , ...] proIds= [id_pro , ...] obsPropConstr= [{“interval”: [“-40”, “50”], “role”: “urn:ogc:def:classifiers:x-istsos:1.0:qualityIndex:check:acceptable“} , ...] procConstr= [{“max”: “100”, “role”: “urn:ogc:def:classifiers:x-istsos:1.0:qualityIndex:check:reasonable“} , ...]

GCresponse

istsoslib.responders.GCresponse.BuildEventTimeRange(pgdb, sosConfig)
istsoslib.responders.GCresponse.BuildOffEnvelope(pgdb, id, sosConfig)
istsoslib.responders.GCresponse.BuildOffFoiList(pgdb, id, sosConfig)
istsoslib.responders.GCresponse.BuildOffObsPrList(pgdb, id, sosConfig)
istsoslib.responders.GCresponse.BuildOffProcList(pgdb, id, sosConfig)
istsoslib.responders.GCresponse.BuildOffTimePeriod(pgdb, id, sosConfig)
istsoslib.responders.GCresponse.BuildOfferingList(pgdb, sosConfig)
istsoslib.responders.GCresponse.BuildSensorIdList(pgdb, sosConfig)
istsoslib.responders.GCresponse.BuildSensorList(pgdb, sosConfig)
istsoslib.responders.GCresponse.BuildfeatureOfInterestList(pgdb, sosConfig)
istsoslib.responders.GCresponse.BuildobservedPropertyList(pgdb, sosConfig)
class istsoslib.responders.GCresponse.GetCapabilitiesResponse(fil, pgdb)
class istsoslib.responders.GCresponse.ObservationOfferingList(pgdb, sosConfig)
class istsoslib.responders.GCresponse.Offering
class istsoslib.responders.GCresponse.Operation(name, get='', post='')
addParameter(name, use='optional', allowedValues=, []range=[])
class istsoslib.responders.GCresponse.OperationsMetadata(pgdb, sosConfig)
srslist = None

GetCapabilities

class istsoslib.responders.GCresponse.Parameter(name, use='optional', allowedValues=, []range=[])
class istsoslib.responders.GCresponse.ServiceIdentification(sosConfig)
class istsoslib.responders.GCresponse.ServiceProvider(sosConfig)

RSresponse

class istsoslib.responders.RSresponse.RegisterSensorResponse(filter, pgdb)

GOresponse

istsoslib.responders.GOresponse.BuildOfferingList(pgdb, sosConfig)
istsoslib.responders.GOresponse.BuildProcedureList(pgdb, offering, sosConfig)
istsoslib.responders.GOresponse.BuildfeatureOfInterestList(pgdb, offering, sosConfig)
istsoslib.responders.GOresponse.BuildobservedPropertyList(pgdb, offering, sosConfig)
class istsoslib.responders.GOresponse.Observation
baseInfo(pgdb, o, sosConfig)
setData(pgdb, o, filter)

get data according to request filters

class istsoslib.responders.GOresponse.VirtualProcess
addProcedure(name, observedProperty)

name: String observedProperty: String or Array of String

applyFunction()
calculateObservations(observation)
execute()

This method must be overridden to implement data gathering for this virtual procedure

getData(procedure=None, disableAggregation=False)

procedure: String

getSampligTime()
procedures = {}
samplingTime = (None, None)
setSampligTime()

By default This method calculate the sampling time of a virtual procedure giving the procedure name from witch the data are derived as single string or array of strings.

If derivation procedures are more than one it will return the minimum begin position and the maximum end position among all the procedures name given.

It supports also SamplingTime calculation from cascading Virtual Procedures.

class istsoslib.responders.GOresponse.VirtualProcessHQ

Bases: istsoslib.responders.GOresponse.VirtualProcess

execute()
setDischargeCurves()

method for setting h-q tranformation tables/curves

istsoslib.responders.GOresponse.applyFunction(ob, filter)
class istsoslib.responders.GOresponse.observations(filter, pgdb)
filter = None

off_list = BuildOfferingList(pgdb,filter.sosConfig) if not filter.offering in off_list:

raise sosException.SOSException(“InvalidParameterValue”,”offering”,”Parameter “offering” sent with invalid value: %s - available options for offering are %s” %(filter.offering,off_list))
class istsoslib.responders.GOresponse.offInfo(off_name, pgdb, sosConfig)

GFresponse

class istsoslib.responders.GFresponse.foi(filter, pgdb)

USDresponse

class istsoslib.responders.USDresponse.UpdateSensorDescriptionResponse(filter, pgdb)
istsoslib.responders.USDresponse.get_name_from_urn(stringa, urnName, sosConfig)

DSresponse

class istsoslib.responders.DSresponse.DescribeSensorResponse(filter, pgdb)

factory_response

istsoslib.responders.factory_response.sosFactoryResponse(sosFilter, pgdb)

istsoslib.filters core library module

GO_filter

istsoslib.filters.GO_filter.get_name_from_urn(stringa, urnName, sosConfig)
class istsoslib.filters.GO_filter.sosGOfilter(sosRequest, method, requestObject, sosConfig)

Bases: istsoslib.filters.filter.sosFilter

filter object for a GetObservations request

DS_filter

class istsoslib.filters.DS_filter.sosDSfilter(sosRequest, method, requestObject, sosConfig)

Bases: istsoslib.filters.filter.sosFilter

filter object for a DescribeSensor request

GF_filter

istsoslib.filters.GF_filter.getElemAtt(node, att)
istsoslib.filters.GF_filter.getElemTxt(node)
istsoslib.filters.GF_filter.get_name_from_urn(stringa, urnName, sosConfig)
class istsoslib.filters.GF_filter.sosGFfilter(sosRequest, method, requestObject, sosConfig)

Bases: istsoslib.filters.filter.sosFilter

filter object for a GetFeatureOfInterest request

IO_filter

istsoslib.filters.IO_filter.parse_and_get_ns(file)
class istsoslib.filters.IO_filter.sosIOfilter(sosRequest, method, requestObject, sosConfig)

Bases: istsoslib.filters.filter.sosFilter

filter object for a InsertObservation request

DataArray = None

e.g.: self.data = {

urn:ist:parameter:time:iso8601”:
{ “uom”:”sec”, “vals”:[“2009-07-31T12:00:00+02:00”,”2009-07-31T12:10:00+02:00”,”2009-07-31T12:20:00+02:00”] },
urn:ist:def:phenomenon:rainfall”:
{ “uom”:”mm”, “vals”:[0.1,0.2,0.3,0.4] }

}

USD_filter

RS_filter

istsoslib.filters.RS_filter.parse_and_get_ns(file)
class istsoslib.filters.RS_filter.sosRSfilter(sosRequest, method, requestObject, sosConfig)

Bases: istsoslib.filters.filter.sosFilter

filter object for a registerSensor request

xmlSensorDescription = None

from xml.dom.minidom import parseString txt = et.tostring(root, encoding=”UTF-8”) self.xmlSensorDescription = parseString(txt).toprettyxml()

GC_filter

class istsoslib.filters.GC_filter.sosGCfilter(sosRequest, method, requestObject, sosConfig)

Bases: istsoslib.filters.filter.sosFilter

filter object for a GetCapabalities request

filter

class istsoslib.filters.filter.sosFilter(sosRequest, method, requestObject, sosConfig)

SOS request filters, set request, service and version

factory_filters

istsoslib.filters.factory_filters.sosFactoryFilter(environ, sosConfig)

sosException

exception istsoslib.sosException.SOSException(code, locator, msg, othermsgs=[])

Bases: exceptions.ValueError

AddText(text)
ToXML()
exception = ' <Exception exceptionCode="%s">\n%s \n </Exception>'
exceptionLoc = ' <Exception locator="%s" exceptionCode="%s">\n%s \n </Exception>'
exceptionreport = '<?xml version="1.0" encoding="UTF-8" standalone="no"?><ExceptionReport xmlns="http://www.opengis.net/ows/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/ows/1.1 ../owsExceptionReport.xsd" version="1.0.0" xml:lang="en">\n%s \n</ExceptionReport>'
exceptiontext = ' <ExceptionText>\n %s\n </ExceptionText>'

sosDatabase

class istsoslib.sosDatabase.Database

Connect to a database

closeConnection()

Close a database connection

dbName = None
getConnection()

Return a database connection

host = None
password = None
port = None
user = None
class istsoslib.sosDatabase.PgDB(user, password, dbName, host='localhost', port='5432', tz=None)

Bases: istsoslib.sosDatabase.Database

Connect to a PostgreSQL database

commitTransaction()

Commit current transaction

execute(sql, par=None)

Execute an sql statement

executeInTransaction(sql, par=None)

Execute an sql statement in an open session

host = None
insertMany(sql, dict)

Insert many values at once

insertManyInTransaction(sql, dict)

Insert many values at once

mogrify(sql, par=None)

Mogrify an sql statement (print the actual sql query that will be executed)

rollbackTransaction()

Rollback current transaction

select(sql, par=None)

Execute a select statement

setTimeTZ(tz)

Set the database Time Zone for this connection:

@param tz: object that define the Time Zone

Note

The input parameter can be af differents types: 1. A String that can be handled by postgresql (see Time Zone at http://www.postgresql.org/docs/current/static/sql-set.html) 2. An integer, for instance -7. The time zone 7 hours west from UTC (equivalent to PDT / -07:00). Positive values are east from UTC. 3. A datetime with timezone information

sosUtils

istsoslib.sosUtils.CQLvalueFilter2PostgisSql(fildName, CQLfilter)

parse a CQL filter and returen an SQL filter

istsoslib.sosUtils.childElementNodes(xmlnode)
istsoslib.sosUtils.ogcCompCons2PostgisSql(ogcComparisonOperator)

parse an ogc property operator element and convert it to a PostGIS SQL WHERE clause

istsoslib.sosUtils.ogcSpatCons2PostgisSql(ogcSpatialOperator, geomField, epsgField)

parse an ogc spatial operator element and convert it to a PostGIS SQL spatial WHERE clause