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

Bugs in the inventory_plot function #58

Open
lilyclements opened this issue Feb 23, 2022 · 1 comment
Open

Bugs in the inventory_plot function #58

lilyclements opened this issue Feb 23, 2022 · 1 comment

Comments

@lilyclements
Copy link
Collaborator

These might not be bugs, but confusion as to why they're not working. @dannyparsons if you could explain this to me, that would be great, then I can add it into the documentation.

  1. x_scale_from

If x_scale_from is given, then x_scale_to, and x_scale_by arguments have to be given (and similarly if at least one of the three are given, but not all three)
Should we set defaults if this is the case - x_scale_by to be 1 and x_scale_to to be the maximum year value in the date variable?

data(daily_niger)
# this does not work
inventory_plot(data = daily_niger, station = "station_name", elements = c("tmax", "tmin"),
               date = "date", x_scale_from = 1940, x_scale_by = 5)

# this does work
inventory_plot(data = daily_niger, station = "station_name", elements = c("tmax", "tmin"),
               date = "date", x_scale_from = 1940, x_scale_to = 1950, x_scale_by = 5)
  1. x_scale_from with year_doy_plot = TRUE

If x_scale_... is given with year_doy_plot = TRUE, then the maximum year does not seem to work correctly.

inventory_plot(data = daily_niger, station = "station_name", elements = c("tmax", "tmin"),
               date = "date", year_doy_plot = TRUE,
               x_scale_from = 1940, x_scale_to = 1950, x_scale_by = 5)

image

  1. facet_dir is a parameter in the list of parameters in the function but is never used in the function.
    Was this removed, but left in the list of parameters accidentally, or should it be in the function somewhere?

  2. rain_cats
    There is 0, 0.85, and an upper bound value. Is this essentially setting the threshold value? What are the lower and upper boundaries for?

  3. facet_by with year_doy_plot = TRUE
    I can't seem to get elements-stations to work when year_doy_plot = TRUE. Is this intentional? If so, why? I'll update the documentation.

inventory_plot(data = daily_niger, station = "station_name",
               year_doy_plot = TRUE,
               elements = c("tmax", "tmin"), date = "date",
               facet_by = "elements-stations")
  1. In addition there are some parameters in the documentation where I'm unsure of their purpose. Can you have a look, or briefly outline their aim so I can update the documentation?
@dannyparsons
Copy link
Contributor

  1. Looking at this I'm wondering if this would be better as one argument i.e. x_scale_breaks = seq(1940, 1950, 5). Since it doesn't really make sense to separate them and leads to errors you identified. We could just have this as one argument which is specified as a vector of year break points.

  2. Looks like a bug, yes. I could have a look if you can't see an obvious issue?

  3. Could you check if this is used in the R-Instat equivalent? If not, it could be removed.

  4. This splits the data into categories so you can display rain/dry as different colours. So 0, 0.85, Inf would define 2 categories. It's flexible like this so that you could define more categories e.g. dry/light rain/heavy rain

  5. Don't see why that shouldn't work so would be good to fix if possible.

  6. Sure if you leave them as TODO I'll have a look.

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

No branches or pull requests

2 participants