-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display of daily climatic data #3067
Comments
David prepared a set of graphs for daily rainfall of exactly the type we would like to see. This comment shows what he did. Then the next one gives ideas for what might be in R-Instat.
Here is the R code from David's plots which present this information for 4 stations:
provided you name your data files "BLAIRMONT", "TIMEHRI", "GEORGETOWN" and "ANNAI" before running the prep script. |
Good to see David finally contributing some code to R-Instat! Can we come up with a design for the dialog? Then it should be easy for someone to do with the code going into an instat object method. |
From Roger:
|
This looks good. How about the element receiver always being multiple? Then there is a option to either do all elements together on the graph or include "element" as a facet variable. Although with multiple elements, how do we specify the geoms for each variable? In a list box on a sub dialog? Unless we restrict to one geom for all elements, but that wouldn't be very useful for rain and temperature together then. |
I suggest as follows for the dialogue:
|
@africanmathsinitiative/developers I will take on this |
Great. We should then decide on the implementation of the R code. The graph will probably be it's own method since it's a fairly specialised plot. The table is special case of producing a table from "summarised" data, because we could do the same thing from the data frame produced by Column Summaries dialog. I'll work on having this general method and then we can discuss how to use it for this dialog. @Lunalo after doing the dialog could you try creating the R method for doing the graph? It's a similar idea to the inventory plot in that we create an instat object method to do a specific ggplot graph. |
Great. We we trying to come up with the method yesterday with @stevenndungu Let him push and then I continue working on it |
Do you know what RR is in the above code? |
It is (in general) just the data column being plotted. In the code it was rainfall with the limit of 100mm. In the more general code it is whatever is plotted, and the 100mm would not be fixed, but would also be something that could be changed in the dialogue |
Great, So it is the Rain column? |
In David’s example, yes. But in general (and in the dialogue) it could alternatively be tmax etc. It is to display the daily data of whatever element is needed. |
Thanks, I will look for a better name for the parameter |
|
@Lunalo where have you got to on this? Can you share the R code you've written for the graph if you need help with that? Is the table part implemented from the code I sent before? |
@dannyparsons i was wondering if adding |
Yes that's added and done. I also changed the default summary to "sum" only. The function doesn't allow no summaries so that seemed the sensible default. |
There is a bug here, so this dialogue doesn't run. Here is the message: **Error running R command(s) Error in eval(expr, pf) : attempt to apply non-function The error occurred in attempting to run the following R command(s): .temp_val <- capture.output(InstatDataObject$display_daily_table(data_name="Dodoma", climatic_element="Rain", date_col="Date", year_col="Year", Misscode="m", monstats=c(sum="sum"))) OK** This was with the Dodoma data for rainfall. It did have a filter in operation to limit the number of years to those from 2004. |
Unfortunately I had forgotten to include the file containing the new display daily method into the compiled version and so this file is missing in the latest version, sorry about that mistake. It will be included in the next version. |
The dialogue now works. Thanks. There is one oddity of [1] printed at the start of the 5 lines between each year. But there are one (or more) bugs when the option is added to include the missing values to the list of summaries. Error running R command(s) I guess it doesn't like the fact we keep the bit of the code in bold? |
I've changed the label to |
Output from plot daily Koundara.docx Here is the output I had. Look first at the second table in Word, which is how it looks in the output window. It is data from Guinee, for Koundara. I will send Danny a copy. It will soon be in the Instat library. As an aside, when I copy (as RTF) and do the default paste into Word I get the first table that has kept the Courier font, but lost the new lines. The second table was the option to copy just the text. Then I changed back to Courier in Word. |
Fixed all apart from 3. This would take a bit more messing about with the code which I thought wasn't a priority at this time, but could still be done. |
I am still not able to get this dialogue to work! I am starting to regret using the code from Helen - which you must be also.
Error running R command(s) The R-command was: The results displayed are then from the previous command that was run. |
@rdstern I am unable to replicate this error, How did you get that? |
I now tried again with the same data file. And it crashed. Then I opened again and tried and it all worked fine. Confusing. Let's close for now if the other small issue is fixed. Then wait and see the problem. |
This was because |
This is one of the last set of features I am keen to see soon and certainly in the first release. I think the only other is the crops dialogue that should be easy once the start, end and summary (already specified) have been done.
In the old Instat there is a dialogue to display daily data in 2 different ways. I assume this might again be a single dialogue with our new buttons at the top to permit the results as either a Table or a Graph.
Also the main initial fields will again be the same as usual. Perhaps we need a column for the day of the month here? At least for the table. We need the day of the year for the graph.
I give the requirements below, but not (yet) the layout. I am happy to discuss the layout once we know who is doing what, and also when it might be done. I suspect the table part might depend on the progress with the main tabulation. The graphs would be great - and useful as soon as someone has the time.
1) As a "table".
a) This has the months across (columns) and the day of the month as the rows.
b) it is a trivial example of a table (or an unstack by the month factor).
c) It is "trivial" as a table because it is usually used to display single values, rather than a summary.
d) It may later become a summary when we deal better with within-day data, though it would usually have a "shifted day" rather than starting at midnight.
e) Ideally it could be able to include a symbol for a range of values (or a single special value (e.g. "." for zero, so rainfalls stand out.
f) This would display the data in the output window, as in the old Instat.
g) We would be able to choose the number of decimals to display.
h) It could be for up to 12 months and could start from any month, but the default would be 12 months starting from January.
i) It could have margins after each year (i.e. for each month as well as annual - including sum (for rainfall),mean (for temperature) count (from a certain threshold, min, max, and number of missing.
j) A non-trivial set of margins is the annual values. That's odd because we don't need the extra margin on the right! (Once we have margins in the table Danny says this is trivial.)
2 As a graph or set of graphs
a) The graphs were hardly used in the old Instat. They are "needle plots - sort of bar charts - for rainfall and possibly line charts for temperatures and other elements.
b) here they could be great, because of facets, i.e. many years on a single graph.
c) Default is for a graph per year.
d) Another alternative could be for a graph per station - over all the years (filtered usually). This is very common in other software, but usually not so easy, because it confuses the seasonality with the trend.
e) ideally labels could be months or day of the year.
f) Ideally it would also be able to indicate missing values clearly.
g) David has the commands for much of this from his work for Guyana.
The text was updated successfully, but these errors were encountered: