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

first cut at input data figure for poster #50

Merged
merged 5 commits into from
May 18, 2018

Conversation

jzwart
Copy link
Member

@jzwart jzwart commented May 17, 2018

  • Initial plot of input data used for the forecasts. Bare bones right now and will need to make it prettier
  • I was getting error messages with 'verbose' in EGRET saying that it was an unused argument. I switched it to interactive = FALSE and it was happy. Not sure if I have a different version of EGRET or not...

@jzwart jzwart requested a review from aappling-usgs May 17, 2018 20:55
@aappling-usgs
Copy link
Member

What version of EGRET do you have? I have (from devtools::session_info()):

EGRET         * 2.6.1.9003 2017-11-22 Github (USGS-R/EGRET@b941b9f)

@aappling-usgs
Copy link
Member

aappling-usgs commented May 17, 2018

@jzwart
Copy link
Member Author

jzwart commented May 17, 2018

EGRET 2.6.0 2016-07-27 CRAN (R 3.4.4)

@aappling-usgs
Copy link
Member

Ah, better:
fig_input_data 1

@jzwart
Copy link
Member Author

jzwart commented May 17, 2018

oops, yeah had the wrong function call

ref_date = '2017-05-09'

preds <- readRDS(sc_retrieve(preds_ind, remake_file)) %>%
dplyr::filter(ref_date == '2017-05-09', # dplyr::filter doesn't recognize objects??
Copy link
Member

Choose a reason for hiding this comment

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

objects? what kinds of object did you want it to recognize?

Copy link
Member Author

Choose a reason for hiding this comment

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

the ones defined on lines 4-6 (ref_date, etc...). Or could replace with a yml file as input.

Copy link
Member

Choose a reason for hiding this comment

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

dplyr by default uses non-standard evaluation (hence we can use ref_date and it knows we're talking about the column). However, there's been a lot of work recently to make it friendlier to standard evaluation. This should work:

preds <- readRDS(sc_retrieve(preds_ind, remake_file)) %>%
     dplyr::filter(ref_date == !!(ref_date ),

Basically, how would it know when you are talking about column names vs variable(object)? Surround it by !! (which...apparently is said out loud "bang-bang")

Copy link
Member Author

Choose a reason for hiding this comment

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

ah thanks! bang-bang!

!!(thanks)

Copy link
Member

Choose a reason for hiding this comment

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

woot! I forgot about !! and would have suggested just renaming ref_date. @ldecicco-USGS 's suggestion is way better.

Site == '05465500')

# example of input data for a forecast
eList <- prep_inputs(nwis_site = site,
Copy link
Member

Choose a reason for hiding this comment

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

cool reuse 👍

theme(axis.title.x = element_blank()))

#concentration
g2 <- ggplotGrob(ggplot(data = eList$Sample, aes(x = Date, y = ConcAve)) +
Copy link
Member

Choose a reason for hiding this comment

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

we could think about using lollipops or randomized residuals for censored data, a la https://owi.usgs.gov/blog/rResid/. @ldecicco-USGS, want to weigh in on this?

Copy link
Member

Choose a reason for hiding this comment

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

I don't have a favorite, but it would be a good touch to flag censored data. Could do a simple color a la https://owi.usgs.gov/blog/plotFlowConc/
You could also just use the EGRET plot functions. multiPlotDataOverview is a nice intro plot to the data.

Merge branch 'master' of git://github.com/USGS-R/protoloads

# Conflicts:
#	3_forecast/src/prep_inputs.R
# period for this "analysis" substitute
nwm_analysis <- bind_rows(
nwm_retro %>% filter(date >= as.Date('2016-11-08'), date < min(nwm_forecast$valid_date)),
nwm_forecast %>% filter(ref_date == valid_date) %>% select(site_no, date = valid_date, flow))
Copy link
Member

Choose a reason for hiding this comment

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

the deletions in this file look wrong to me - i think i just added this and want to keep it

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah I had some merge conflicts that I think I screwed up but I'm pushing up your changes now

@aappling-usgs aappling-usgs merged commit ffbe018 into USGS-R:master May 18, 2018
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.

3 participants