rascully / Stream-Monitoring-Data-Exchange-Specifications

Description of the data exchange specifications for in-stream tributary habitat data.
4 stars 1 forks source link

beaverImpactFlow -> beaverPresence update #42

Closed edlabo closed 1 year ago

edlabo commented 1 year ago

Issue: update beaverImpactFlow to beaverPresence in the Location table change Major, Minor, NA, None categories to: Present, Absent, NA (and update their definitions) update beaverPresence definition to: signs of beavers are noted in the surveyed reach (e.g., chewed wood, lodges) update AIM's beaverImpactFlow data mapping field from BeaverFlowMod to BeaverSigns

Issue location(s): DataMappingDES MetadataDictionary CategoryDictionary

Location(s) in code: with the changes in input files above, when the code is run again, this should make these changes to Location table without modifying code.

Action to take: n/a

Notes:

edlabo commented 1 year ago

we might actually need to do a little code editing to transform AIM's categories to the SHMI categories, need to think about/look into this more.

aim category transformation to shmi categories: Absent = Absent Common = Present Rare = Present

edlabo commented 1 year ago

we might actually need to do a little code editing to transform AIM's categories to the SHMI categories, need to think about/look into this more.

Yes. It looks like there are lines of code regarding AIM's beaverImpactFlow in the CombineData.R file. Lines of code below:

https://github.com/rascully/Stream-Monitoring-Data-Exchange-Specifications/blob/8fe877d766a12fad8907c894a5b87be4c1f725ce/DataIntegrationExample/R/CombineData.R#L124-L133

To update this to AIM's field BeaverSigns, in addition to updating the DataMapping, MetadataDictionary, and CategoryDictionary files as listed in the first post of this Issue, I think we will need to change the code selected above to something like:

  #from the datamapping find the field name that contains the percent dry for AIM 
    field <- dataMapVariable("beaverPresence", p)

   #change BVR_FLW_MD to YES, NO
    beaverPresence <- data[[field]]
    beaverPresence <- as.character(beaverPresence) 
    beaverPresence <- str_replace(beaverPresence,c("Absent"),"Absent")
    beaverPresence <- str_replace(beaverPresence, c("Common"),"Present")
    beaverPresence <- str_replace(beaverPresence, c("Rare"),"Present")
    data[[field]]     <- beaverPresence

what we need to do:

  1. @edlabo -- update DataMapping, MetadataDictionary, Category Dictionary
  2. @eheaston -- modify CombineData.R code, run code to implement changes
edlabo commented 1 year ago
  1. @edlabo -- update DataMapping, MetadataDictionary, Category Dictionary - DONE see https://github.com/rascully/Stream-Monitoring-Data-Exchange-Specifications/commit/f4e217b5382d0d53addc98b94984312df3fde8cd
eheaston commented 1 year ago
  1. @eheaston -- modified CombineData.R script and fixed this issue. Code now reads:

    from the datamapping find the field name that contains the percent dry for AIM

    field <- dataMapVariable("beaverPresence", p)

    change BVR_FLW_MD to Present, Absent, Common, Rare

    beaverPresence <- data[[field]] beaverPresence <- as.character(beaverPresence) beaverPresence <- str_replace(beaverPresence,c("Absent"),"Absent") beaverPresence <- str_replace(beaverPresence, c("Common"),"Present") beaverPresence <- str_replace(beaverPresence, c("Rare"),"Present") data[[field]] <- beaverPresence