Commit 71a4dc99 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
parents 908ee0f6 9b412f40
......@@ -19,51 +19,6 @@
</observers>
</fr.cemagref.observation.kernel.ObservablesHandler>
</entry>
<entry>
<java-class>species.DiadromousFishGroup</java-class>
<fr.cemagref.observation.kernel.ObservablesHandler>
<observers>
<fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<graphType>LINE</graphType>
<title>Number of populated basins</title>
<xAxisLabel>Time (season)</xAxisLabel>
<yAxisLabel>Number of basins</yAxisLabel>
<variableName>getNbPopulatedBasins</variableName>
</fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<graphType>LINE</graphType>
<title>Abundance of spawners</title>
<xAxisLabel>Time (season)</xAxisLabel>
<yAxisLabel>Number of fish</yAxisLabel>
<variableName>getSpawnerEffective</variableName>
</fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<graphType>LINE</graphType>
<title>Abundance of male spawners</title>
<xAxisLabel>Time (season)</xAxisLabel>
<yAxisLabel>number of fishes</yAxisLabel>
<variableName>getMaleSpawnerEffective</variableName>
</fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<graphType>LINE</graphType>
<title>Abundance of female spawners</title>
<xAxisLabel>Time (season)</xAxisLabel>
<yAxisLabel>number of fishes </yAxisLabel>
<variableName>getFemaleSpawnerEffective</variableName>
</fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<observer.TemporalRangeSerieChart>
<title>Range distribution</title>
<xAxisLabel>Time (season)</xAxisLabel>
<yAxisLabel>latitude</yAxisLabel>
<variableName>getRangeSpawnerDistributionWithLat</variableName>
</observer.TemporalRangeSerieChart>
</observers>
</fr.cemagref.observation.kernel.ObservablesHandler>
</entry>
<entry>
<java-class>analysis.AnalyseFishDistribution</java-class>
......@@ -74,7 +29,7 @@
<title>Number of colonized basins</title>
<xAxisLabel>Time (season)</xAxisLabel>
<yAxisLabel>Number of basins</yAxisLabel>
<variableName>getNbColonizedBasins</variableName>
<variableName>getNbPopulatedBasins</variableName>
</fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
......@@ -105,7 +60,7 @@
<title>Range distribution</title>
<xAxisLabel>Time (season)</xAxisLabel>
<yAxisLabel>latitude</yAxisLabel>
<variableName>getRangeDistributionWithLat</variableName>
<variableName>getRangeSpawnerDistributionWithLat</variableName>
</observer.TemporalRangeSerieChart>
</observers>
......
......@@ -72,13 +72,19 @@
<observers>
<observer.RecordDuoChart>
<graphType>POINT</graphType>
<variableName>getPrimiparousrousRateVsLatitude</variableName>
<variableName>getPrimiparousRateVsLatitude</variableName>
<xName>latitude</xName>
<yName>meanPrimarousRate</yName>
<yName>meanPrimiparousRate</yName>
</observer.RecordDuoChart>
<observer.TemporalRangeSerieChart>
<title>Range of female ages</title>
<xAxisLabel>Time (season)</xAxisLabel>
<yAxisLabel>Age (year)</yAxisLabel>
<variableName>getRangeOfFemaleAge</variableName>
</observer.TemporalRangeSerieChart>
</observers>
</fr.cemagref.observation.kernel.ObservablesHandler>
</entry>
......
......@@ -79,16 +79,25 @@ public class AnalyseFishDistribution extends AquaNismsGroupProcess<DiadromousFis
}
// add this class to observable list
cobservable = pilot.addObservable(this.getClass());
if (cobservable == null) {
cobservable = pilot.addObservable(this.getClass());
}
}
@Override
public void doProcess(DiadromousFishGroup group) {
// update observer once a year in automn
if (group.getEnvironment().getTime().getSeason(group.getPilot()) == Season.AUTOMN)
// when initTransientParameters is not run at model loading
if (cobservable == null)
initTransientParameters(group.getPilot());
// --------------------------------------------------------------------------------------------------
// update the observers once in autumn
// ------------------------------------------------------------------------------------------------------
if (group.getEnvironment().getTime().getSeason(group.getPilot()) == Season.AUTOMN) {
cobservable.fireChanges(this, group.getPilot().getCurrentTime());
}
}
......@@ -137,7 +146,7 @@ public class AnalyseFishDistribution extends AquaNismsGroupProcess<DiadromousFis
// ========================================================
// observer to explore fish distribution
// ========================================================
@Observable(description = "Number of colonized basins")
@Observable(description = "Number of populated basins")
public double getNbPopulatedBasins() {
int nb = 0;
......
......@@ -37,9 +37,11 @@ import fr.cemagref.observation.kernel.ObservablesHandler;
import fr.cemagref.simaqualife.kernel.processes.AquaNismsGroupProcess;
import fr.cemagref.simaqualife.pilot.Pilot;
import miscellaneous.QueueMemory;
import miscellaneous.TreeMapForCentile;
import observer.ObservableRecord;
import species.DiadromousFish;
import species.DiadromousFish.Gender;
import species.DiadromousFish.Stage;
import species.DiadromousFishGroup;
/**
......@@ -183,6 +185,52 @@ public class AnalyseSpawnerFeatures extends AquaNismsGroupProcess<DiadromousFish
}
@Observable(description = "range of female ages")
public Double[] getRangeOfFemaleAge() {
return getRangeOfAge(Gender.FEMALE, defaultGroup);
}
@Observable(description = "range of male ages")
public Double[] getRangeOfMaleAge() {
return getRangeOfAge(Gender.MALE, defaultGroup);
}
public Double[] getRangeOfAge(Gender gender, DiadromousFishGroup group) {
TreeMapForCentile ageEffective = new TreeMapForCentile();
Double[] range = new Double[3];
double sum = 0;
double nb = 0;
double ageMin = 100.;
double ageMax = 0.;
for (RiverBasin riverBasin : riverBasins) {
for (DiadromousFish fish : riverBasin.getFishs(group)) {
if (fish.getStage() == Stage.MATURE & fish.getGender() == gender)
if (fish.getAge() < ageMin)
ageMin = fish.getAge();
if (fish.getAge() > ageMax)
ageMax = fish.getAge();
ageEffective.putWithAdding(fish.getAge(), fish.getAmount());
nb += fish.getAmount();
sum += fish.getAge() * fish.getAmount();
}
}
// (y, y-low, y-high) data item
// range[0] = sum / nb;
range[0] = ageEffective.calculateMedian();
range[1] = ageMin;
range[2] = ageMax;
// System.out.println(Arrays.toString(range));
return range;
}
@Observable(description = "mean age at first reproduction for female")
public double getMeanAgeOfPrimiparousFemale() {
double sum = 0;
......@@ -212,7 +260,7 @@ public class AnalyseSpawnerFeatures extends AquaNismsGroupProcess<DiadromousFish
@Observable(description = "PrimiparousRate versus latitude")
public List<Record> getPrimiparousrousRateVsLatitude() {
public List<Record> getPrimiparousRateVsLatitude() {
List<Record> records = new ArrayList<Record>();
......@@ -301,11 +349,11 @@ public class AnalyseSpawnerFeatures extends AquaNismsGroupProcess<DiadromousFish
@Information(unit = "°")
private double latitude;
@Information(unit = "#/#")
private double meanPrimarousRate;
private double meanPrimiparousRate;
public Record(double latitude, double meanPrimarousRate) {
this.latitude = latitude;
this.meanPrimarousRate = meanPrimarousRate;
this.meanPrimiparousRate = meanPrimarousRate;
}
}
......
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