Skip to content
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

added bar option to timeseries_plot, fixed tests for climatic_summary and added further tests #56

Merged
merged 1 commit into from
Feb 19, 2022

Conversation

dannyparsons
Copy link
Contributor

the bar option allows for doing graphs in #12

@dannyparsons dannyparsons merged commit 3feb6dc into main Feb 19, 2022
@dannyparsons dannyparsons deleted the tests branch February 19, 2022 14:07
Comment on lines +8 to +22
x_daily <- niger %>%
group_by(date) %>%
summarise(mean_rain = mean(rain), st_dv_rain = sd(rain), n_na_rain = naflex::na_n(rain))

x_monthly <- niger %>%
group_by(station_name, year, month) %>%
summarise(mean_rain = mean(rain), st_dv_rain = sd(rain), n_na_rain = naflex::na_n(rain))

x_annual <- niger %>%
group_by(station_name, year) %>%
summarise(mean_rain = mean(rain), st_dv_rain = sd(rain), n_na_rain = naflex::na_n(rain))

x_station <- niger %>%
group_by(station_name) %>%
summarise(mean_rain = mean(rain), st_dv_rain = sd(rain), n_na_rain = naflex::na_n(rain))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HawardKetoyoMsatsi See here how I fixed the tests. For many examples you weren't grouping by station too.

Comment on lines +5 to +6
niger <- daily_niger %>%
filter(year %in% 1950:1951)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HawardKetoyoMsatsi I also restricted the data to two years to reduce the time it takes to run tests. This should still give enough data to check correctness.

Comment on lines +13 to +18
t1 <- timeseries_plot(data = niger50, date_time = "date", elements = "tmax",
station = "station_name", facets = "stations")
r1 <- ggplot(niger50, aes(x = date, y = tmax)) +
geom_line() +
facet_wrap(vars(station_name))
expect_equal(gg_data(t1), gg_data(r1))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lilyclements @HawardKetoyoMsatsi See here I have created a function gg_data which extracts the data that's plotted in a gg graph. So it's a good way to roughly check they are equal - on variables, layers, aesthetics and facets. It won't check theme aspects, we could think of adding functions to do this later.

Comment on lines +6 to +10
niger50 <- daily_niger %>%
dplyr::filter(year == 1950)

agades <- niger50 %>%
dplyr::filter(station_name == "Agades")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lilyclements @HawardKetoyoMsatsi Here I've made two smaller data sets so that testing is efficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant