IDEMSInternational / R-Instat

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

Add a new Setup for Data Entry dialogue #6401

Open rdstern opened 3 years ago

rdstern commented 3 years ago

This now follows discussion with @volloholic for a new dialogue to help users setup their data files for the data entry process. This also follows discussions with Zambia Met who need to be able to enter into new files - for their rainfall data - as well as extend their existing files.
I suggest a simple (I hope) dialogue with now just 2 buttons: a) New - to set up a new data frame c) Add flags to add flag variables to an existing data frame

I go through these in turn:

The first option is New

This sets up a new sort of empty data frame. I would like to insist we have station information first. So I am going to assume a Station data frame exists. If not, then the user would simply have to create a data frame and put the station names into it.

I am going to assume also that the new data to be entered is for a single station. (Easy to append or set it up differently if not.

1) So there is the usual data selector.
2) On the right are the first 2 fields from the data entry dialogue, i.e. for Station, and then choosing a level. 3) Then below that is Date From:and the date selector from the data entry dialogue 4) Then Date To: and a second date selector 5) Then a group box right across with the label Elements: Inside is a set of check-boxes 3 downs Any number can be checked:

precip, sunh, specify1, 
tmax, ws, specify2, 
tmin, wd, specify3 

The 3 specify checkboxes are followed by a field into which a name can be typed.
6) Then a checkbox with label Add Flag Variables Default unticked. 7) Then a New Data Frame Name: (as in the File > New Data Frame dialogue) It will have a station variable - factor with single variable, then date, then each element defined (all NA and numeric), then the flag fields if that option was chosen. 8) The date variable is made into a key column. The key name can be key. It could be Station and Date as defining the key. The station isn't relevant here, because just a single one. But it would then still apply if we extend the dialogue later to allow more stations.

The second option is Extend and is omitted for now.

This takes an existing data frame and allows you to add months or years at the top or to the bottom. It is essentially the Climatic > Dates > Fill Date Gaps dialogue. But just 2 of the 4 options. These are Fixed Start Limit and Fixed End Limit. They can be renamed for here as Extend Start and Extend End. The default is Extend End. The output can be changed to End date extended to xxx, if just the end is changed. Second line if the start is also changed.

There could be a checkbox Add Key. That will be needed for the Comments system. This is disabled if a key already exists. There is a tooltip to say A key already exists for this data frame.

The third option is Add Flag Variables.

a) Then there is the usual data selector as this assumes a data file.

b) It will do no harm to have a single Station receiver. c) Then a multiple receiver with label Flag Variables: d) There could then be an Add Key checkbox? See above - it is disabled if a key exists, with a tooltip, see above. e) Pressing Ok will add the extra factor variables to the data file. Ideally each one would be just after the data variable. It could be called tmax_fl, etc. If it already exists I guess it would overwrite, which is ok? Each flag variable is a factor with 3 levels as specified in #6394 . Here it just has NA and data. The other 2 levels are Edit and Add.

rdstern commented 3 years ago

fairview.zip Here is a station that I load. I then go into the setup to add the flag variable: It says:
image

It does add the flag variable - seemingly correctly. It doesn't have a key variable.

I then go back and ask it to add a key. It says: image

It didn't add the key - at least I think it didn't

I then added the key myself with station and Date. Then it worked fine.