How can I insert Supervising organization using API Python code?

How can I insert Supervising organization using API Python code?

VidmarVesna -
回帖数:4

Hi, 

I am using code for inserting Slovenian Meteorological Stations (Timo: Example #4 (create stations).ipynb). 

Everything works except I CANNOT write Supervising organization ARSO with current  Python code? 

I have the following questions:

1.) Do I need to map Supervising organization with a WMO codes registry (which?)  ?

2.) Can this be done with a bulk SQL change from OSCAR team?

Can you suggest me the best solution? 

Thank you for your additional clarifications and help,

Vesna

回复VidmarVesna

Re: How can I insert Supervising organization using API Python code?

ProescholdtTimo -
Hi Vesna,

there's a bug in the oscar library. I will release a new version shortly that correctly adds the organization.
In theory you need to pass the parameter "organization" to the Station object when you create it, but so far it has been ignored.

The way it works in the library is that you can only reference an existing organization. So you supply either the abbreviation or the fullname as in OSCAR as a parameter to the library.

with kind regards,
Timo
回复ProescholdtTimo

Re: How can I insert Supervising organization using API Python code?

VidmarVesna -
Hi, Timo,

thank you very much for your reply.

There have been some changes in our organization since 2016 (when first 25 stations were added) and we wish to add as Supervising Organizaton ARSO. Can you, please, let us know, how can we register ARSO into OSCAR System?

In the script I will add ARSO as Supervising Organization for the 90 + stations that I will upload through API.

Warm regards,

Vesna
回复VidmarVesna

Re: How can I insert Supervising organization using API Python code?

ProescholdtTimo -

Dear Vesna,

you can add a new organization manually through the web interface when going to the "register new station", then "add supervising organization". Select new organization. (you can then skip creating the new station).

In the XML you can refer to the organization by its abbreviation or full name.

To do the batch change through the API (I understand you want to add an additional as opposed to replacing), I would download the XML of the existing stations, insert a new XML fragment for the supervising organization with a suitable "date from" and upload again. Remember to keep the old supervising organization fragment in place, as you are adding a new one. You may set the "date to" of this one to indicate that this organization is no longer affiliated.

If you are replacing the organization then update the values in the existing fragment as needed.

with kind regards,

Timo

回复ProescholdtTimo

Re: How can I insert Supervising organization using API Python code?

VidmarVesna -
Dear Timo,

thank you very much for your reply. We will discuss which option is most appropriate for us and make the corrections as you have instructed them.

Regards from snowy Slovenia,

Vesna