Skip to content
Snippets Groups Projects
Commit 897e96cd authored by xo30xoqa's avatar xo30xoqa
Browse files

Fixed skylark migration bug

closes #90
parent be69f7fe
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,27 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.5.2] - unreleased
### Added
### Changed
- input files that are now copied to a separate `inputs` directory within the output directory
- `EventType` renamed to `Management` for clarity
- `insectbiomass()` uses units
### Deprecated
### Removed
### Fixed
- all skylarks now migrate (#90)
## [v0.5.1] - 13-06-2024
### Added
......@@ -115,7 +136,7 @@ way the species definition macros work and are used.
<!-- Template
## [Unreleased] - <date>
## [version] - unreleased
<comments>
......
......@@ -126,7 +126,7 @@ As a non-breeding adult, move around with other individuals and check for migrat
month, day = monthday(model.date)
migrate = (((month < arrive[1]) || (month == arrive[1] && day < arrive[2])) ||
((month > leave[1]) || (month == leave[1] && day >= leave[2])))
if migrate #FIXME not all migrate?
if migrate
@kill(self.migrationmortality, "migration")
returndate = Date(year(model.date)+1, arrive[1], arrive[2])
@setphase(mating)
......@@ -146,9 +146,9 @@ Move around until a mate is found.
self.mate = -1
return
end
month, day = monthday(model.date)
nest = ((month == self.nestingbegin[1] && day >= self.nestingbegin[2]
&& @chance(0.05)) || (month > self.nestingbegin[1])) #XXX why the chance?
mon, day = monthday(model.date)
nest = ((mon == self.nestingbegin[1] && day >= self.nestingbegin[2]
&& @chance(0.05)) || (mon > self.nestingbegin[1])) #XXX why the chance?
nest && @setphase(nestbuilding)
return
end
......@@ -162,7 +162,11 @@ Move around until a mate is found.
end
end
#@debug("$(animalid(self)) didn't find a mate.")
@walk("random", 100m) #XXX magic number
if month(model.date) > self.nestingend # stop trying to find a mate if it's too late
@setphase(nonbreeding)
else
@walk("random", 100m) #XXX magic number
end
end
"""
......@@ -256,9 +260,9 @@ should currently be on migration. Also sets other individual-specific variables.
# calculate migration dates for this individual
self.migrationdates = migrationdates(self, model)
leave, arrive = self.migrationdates
month, day = monthday(model.date)
migrate = (((month < arrive[1]) || (month == arrive[1] && day < arrive[2])) ||
((month > leave[1]) || (month == leave[1] && day >= leave[2])))
mon, day = monthday(model.date)
migrate = (((mon < arrive[1]) || (mon == arrive[1] && day < arrive[2])) ||
((mon > leave[1]) || (mon == leave[1] && day >= leave[2])))
if migrate
returndate = Date(year(model.date), arrive[1], arrive[2])
model.date != @param(core.startdate) && (returndate += Year(1))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment