GR3D_NEA_XML_parameters.R 1.82 KiB
library(XML)
#read the XML file to upload the set of parameters included in GR3D-US
fishXML <- xmlToList(xmlParse("../../data/input/northeastamerica/fishRIOBasin_Sapidissima_Old.xml"))
#Upload parameters linked to reproduction
reproducePar = data.frame(t(unlist(fishXML[[1]][["processes"]][["processesEachStep"]][["species.ReproduceWithDiagnose"]]))) %>% 
  select(-c(synchronisationMode, reproductionSeason, proportionOfFemaleAtBirth,
            sigmaRecruitment, maxNumberOfSuperIndividualPerReproduction, withDiagnose,
            displayFluxesOnConsole)) %>% 
  rename("TminRep" = "tempMinRep",
         "ToptRep" = "tempOptRep",
         "TmaxRep" = "tempMaxRep",
         "ratioS95_S50" = "ratioS95__S50",
         "deltaT" = "delta__t") %>% 
  mutate_all(~as.numeric(as.character(.))) 
#Upload parameters linked to survival in river 
survivePar = data.frame(t(unlist(fishXML[[1]][["processes"]][["processesEachStep"]][["species.Survive"]]))) %>% 
  select(-synchronisationMode) %>% 
  rename("TminSurv" = "tempMinSurvivalSpawnerInRiv", 
         "ToptSurv" = "tempOptSurvivalSpawnerInRiv",
         "TmaxSurv" = "tempMaxSurvivalSpawnerInRiv",
         "survProbOptRiver" = "survivalProbOptSpawnerInRiv") %>% 
  mutate_all(~as.numeric(as.character(.))) 
#Upload parameters linked to growth at sea
growPar = data.frame(t(unlist(fishXML[[1]][["processes"]][["processesEachStep"]][["species.Grow"]]))) %>% 
  select(-synchronisationMode ) %>% 
  mutate(linfVonBertForMale = fishXML[[1]][["linfVonBertForMale"]], 
         linfVonBertForFemale = fishXML[[1]][["linfVonBertForFemale"]],
         lengthAtHatching = fishXML[[1]][["lengthAtHatching"]],
         lFirstMaturityForMale = fishXML[[1]][["lFirstMaturityForMale"]],
         lFirstMaturityForFemale = fishXML[[1]][["lFirstMaturityForFemale"]]) %>% 
  mutate_all(~as.numeric(as.character(.)))