hmtk source model error

34 views
Skip to first unread message

bigriver

unread,
Jul 7, 2017, 5:17:03 AM7/7/17
to OpenQuake Users
I am learning hmtk (using openquake engine 2.5) and using the hmtk tutorial on github


when i was tying to import souce model as same format below:

from hmtk.parsers.source.model.nrml04_parser import nrmlSourceModelParser
model_filename = ’path/to/source_model_file.xml ’
model_parser = nrmlSourceModelParser (model_filename)
model = model_parser.read_file ()


The program returned error with 
TypeError: read_file() takes at least 2 arguments (1 given)


by searching hmtk document, read_file has the following format, what is identifier? what i need to do to remove the error?
read_file(identifiermfd_spacing=0.1simple_mesh_spacing=1.0complex_mesh_spacing=4.0area_discretization=10.0)[source]


Regards

Graeme Weatherill

unread,
Jul 7, 2017, 5:28:48 AM7/7/17
to openqua...@googlegroups.com
I'm seeing that the documentation mentions "identifier" in several places but doesn't explain it further than the tautological "this is an identifier".

Basically it is some sort of string that can uniquely identify the source model (e.g. "MODEL_REGION_XYZ", or even just "1234" if that is the only model are working with). There is a logic to why it is required if you are working with several different models, but most of the time it is not used.

So: model = model_parser.read_file("SOURCE_MODEL_1") should work.

Thanks,

Graeme
--
You received this message because you are subscribed to the Google Groups "OpenQuake Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openquake-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Reply all
Reply to author
Forward
0 new messages