NRML Specs

29 views
Skip to first unread message

Simon

unread,
Aug 25, 2011, 4:51:54 AM8/25/11
to OpenQuake Developers
I am working on the GEMECD database specification document and I would
like to specify the NRML for input to the database.

Could someone point me to the NRML documentation?

thanks
Simon

Lars Butler

unread,
Aug 25, 2011, 5:40:19 AM8/25/11
to openqu...@googlegroups.com
Hi Simon,

Unfortunately, at present the NRML documentation is rather poor and is something we need to improve. The best I can do is point you to the schema definitions (xsd) and some examples: https://github.com/gem/openquake/tree/master/openquake/nrml/schema

Others on the team may have additional suggestions.

Is there a specific NRML artifact you're interested in? If so, let us know and that may be a good starting point for us to work on improving our documentation.

Cheers,
-Lars

Simon

unread,
Aug 25, 2011, 6:38:04 AM8/25/11
to OpenQuake Developers
Hi Lars,

The schema definitions are helpful, thanks, and I can certainly put
together a draft spec based on the examples.

The next thing is, once the database spec is signed off, I will be
wanting to write Python code to read in the NRML files generated by
our team and populate our Postgis database. Any advice on how to do
this? I have looked in the Openquake Modules and have found some NRML
stuff (NRMLFile, XMLFileWriter) and no database stuff. I can write the
code myself using Psycopg2 and Python's built-in xml.dom but if there
are OpenQuake modules I would like to use them.

thanks
Simon


On Aug 25, 10:40 am, Lars Butler <l...@openquake.org> wrote:
> Hi Simon,
>
> Unfortunately, at present the NRML documentation is rather poor and is
> something we need to improve. The best I can do is point you to the schema
> definitions (xsd) and some examples:https://github.com/gem/openquake/tree/master/openquake/nrml/schema
>
> Others on the team may have additional suggestions.
>
> Is there a specific NRML artifact you're interested in? If so, let us know
> and that may be a good starting point for us to work on improving our
> documentation.
>
> Cheers,
> -Lars
>
> On Thu, Aug 25, 2011 at 10:51 AM, Simon <simon.ruf...@stridedesign.com>wrote:
>
>
>
> > I am working on the GEMECD database specification document and I would
> > like to specify the NRML for input to the database.
>
> > Could someone point me to the NRML documentation?
>
> > thanks
> > Simon- Hide quoted text -
>
> - Show quoted text -

Lars Butler

unread,
Aug 25, 2011, 7:23:36 AM8/25/11
to openqu...@googlegroups.com
Hi Simon,

Cool, let us know if you get stuck.

DB:

You can have a look at the 'risk.py' and 'hazard.py' modules in https://github.com/gem/openquake/tree/master/openquake/output. In particular, check out the various DBReader and DBWriter classes. For example:



We are making using of Django ORM for doing most DB work (if you look in the code now, you'll notice there's a mix of SQLAlchemy and Django ORM use--we're currently in the process of migrating from SQLAlchemy to Django ORM and should be done in a few days). Our DB models are defined here: https://github.com/gem/openquake/blob/master/openquake/db/models.py

XML:

For the bulk of our xml work, we use lxml (http://pypi.python.org/pypi/lxml) and I think it works pretty well. You can find examples of XML serialization in openquake/output/hazard.py and risk.py. For XML parsing examples, have a look at https://github.com/gem/openquake/tree/master/openquake/parser


I hope that helps.

Cheers,
-Lars

Simon

unread,
Aug 25, 2011, 7:36:36 AM8/25/11
to OpenQuake Developers
Lars,

Many thanks for that. I will look at those resources and report on
progress.

thanks
Simon


On Aug 25, 12:23 pm, Lars Butler <l...@openquake.org> wrote:
> Hi Simon,
>
> Cool, let us know if you get stuck.
>
> DB:
>
> You can have a look at the 'risk.py' and 'hazard.py' modules inhttps://github.com/gem/openquake/tree/master/openquake/output. In
> particular, check out the various DBReader and DBWriter classes. For
> example:
>
> https://github.com/gem/openquake/blob/master/openquake/output/hazard....https://github.com/gem/openquake/blob/master/openquake/output/hazard....
>
> We are making using of Django ORM for doing most DB work (if you look in the
> code now, you'll notice there's a mix of SQLAlchemy and Django ORM
> use--we're currently in the process of migrating from SQLAlchemy to Django
> ORM and should be done in a few days). Our DB models are defined here:https://github.com/gem/openquake/blob/master/openquake/db/models.py
>
> XML:
>
> For the bulk of our xml work, we use lxml (http://pypi.python.org/pypi/lxml)
> and I think it works pretty well. You can find examples of XML serialization
> in openquake/output/hazard.py and risk.py. For XML parsing examples, have a
> look athttps://github.com/gem/openquake/tree/master/openquake/parser.
>
> I hope that helps.
>
> Cheers,
> -Lars
>
> > > - Show quoted text -- Hide quoted text -
Reply all
Reply to author
Forward
0 new messages