colinsheppard / insalmo Goto Github PK
View Code? Open in Web Editor NEWThe Individual-Based Salmon Stream Model
License: GNU General Public License v2.0
The Individual-Based Salmon Stream Model
License: GNU General Public License v2.0
Trout.m line 1291: move statement “fishFeedingStrategy = Guarding” up to after line 1277 (before the cell is told to calculate available spawning area).
Explore ways to better distinguish redds vs. adults. Filled rectangle for adults? See Swarm doc. for GUI/Raster.
Let's go with my old favorite: PeachPuff
TimeSeriesInputManager reads .csv files, but only by determining from the file name whether the file is or is not .csv. That seems a little dangerous to me; in fact, if you change the flow file name from ".csv" to ".dat" it reads all the flows as zeros and keeps going.
I was hoping that the user didnt have to care whether it's csv or not, the code would just deal with it.
TroutModelSwarm.m readFishInitializationFiles: Change this declaration: char number[4]; to this: char number[10];
In PolyCell.m, delete line 634 (which multiplies cell area by 10,000). It’s wrong because we already converted polygon coordinates from meters to cm.
ObserverSwarm –writeFrame: un-comment the block “if([habitatRasterList getCount] > 0)”. Uncomment “id raster = nil;”.
ObserverSwarm –buildObjects: after this statement:
[habitatRasterMap at: habitatSpace insert: polyWorldRaster];
add this one: [habitatRasterList addLast: polyWorldRaster];
Submitted for inSTREAM too.
We need to specify what fraction of initial spawners each year is female- apparently it varies a lot and there is often data on it.
a) Add a new variable to the spawner initialization file, fracFemale. Make it the 3rd value on each line (after number of spawners).
b) When creating spawners, calculate exactly how many are female and male, instead of assigning sex randomly. Check the value of fracFemale to make sure it is between zero and 1.0. (0.0 and 1.0 are allowed.)
Check setup files for old stuff, e.g., "instream" in Species.Setup
Incorporate the checks mentioned in the inSTREAM documentation. (or suggest other ones). See Sect. 3.4 of attached documentation (in email from Steve 4/12/11).
Observer.Setup: raster zoom factor and rasterResolution seem to do nothing and need to be cleaned out.
We want to get rid of rasterResolution because it is never used for anything. rasterResolution is used to set a variable polyRasterSize but that variable is never used. rasterResolution is also passed from TroutObserverSwarm to TroutModelSwarm (in two places) and frmo there to HabitatManager to HabitatSpace to PolyCell. But none of these seem to use it.
Raster zoom factor: So, our display rasters are Swarm class ZoomRaster, which supposedly lets you zoom in and out but we never implemented the code (which would be pretty complicated, apparently) to draw stuff correctly. I think the best thing would be to change its class to Raster and get rid of ZoomFactor. THIS CHANGE WAS MADE 5/10/2011
interested in seeing # of outmigrants over 5cm who leave by reach
Check, doc., publish new versions of EcoSwarm classes that use .csv, etc..
When the model runs for > 1 year, the adults for 2nd+ years are not initialized. This should require just a bit of complexity added to troutModelSwarm createInitialSpawners...
Change the name of the create method for fixed columns from "createBegin" to:
createBeginWithFixedColumns:
forList: etc.
Change the name of the create method for CSV from "createBegin" to:
createBeginWithCSV: etc.
And a fix: If you use the non-CSV create method, the breakout columns are still written with commas. Headers and data columns are written correctly with fixed column width. I am pretty sure the problem is in the new code for writing output from anAverager in the method -output. Need to either use floatFormatString (which is different for CSV vs. columns) or else add some logic using isCSV.
The experiment manager uses instanceName = NONE for a parameter change to affect all instances of teh class. Change code so that "None" and "none" etc. also work.
Ready-to-spawn does not appear limited by habitat variable maxSpawnFlow...it should.
The code for barriers will not work in this version. We need to:
a) If barriers appear in Reach.Setup per sect. 20.2.3 of inSTREAM documentation, then raise an error that says barriers don't work in this version.
b) Remove Barrier.hm from code directory and Makefile
refactor ... I would like to change the class "Trout" to "Fish", in part so that when you pop up a probe to a fish it doesn't say "Trout". (Makes it look like we copied the code...) I am a little worried that globally replacing "Trout" with "Fish" may create some duplicate variable and method names, etc. Maybe try it but be careful.
Juvenile salmon seem to appear at the upstream (left) end of reach 3A when they shouldn't: There are no redds in that end of the reach and they cannot move there from upstream. Run with ~5 adults initialized. How do they get there?
This was fixed by commit e4ff8eb
See which of the optional output files listed in Sect. 24 of the inSTREAM manual need fixing-- e.g., they no longer work, or need their format updated to remove "transect number" etc.
Same or similar fixes will be needed in inSTREAM.
Things still to do:
FoodAvailability: Add the reach name as a column just before cell number (now that we have multiple reaches).
For the following, if it is easy to add the metadata (run time & date) at the top please do:
Spawn_Cell (Trout.h)
MoveTest (Trout.h)
ReadyToSpawn (Trout.h)
CellDepthAreaVelocity (HabitatManager.h)
For the Habitat.rpt (#define HABITAT_REPORT_ON in HabitatManager.h):
Finally, for all these could you change the file names from *.csv to *Out.csv. That way we can delete them all (without deleting the .csv input files) via "rm *Out.csv"
Thanks!
07/21/2007 Scenario 1 Replicate 2 Number of live fish = 1
07/22/2007 Scenario 1 Replicate 2 Number of live fish = 1
This happened in running standard input, 2 replicates.
07/23/2007 Scenario 1 Replicate 2 Number of live fish = 1
07/24/2007 Scenario 1 Replicate 2 Number of live fish = 1
07/25/2007 Scenario 1 Replicate 2 Number of live fish = 1
WARNING: Trout >>>> moveToMaximizeExpectedMaturity >>>> habDownstreamLinksToUS all have zero depth >>>> juvenile staying in reach ClearCreek-3A
*** event raised for error: InvalidCombination
UniformUnsignedDist: Requested random number with range 4294967295,
but your generator only supports a range of 4294967294
*** execution terminating due to error
Symbol.m:187 -[Error(c) _raiseEvent:]
Aborted
Here's a cleanup you could please do to inSALMO to keep it from driving people nuts in Windows. I globally changed "ReddSuperImp_" to "ReddSuperimp_" (small "i" instead of "I", because when one fish builds a redd on top of another redd, it is "superimposition", although nontechnically it is also a super imposition.)
But somehow there are still two files in there called ReddSuperImpXXX.h. When you un-tar the package in Windows, it overwrites the good file ReddSuperimpxxx with the old file ReddSuperImpXXX. THen it won't compile.
So if you could just find and delete the two files with capital I in their name...
FishCell has unused method calcDepthAndVelocityWithIndex. Why don’t we use it? (To understand this, see documentation for EcoSwarm InterpolationTable)
Applies also to inSTREAM.
makefile, change the executable to “insalmo.exe”
Is there a place in the repository for the standard input files? Could be a separate branch or something for each model. That would be nice.
add the number of redds in a cell to cell probe map.
Change the population bar graph to a line graph showing number by size class.
You could also trim out some of the print statements that aren't really necessary any more. It's nice to see the major steps as the model gets built, and a few lines at the end of a run to know whether the experiment is all done, but other stuff we could get rid of.
multi-year runs don’t work: the model doesn't create the adults for years after the first. Is this easy to fix (should be)?
This may have already been fixed: HydraulicFileReader crashes if there is white space (tabs, at least) at the end of a line.
Also: the documentation says that the code makes these checks, not all of which are implemented yet:
The software makes several checks when reading in the cell hydraulics
file:
• The cell numbers must correspond with those in the cell geometry
file: each cell defined in the geometry file receives hydraulic input
and there are no cells in the hydraulic file but not in the geometry file.
• The flows on line 3 must be in order of increasing magnitude.
• The number of values on each row of hydraulic input (file lines 5 and
higher) must equal one (the cell number) plus two times the number
of flows defined line 3.
• There must be no negative velocities.
• Any negative depth values are set to zero (some hydraulic models as-
sign negative depths to locations above the water level).
(submitted for inSTREAM too.)
Colin drafted new code to avoid scientific notation but need to make sure they work for very small numbers.
Get rid of warning:
EcoAvenger.m:85: warning: assignment from incompatible pointer type
get rid of the population initialization date variable in Model.Setup
Also: the color variables for tagging cells, dry cells, etc. should be in Observer.Setup instead of Model.Setup.
You will have to check what code you will have to add or remove so those values get to wherever they are used.
(Added SFR 4/22/2011)
TroutModelSwarm.m for inSALMO: in moveSpawnersToLiveFish and createSpawners, determine whether it's time for a spawner to appear via [spawner getArrivalTime] not month and day. (Artifact of problems SteveJ had.)
Both FishCell and PolyCell have methods getPolyCellDepth. Put in FishCell.Velocity update is in FishCell but depth update is in PolyCell. Put both in FishCell. PolyCell should only have geometry and color stuff. Look for other redundancies/confusion. (FishCell is a subclass of PolyCell.)
Also applies to inSTREAM.
The troutModelSwarm -drop method does not drop all the new stuff added for salmon. One example I noted was the outmigrantReporter. I suppose you could grep for "create" to see what we create, and see what of it is not dropped. Should be only a few things that are clearly salmon-related.
Re-instate date criteria in spawning. Needs to be added to code and parameter file; parameter table in document. Is included in document.
Gcc warnings “ignoring return value of fgets” What is this? (Did not occur in older versions of gcc)
HabitatSpace drop: It looks like we’re trying to drop a lot of stuff that is never used (cornerCoords etc.) or drop stuff twice. And in PolyCell -drop we’re trying to drop something we’re not using, which causes warning statements at end of run.
Clean out junk we do't need, etc.
Submitted for instream too.
Add a check that changes the format for floats to exponential if the number is too small or too big to fit in floating point format.
Remove code for calculating number of piscivorous trout.
FishCell.m initializeSurvProb: remove logistic prob for piscivorous fish density from aquatic predation survival.
FishCell.hm: Remove method get piscivorousFishDensity.
HabitatSpace.hm: Remove methods calcPiscivorousFishDensity, incrementNumPiscivorousFish, updateHabSurvProbForAqPred, calcPiscivorousFishDensity, getPiscivorousFishDensity; iVars numPiscivorousFish, piscivorousFishDensity
?? FishCell updateHabSurvForAqPred
Trout moveToMaximizeSurvival and moveInReachToMaximizeSurvival: remove code to set piscivory and call [troutModel updateHabSurvProbs]
ModelSwarm.hm: remove method toggleFishForHabSurvUpdate. Remove iVars minSpeciesMinPiscLength, fishForHabSurvUpdate
In the optional output files (not: live fish; dead fish; redds; outmigrants), revert to the previous output format: scientific notation for floats. With these files, we are not worried about readability but need the full precision for code-testing.
The method FishCell setHabShelterSpeedFrac is not called, so the cell variable habShelterSpeedFrac is never updated from its initial value of zero. Best solution seems to be to get rid of this cell variable and have FishCell just get this reach variable from its space.
replace ReddSuperimpFunc.m with one that considers available unguarded gravel. Update documentation. Steve will send this file separately, see email around 4/13/11.
Can the cell data file (cellHabVarsFile) be in .csv format? Apparently not: HabitatSpace - readPolyCellDataFile. I suppose it should, to be consistent with other files. (But not the cell geometry file; it's in a ARC-GIS format.)
Output file Redds.out: (a) get rid of header for “Transect Number” (transects no longer exist in this version. they were eliminated from the output lines but not the header). (b) make the output .csv format.
There also seems to be a header for spawnerLength but no corresponding data output. Include length results. (Added SFR 4/21/11)
SFR 4/23: I did everything except convert the output format to .csv
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.