Discussion forum (En)

XML production with PYTHON

XML production with PYTHON

by Martin Auer -
Number of replies: 3

We are in preparation for an automatic XML production and a m2m data transfer to OSCAR.
Considering PYTHON3 as an appropriate progamming language for this work, we are interested in existing solutions and an exchange of experiences:

  • Does anyone already produce OSCAR XML files with PYTHON3?

  • Are there any special PYTHON modules?
  • Are there any predefined PYTHON classes for this purpose?


Please prevent us from reinventing the wheel:-)

In reply to Martin Auer

Re: XML production with PYTHON

by Tom Kralidis -

Check out pygeometa (to generate WMDR XML) and pyoscar (to publish to OSCAR).  We use these examples here at MSC and WOUDC to interact with OSCAR via Python (both versions 2 and 3 are supported).  Feedback, suggestions are valued.

Cheers

..Tom

In reply to Tom Kralidis

Re: XML production with PYTHON

by Alexandra Fritz -

Thank you Tom! Very cool. I am currently looking into pygeometa too see how we can use it. Looks good so far!

But one of the first things I stumpled upon is the Program Affiliation section.  I couldn't figure out how a yaml file would have to look like that had a program with changing reproting status, i.e. a facility that is closed - like in the example from the second webinar.  Then I looked directly into the template and I think that this case might not be covered yet? Am I correct or am I missing something completely?

Anyway, I've been toying with the template and the example-yaml to figure it out and I have a solution now that seems to result in a xml file that validates against the wmdr-schema.

Does it make sense to commit it to github?  I have never contributed to a git project before (we are using svn here.. :( ), so I still have to figure that out as well ...

thanks again! bye,

alex


In reply to Alexandra Fritz

Re: XML production with PYTHON

by Tom Kralidis -

Hi Alexandra: thanks for the info and feedback.  Good idea, let's cover this on GitHub.  Feel free to open an issue and / or submit a pull request.

The WIGOS implementation in pygeometa is based on our initial efforts here in Canada.  Your contributions will help make these tools more robust to cover more of the WIGOS requirement for the greater community -- thanks!

..Tom