IDEMSInternational / R-Instat

A statistics software package powered by R
http://r-instat.org/
GNU General Public License v3.0
38 stars 103 forks source link

Export to World Weather Record dialog #6110

Open dannyparsons opened 3 years ago

dannyparsons commented 3 years ago

For WMO we have been asked to implement in R-Instat the ability to export data in the format required for submission to the World Weather Record, which national Met services are required to do for WMO. You don't need to know all the details about this but if you want to see here for more background https://www.wmo.int/pages/prog/wcp/wcdmp/GCDS_2.php and there is a WMO guide with specific details of the format https://www.wmo.int/pages/prog/wcp/wcdmp/documents/worldweatherrecords/1186_en.pdf

So I suggest we have a dialog in R-Instat to do this export. The data are monthly, there are up to 7 elements, plus station metadata. Because of the number of variables to specify, I suggest a main dialog to specify the monthly data variables, and then a subdialog to specify the station metadata (from a separate data frame).

Below is a rough design of the dialog and subdialog. The dialog has a "Station identifier" which can be either "Station Name" or "WMO Number" (selected from the combo box), next to or under this a button for "Station Metadata" to open the subdialog. Then there are receivers for year, month and the 7 elements. The subdialog just has the receivers shown. A different data frame will be selected for the station metadata.

The labels for the seven elements can be:

Here is an R file with the R function created for the dialog wwr_export.zip. This should go in standalone functions.

Here is an example output file from WMO https://www.wmo.int/pages/prog/wcp/wcdmp/documents/WWR_txt_example_revised_2016_noMeanClino.txt Note that the format specifies the exact spacing and alignment of values so this should be the same.

On the main dialog, the first receivers are required, then at least one element must be given. For the station metadata, everything apart from the last two are required.

I hope it's clear from the R file how this all links up. @HawardKetoyoMsatsi are you happy to take on this task? Check with @rdstern but I think this task would become highest priority now.

WhatsApp Image 2020-12-02 at 12 18 48

dannyparsons commented 3 years ago

@HawardKetoyoMsatsi Can you respond to this? This is an important task so if you can't take it up then we need to assign it to someone else.

HawardKetoyoMsatsi commented 3 years ago

@dannyparsons someone just drew my attention to this, I missed the alert when the issue was raised. I would like to take it up, I however would need about one day to do it, I hope that will be enough to meet the urgency of the task. I will also need some help, I may closely involve @shadrackkibet in the this.

HawardKetoyoMsatsi commented 3 years ago

@rdstern or @dannyparsons I am about to start the "Export to World Weather Record dialog" I would like to first know the menu under which I will put the dialog so that I can add empty forms for frmmain changes to be merged as soon as possible.

dannyparsons commented 3 years ago

That would be great. It's not quite that urgent. If you could get this done by the end of the week that would be great.

I think this can go under Climatic > File > Export for World Weather Records

dannyparsons commented 3 years ago

@HawardKetoyoMsatsi How have you got on with this? Your initial suggestion of 1 day might have been optimistic? :)

HawardKetoyoMsatsi commented 3 years ago

@dannyparsons I am done, I opened a pull request (#6122). Kindly take a look at it.

dannyparsons commented 3 years ago

I've been informed of an update to the WWR format. There is now a 2020 version. It requires minor changes to our specification above. An update example text file is here https://wmoomm.sharepoint.com/:t:/s/wmocpdb/EeGnVAcKRwlDi-s0nBSPBgQBfBHORiAeSsDtxfMDX69s1g?e=PIC8Yy and the updated document is here https://wmoomm.sharepoint.com/:b:/s/wmocpdb/EZQ1TtZNjHBCk__iUl0OT2MBdepNValcllwQooBGVCPzhw?e=a4d5H5

I will make a new PR with the additions needed for the update.

dannyparsons commented 3 years ago

@HawardKetoyoMsatsi Once this is merged can you enable and show the menu item and also edit it so that it is "Export to World Weather Records..."? It is missing the last part.

Patowhiz commented 3 years ago

@dannyparsons the file input control can now also handle export of multiple files to particular folder, it can be used here, once PR #5873 is merged.

dannyparsons commented 3 years ago

The folder selector is only used to pass a folder parameter to the R function for this dialog. The saving is done within the R function we wrote. See from testing the dialog, or when it's merged. That may or may not be what the folder control is set up for?

Patowhiz commented 3 years ago

@dannyparsons the control was designed to it's to do the same. It's used in dialogs that save file through R. So it writes into the specified R parameter.