Commit 71dff422 authored by Poulet Camille's avatar Poulet Camille
Browse files

Merge branch 'SpawnerRunAnalysis' of gitlab-ssh.irstea.fr:SimAquaLife/GR3D...


Merge branch 'SpawnerRunAnalysis' of gitlab-ssh.irstea.fr:SimAquaLife/GR3D into exploration_GR3D_process
Signed-off-by: Poulet Camille's avatarcamille.poulet <camille.poulet@irstea.fr>
parents 8be870f8 64ea50e1
......@@ -4,6 +4,7 @@
<cVthresholdForFinalStates>5.0</cVthresholdForFinalStates>
<RecruitmentThresholdForFsAndKappa>50.0</RecruitmentThresholdForFsAndKappa>
<yearOfTheBegin>1801</yearOfTheBegin>
<simulationName>reference</simulationName>
<riverBasinFile>data/input/northeastamerica/nea_riverbasins.csv</riverBasinFile>
<offshoreBasinFile>data/input/northeastamerica/nea_offshorebasins.csv</offshoreBasinFile>
......@@ -24,5 +25,7 @@
<temperatureInshoreFile>data/input/northeastamerica/observed_inshore_temperatures.csv</temperatureInshoreFile>
<temperatureRiverFile>data/input/northeastamerica/observed_river_temperatures.csv</temperatureRiverFile>
<verboseCorrespondance>false</verboseCorrespondance>
<useRealPDam>false</useRealPDam>
</environment.RIOBasinNetworkWithContinent>
\ No newline at end of file
......@@ -8,15 +8,14 @@
<riverBasinFile>data/input/northeastamerica/nea_riverbasins.csv</riverBasinFile>
<offshoreBasinFile>data/input/northeastamerica/nea_offshorebasins.csv</offshoreBasinFile>
<continentShpFile></continentShpFile>
<riverBasinShpFile>data/input/northeastamerica/shape/riverbasins.shp</riverBasinShpFile>
<inshoreBasinShpFile>data/input/northeastamerica/shape/inshorebasins.shp</inshoreBasinShpFile>
<offshoreBasinShpFile>data/input/northeastamerica/shape/offshorebasins.shp</offshoreBasinShpFile>
<continentPathName>PATH</continentPathName>
<riverBasinNameLabel>BASIN_NAME</riverBasinNameLabel>
<inshoreBasinNameLabel>BASIN_NAME</inshoreBasinNameLabel>
<offshoreBasinNameLabel>BASIN_NAME</offshoreBasinNameLabel>
<!-- <continentShpFile></continentShpFile> -->
<!-- <riverBasinShpFile>data/input/northeastamerica/shape/riverbasins.shp</riverBasinShpFile> -->
<!-- <inshoreBasinShpFile>data/input/northeastamerica/shape/inshorebasins.shp</inshoreBasinShpFile> -->
<!-- <offshoreBasinShpFile>data/input/northeastamerica/shape/offshorebasins.shp</offshoreBasinShpFile> -->
<!-- <continentPathName>PATH</continentPathName> -->
<!-- <riverBasinNameLabel>BASIN_NAME</riverBasinNameLabel> -->
<!-- <inshoreBasinNameLabel>BASIN_NAME</inshoreBasinNameLabel> -->
<!-- <offshoreBasinNameLabel>BASIN_NAME</offshoreBasinNameLabel> -->
<distanceGridFileName>data/input/northeastamerica/distanceGridNEA.csv</distanceGridFileName>
<basinConnectionFileName>data/input/northeastamerica/inshore_offshore_connections.csv</basinConnectionFileName>
......@@ -25,5 +24,7 @@
<temperatureInshoreFile>data/input/northeastamerica/observed_inshore_temperatures.csv</temperatureInshoreFile>
<temperatureRiverFile>data/input/northeastamerica/observed_river_temperatures.csv</temperatureRiverFile>
<verboseCorrespondance>false</verboseCorrespondance>
<useRealPDam>false</useRealPDam>
</environment.RIOBasinNetworkWithContinent>
......@@ -360,7 +360,7 @@
<epsilon>0.001</epsilon>
</analysis.AnalyseLikelihoodOfPresence>
<analysis.IdentifyPopulation>
<analysis.ExportExchangeSBetweenCatchments>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<consoleDisplay>false</consoleDisplay>
<years>
......@@ -368,7 +368,7 @@
</years>
<fluxesSeason>SPRING</fluxesSeason>
<fileNameOutput>effectiveFluxes</fileNameOutput>
</analysis.IdentifyPopulation>
</analysis.ExportExchangeSBetweenCatchments>
</processesAtEnd>
</processes>
<useCemetery>false</useCemetery>
......
......@@ -212,7 +212,7 @@
<processesEachStep>
<environment.InformTime>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<consoleDisplay>true</consoleDisplay>
<consoleDisplay>false</consoleDisplay>
</environment.InformTime>
<species.PlopProcess>
......@@ -281,7 +281,7 @@
<species.SurviveWhenBecomeOld>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<ageMax>12.0</ageMax>
<verbose>true</verbose>
<verbose>false</verbose>
</species.SurviveWhenBecomeOld>
<!--<species.WriteEffectiveAndBiomassImportFluxes> <synchronisationMode>ASYNCHRONOUS</synchronisationMode> <exportSeason>SPRING</exportSeason>
......@@ -353,6 +353,15 @@
<migrationSeasonToReachSummeringOffshore>SPRING</migrationSeasonToReachSummeringOffshore>
</species.MigrateBetweenOffshores>
<analysis.ExportExchangeSBetweenCatchments>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<consoleDisplay>false</consoleDisplay>
<yearStart>1920</yearStart>
<yearEnd>1950</yearEnd>
<fluxesSeason>SPRING</fluxesSeason>
<fileNameOutput>effectiveFluxes</fileNameOutput>
</analysis.ExportExchangeSBetweenCatchments>
<environment.updateTemperatureInRIOBasin>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
</environment.updateTemperatureInRIOBasin>
......@@ -367,15 +376,6 @@
<epsilon>0.001</epsilon>
</analysis.AnalyseLikelihoodOfPresence>
<analysis.IdentifyPopulation>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<consoleDisplay>false</consoleDisplay>
<years>
<long>1813</long>
</years>
<fluxesSeason>SPRING</fluxesSeason>
<fileNameOutput>effectiveFluxes</fileNameOutput>
</analysis.IdentifyPopulation>
</processesAtEnd>
</processes>
<useCemetery>false</useCemetery>
......
......@@ -360,7 +360,7 @@
<epsilon>0.001</epsilon>
</analysis.AnalyseLikelihoodOfPresence>
<analysis.IdentifyPopulation>
<analysis.ExportExchangeSBetweenCatchments>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<consoleDisplay>false</consoleDisplay>
<years>
......@@ -368,7 +368,7 @@
</years>
<fluxesSeason>SPRING</fluxesSeason>
<fileNameOutput>effectiveFluxes</fileNameOutput>
</analysis.IdentifyPopulation>
</analysis.ExportExchangeSBetweenCatchments>
</processesAtEnd>
</processes>
<useCemetery>false</useCemetery>
......
......@@ -360,7 +360,7 @@
<epsilon>0.001</epsilon>
</analysis.AnalyseLikelihoodOfPresence>
<analysis.IdentifyPopulation>
<analysis.ExportExchangeSBetweenCatchments>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<consoleDisplay>false</consoleDisplay>
<years>
......@@ -368,7 +368,7 @@
</years>
<fluxesSeason>SPRING</fluxesSeason>
<fileNameOutput>effectiveFluxes</fileNameOutput>
</analysis.IdentifyPopulation>
</analysis.ExportExchangeSBetweenCatchments>
</processesAtEnd>
</processes>
<useCemetery>false</useCemetery>
......
......@@ -360,7 +360,7 @@
<epsilon>0.001</epsilon>
</analysis.AnalyseLikelihoodOfPresence>
<analysis.IdentifyPopulation>
<analysis.ExportExchangeSBetweenCatchments>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<consoleDisplay>false</consoleDisplay>
<years>
......@@ -368,7 +368,7 @@
</years>
<fluxesSeason>SPRING</fluxesSeason>
<fileNameOutput>effectiveFluxes</fileNameOutput>
</analysis.IdentifyPopulation>
</analysis.ExportExchangeSBetweenCatchments>
</processesAtEnd>
</processes>
<useCemetery>false</useCemetery>
......
library(dplyr)
library(tidyr)
library(ggplot2)
distance <- as.matrix(read.csv("../../data/input/northeastamerica/distanceGridNEA.csv", row.names = 1, stringsAsFactors = FALSE))
#distance <- as.matrix(read.csv("../../data/input/atlanticarea/distanceGridAA.csv", row.names = 1, stringsAsFactors = FALSE))
distance <- distance %>%
replace(., col(.) == row(.), NA) %>%
as.data.frame() %>% mutate(destination = row.names(.)) %>%
pivot_longer(cols = -destination, names_to = 'departure', values_to = 'distance')
# true values
meanInterDistance <- mean(distance$distance, na.rm = TRUE )
standardDeviationInterDistance <- sd(distance$distance, na.rm = TRUE )
# asin XML from Rougier's application
meanInterDistance = 300
standardDeviationInterDistance = 978
alpha0 = -2.9
alpha1 = 19.7
distance <- distance %>% mutate(logitW = alpha0 - alpha1 * (distance - meanInterDistance) / standardDeviationInterDistance) %>%
mutate(W = 1/(1 + exp(-logitW)))
#filter(departure =='Pearl', destination == 'Escambia')
distance %>% group_by(departure) %>% summarise(sumW = sum(W, na.rm = TRUE)) %>%
#filter(departure == 'Potomac')
ggplot(aes(x = sumW)) + geom_histogram() +
geom_vline(aes(xintercept = mean(sumW)), color="blue", linetype="dashed", size=1)
distance %>% group_by(departure) %>% summarise(sumW = sum(W, na.rm = TRUE)) %>%
summarise(sumW = mean(sumW))
......@@ -378,10 +378,14 @@ plot(temperature,spawnerSurvivalPostReproductionTempRef(temperature,TrefSpring,
ylab = "Spawner survival in river",
main = "Spawner Survival after reproduction")
lines(temperature, spawnerSurvivalPostReproductionTempRef(temperature,
plot(temperature, spawnerSurvivalPostReproductionTempRef(temperature,
TrefSummer,
1,
0.1), col = "#FF0000")
0.19,
0.20), col = "#FF0000")
lines(temperature, spawnerSurvivalPostReproductionTempRef(temperature,
ToptSpring,
1.,
......
library(tydiverse)
#x50 = Tref
#x5 = 25°C, ie the temperature above which there is no spanwer survival after reproduction (based on Limbrug et al, 2003)
logit2 = function(x, x50, x5){
return( 1/ (1+exp((log(19)/(x5-x50))*(x-x50))))
}
logit2 = function(Triver, Tref,minTempForIteroparity){
return( 1/ (1+exp((log(19)/(minTempForIteroparity-Tref))*(temp-Tref))))
}
#-------------------------------------------
data.frame(temperature = seq(0,40,.1)) %>%
mutate(pctSurvieMax = logit2(temperature, x50=20, x5=25),
survie = pctSurvieMax *.2) %>%
ggplot(aes(x=temperature, y = survie )) +
geom_path()
> log(19)/(25-19.9)
parLogit = c(Tref = 19.9, minTempForIteroparity = 25)
optim_logit2_fn <- function(par,temperature, target, logitPar){
survival = logit2(temp = temperature, Tref = logitPar['Tref'],
minTempForIteroparity = logitPar['minTempForIteroparity']) * par[1]
squareDistance = (mean(survival) - target)^2
return(squareDistance)
}
optim_logit2_fn(par = 0.2,temperature = tempInRiverAvg$summer_river_temperature,
target = 0.1, logitPar = parLogit)
optim_logit2 <- optim(c(coeffb = 0.2),
optim_logit2_fn,
temperature = tempInRiverAvg$summer_river_temperature,
target = 0.1,
logitPar = parLogit,
method = "L-BFGS-B")
ID;River;Latitude;% repeaters
1;St. Johns R.;30;0
2;Ogeechee;32;0
3;Edisto;32,7;0
4;Neuse;35;3
5;James;36,8;28
6;York;37,4;24
7;Potomac;37,9;18
8;Susquehanna;39,9;40
9;Delaware;40,2;2
9;Delaware;40,2;17
10;Hudson 1984;41;72
10;Hudson 1996;41;38
11;Connecticut;41,5;51
11;Connecticut;41,5;63
11;Connecticut;41,5;39
12;St. John;45;71
13;Miramichi;47;59
14;St. Lawrence;49,5;85,7
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment