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

let loadReg2 store more metadata #171

Open
aappling-usgs opened this issue Feb 1, 2017 · 0 comments
Open

let loadReg2 store more metadata #171

aappling-usgs opened this issue Feb 1, 2017 · 0 comments

Comments

@aappling-usgs
Copy link
Collaborator

I think a user should be able to supplement the metadata that rloadest::loadReg collects with any slot that loadflex::metadata acknowledges that isn't already known to loadReg. This is especially important now that metadata has been extended to include many more slots.

The trick is to do this tidily, so that the user doesn't have to do a whole lot of retyping if they're fitting multiple models. One less-tidy option is to add explicit parameters for all of the metadata slots that aren't already collected by loadReg, e.g.,

loadReg2 <- function(load.reg,
                     pred.format=c("flux","conc"),
                     store=c("data","fitting.function"),
                     site.id, lat, lon, basin.area, # etc. - add all the slots that loadReg doesn't have
                     ...) {

but this could get unweildy. So another option might be to accept a partial metadata object in lieu of all those independent objects, from which only the non-loadReg slots will be used...

loadReg2 <- function(load.reg,
                     pred.format=c("flux","conc"),
                     store=c("data","fitting.function"),
                     new.metadata,
                     ...) {

but this will require careful communication to the user and/or some way of preventing them from trying to override the slots that loadReg does know about. So this option requires some thinking, too.

For any solution we choose, the idea should be to get the non-loadReg slots optionally filled in.

Here are the slots that loadReg tracks:

https://github.com/USGS-R/loadflex/blob/master/R/loadReg.R#L31-L39

    constituent=load.model$constituent,
    flow=load.model$flow,
    load.rate="",
    dates=load.model$dates,
    conc.units=load.model$conc.units, 
    flow.units=load.model$flow.units, 
    load.units=load.model$load.units, 
    load.rate.units=paste0(load.model$load.units,"/day"),
    site.name=load.model$station

and here are all the slots in loadflex::metadata:
https://github.com/USGS-R/loadflex/blob/master/R/metadata.R#L68-L94

  slots=c(
    # Column names (except consti.name)
    constituent="character",
    consti.name="character",
    flow="character",
    load.rate="character",
    dates="character",
    # Units
    conc.units="character",
    flow.units="character",
    load.units="character",
    load.rate.units="character",
    # Site info
    station="character", # deprecated in favor of site.name, site.id
    site.name="character",
    site.id="character",
    lat="numeric",
    lon="numeric",
    basin.area="numeric",
    flow.site.name="character",
    flow.site.id="character",
    flow.lat="numeric",
    flow.lon="numeric",
    flow.basin.area="numeric",
    basin.area.units="character",
    # Other
    custom="ANY"),
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

1 participant