Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
Initial upload of files from the zip archive. This does not include the .nc files as they are too large.
  • Loading branch information
seth-noaa authored Apr 1, 2024
1 parent 3cb29cb commit 5eec664
Show file tree
Hide file tree
Showing 92 changed files with 1,054,619 additions and 17 deletions.
33 changes: 33 additions & 0 deletions ABC_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
## Job Name
#SBATCH --job-name=chinook_test_9thread
## Allocation Definition
#SBATCH --account=stf
#SBATCH --partition=stf
## Resources
## Nodes
#SBATCH --nodes=1
## Tasks per node (Slurm assumes you want to run 28 tasks, remove 2x # and adjust parameter if needed)
#SBATCH --ntasks-per-node=3
## Set number of cores per task to allow multithreading
#SBATCH --cpus-per-task=9
## Walltime (two hours)
#SBATCH --time=10:00:00
# E-mail Notification, see man sbatch for options


##turn on e-mail notification

#SBATCH --mail-type=ALL

#SBATCH [email protected]


## Memory per node
#SBATCH --mem=100G
## Specify the working directory for this job
#SBATCH --chdir=/gscratch/stf/aebratt/fish_cpp_hyak

module load parallel-20170722

seq 6 | parallel -j 3 -n0 "/gscratch/stf/aebratt/fish_cpp_hyak/bin/headless ABC_test_listings.csv ABCoutput config_9thread.json"
8 changes: 8 additions & 0 deletions ABC_test_listings.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Run ID, Status (0: not run yet; 1: claimed), mort const A, mort const C
0,0,-0.42,0.03096
1,0,-0.43,0.03096
2,0,-0.44,0.03096
3,0,-0.45,0.03096
4,0,-0.46,0.03096
5,0,-0.47,0.03096
6,0,-0.48,0.03096
86 changes: 86 additions & 0 deletions CONFIG_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@

# Configuration

Default model configurations are in the files [default_config_env_sim.json](default_config_env_sim.json) and [default_config_env_from_file.json](default_config_env_from_file.json).

Parameters:
- `threadCount`: The maximum number of hardware threads to use when running the model (-1 = as many as are available)
- `envDataType`: string, either `file` or `sim`
- if `envDataType` is `file`, the following entries are expected:
- `recStartTimestep`: the number of 1-hour timesteps from midnight on January 1 to the start date/time of the recruitment data
- `hydroStartTimestep`: the number of 1-hour timesteps from midnight on January 1 to the start date/time of the hydrology input data (tide, flow volume, and air temperature)

Note: the flow speed data is assumed to start at midnight on January 1 regardless of `hydroStartTimestep`

- `recruitEntryNodes`: an array of integer map node IDs at which new recruits will originate
- `recruitCountsFile`: name of a text file containing one decimal number per line, each representing the number of recruits on a single day
- `recruitSizesFile`: name of a CSV file where each row after the first represents the distribution of recruits among 5mm size-classes for a single week
- `samplingSitesFile`: name of a CSV file where each row after the first describes a sampling site, giving its location and human-readable name
- `mapNodesFile`: name of a CSV file where each row after the first describes a map point, with relevant fields arranged as follows:

ID, _, _, _, _, area (m^2), habitat type, _, _, _, elev (m), _

- Elev is the vertical distance to NAVD88 in meters.
Habitat type is one of the following:
`blind channel`,
`impoundment`,
`low tide terrace`,
`distributary`,
`boat harbor`,
`nearshore`

- ID is one-indexed (starts from 1) in map input files but the model converts this to a zero-based index.

- `mapEdgesFile`: name of a CSV file where each row after the first describes a map edge, with relevant fields arranged as follows:

_, _, _, _, _, _, _, _, _, _, _, _, _, _, source node ID, target node ID, _, _, length (m), _

- The relevant fields are the 15th, 16th, and 19th fields.

- `mapGeometryFile`: name of a CSV file where each row after the first gives the location of a certain node.

Fields are: x, y, ID

x and y are UTM Zone 10N coordinates.

- `tideFile`: name of a text file where each line is a crescent tide height (m) measured every 15 minutes
- `flowVolFile`: name of an ASCII file where each line is a flow volume (m^3/s), measured every 15 minutes upstream from the recruitment site
- `airTempFile`: name of an ASCII file where each line is an air temperature, in degrees C, measured every 15 minutes
- `flowSpeedFile`: name of a NetCDF-3 or NetCDF-4 file where the following variables are present:

- `x`, `y`: the horizontal and vertical locations where flow velocity is given, in UTM Zone 10N coordinates

dimensions: node (arbitrary number of locations)
- `u`, `v`: the horizontal and vertical flow velocity (m/s)

dimensions: time (1hr increments, starting at midnight on January 1st), node
- `distribWseTempFile`: name of a NetCDF-3 or NetCDF-4 file where the following variables are present:

- `x`, `y`: the horizontal and vertical locations where flow velocity is given, in UTM Zone 10N coordinates

dimensions: node (arbitrary number of locations)
- `wse`: the water surface elevation (in meters, from NAVD88 datum)

dimensions: time (1hr increments, starting at midnight on January 1st), node

- `temp`: the water temperature (in degrees C)

dimensions: time (1hr increments, starting at midnight on January 1st), node

Distributary nodes retrieve flow speed, depth, and temperature from their nearest hydro node, so these nodes should be relatively dense spatially in distributary regions.

- `blindChannelSimplificationRadius`: float; the maximum distance between blind channel nodes that will result in them being merged when the map data is loaded (to speed up model prediction)
- if `envDataType` is "sim", the following entries are expected:
- `mapParams`: A subgroup of parameters containing the following keys:
- `m`: int, the number of distributary nodes per grid row/column
- `n`: int, the total number of nodes per grid row/column
- `a`: float, the distance between grid nodes in meters
- `pBlind`: float between 0 and 1, the probability of deleting a blind channel
- `pDist`: float between 0 and 1, the probability of deleting a distributary channel
- `recruitSizeMean`: float, the mean recruit size in millimeters
- `recruitSizeStd`: float, the standard deviation of recruit sizes in millimeters
- `recruitRate`: int, the average number of recruits per timestep
- `simLength`: int, the number of timesteps of environmental data to generate
72 changes: 72 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#CCEXE = /usr/local/opt/llvm/clang++
CCEXE = g++
CFLAGS = -Wall -g -std=c++11

CC = $(CCEXE) $(CFLAGS)

WXFLAGS = $(shell wx-config --cxxflags)

WXLIBS = $(shell wx-config --libs)

RAPIDJSON = -Irapidjson/include

NETCDF = -Ilocal/netcdf-cxx4/include -Ilocal/netcdf-c/include -Ilocal/hdf5/include

ABSLIB_NCCPP = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))local/netcdf-cxx4/lib

ABSLIB_NCC = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))local/netcdf-c/lib

ifeq ($(shell uname -s), Darwin)
DL_EXT = dylib
else
DL_EXT = so
endif

LINKFLAGS = -v -Llocal/netcdf-cxx4/lib -Llocal/netcdf-c/lib -lnetcdf_c++4 -lnetcdf -lpthread -pthread -Wl,-rpath,$(ABSLIB_NCCPP) -Wl,-rpath,$(ABSLIB_NCC) local/netcdf-cxx4/lib/libnetcdf_c++4.$(DL_EXT) local/netcdf-c/lib/libnetcdf.$(DL_EXT)

OBJ = $(addprefix build/, model.o hydro.o load.o fish.o map.o util.o env_sim.o map_gen.o)

headless: $(OBJ) build/headless.o bin
$(CC) $(OBJ) build/headless.o -o bin/headless $(LINKFLAGS)

gui: $(OBJ) build/gui.o bin
$(CC) $(WXLIBS) $(OBJ) build/gui.o -o bin/gui $(LINKFLAGS)

build/gui.o: src/gui.cpp src/model.h src/fish.h build
$(CC) $(WXFLAGS) -c src/gui.cpp -o build/gui.o

bin:
mkdir bin

build:
mkdir build

build/headless.o: src/headless.cpp src/model.h build
$(CC) -c src/headless.cpp -o build/headless.o

build/model.o: src/model.cpp src/model.h src/load.h src/fish.h src/map.h build
$(CC) $(RAPIDJSON) $(NETCDF) -c src/model.cpp -o build/model.o

build/hydro.o: src/hydro.cpp src/hydro.h src/map.h build
$(CC) -c src/hydro.cpp -o build/hydro.o

build/load.o: src/load.cpp src/load.h src/map.h build
$(CC) $(NETCDF) -c src/load.cpp -o build/load.o

build/fish.o: src/fish.cpp src/fish.h src/model.h src/map.h src/util.h build
$(CC) -c src/fish.cpp -o build/fish.o

build/map.o: src/map.cpp src/map.h build
$(CC) -c src/map.cpp -o build/map.o

build/util.o: src/util.cpp src/util.h build
$(CC) -c src/util.cpp -o build/util.o

build/env_sim.o: src/env_sim.cpp src/env_sim.h src/map.h build
$(CC) -c src/env_sim.cpp -o build/env_sim.o

build/map_gen.o: src/map_gen.cpp src/map_gen.h src/map.h build
$(CC) -c src/map_gen.cpp -o build/map_gen.o

clean:
rm -rdf bin/* build/*
110 changes: 110 additions & 0 deletions OUTPUT_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@

## Output Files

The model is capable of producing three different kinds of output files:

### State Snapshots

State snapshots can be saved in two ways:

- Pressing Ctrl+C to interrupt the headless model, then entering the 'save' command (with the desired filename)
- In the GUI, selecting File -> Save from the menu

State snapshots can be loaded from the GUI using the File -> Load menu item in order to load the saved state of the model.

### Sample data

Sample data files are produced by the `headless` executable, and consist of a record of statistics of population samples taken
at various sampling sites throughout the map. This data is also included in state snapshots.
Sample data is saved as `output_X.nc`, where X is the run ID.

### Summaries

Summaries are automatically saved as `summary_X.nc` by the headless executable when a simulation is finished, where X is the run ID.

### Tagged Fish Histories

Tagged fish histories can be saved from the GUI using the File -> Save Tagged History menu item. They can also be loaded in the GUI using File -> Load Tagged History in order to view a replay of the history of the tagged fish.

## Formats

All model outputs are saved as [netCDF 4](https://www.unidata.ucar.edu/software/netcdf/) files.

### State Snapshots

- Snapshot files contain the following dimensions:
- `n`: Indicates individual, for per-fish variables
- `populationHistoryLength`: Indicates timestep for population history entries
- `sampleHistoryLength`: Indicates sample number for sample history entries (not equivalent to time)

- Snapshot files contain the following variables:
- `modelTime`: int, the current model timestep
- `recruitTime[n]`: ints, each fish's entry timestep
- `exitTime[n]`: ints, each fish's exit or death timestep (only valid for a given `n` if `status[n]` is not 0, since status 0 is Alive)
- `entryForkLength[n]`: floats, fork length of each fish upon entry (mm)
- `entryMass[n]`: floats, mass of each fish upon entry (g)
- `forkLength[n]`: floats, current/final fork length of each fish (mm)
- `mass[n]`: floats, current/final mass of each fish (g)
- `status[n]`: ints, current/final status of each fish
- 0: Alive
- 1: Dead from mortality risk
- 2: Dead from stranding
- 3: Dead from starvation
- 4: Exited
- `location[n]`: ints, current/final map node ID where each fish is located
- `travel[n]`: floats, most recent timestep's swim distance for each fish (m)
- `lastGrowth[n]`: floats, most recent timestep's growth for each fish (g)
- `lastMortality[n]`: floats, most recent timestep's mortality risk for each fish (probability value)
- `populationHistory[populationHistoryLength]`: ints, per-timestep counts of living individuals in the model
- `sampleSiteID[sampleHistoryLength]`: ints, each sample's site ID
- Refer to [data/sampling_sites.csv](data/sampling_sites.csv) for a list of sample site names and coordinates. Site IDs correspond to line numbers (site ID 0 is Grain of Sand, 1 is FWP New Site, etc.)
- `sampleTime[sampleHistoryLength]`: ints, the timestep when each sample was taken
- `samplePop[sampleHistoryLength]`: ints, the number of individuals in each sample
- `sampleMeanMass[sampleHistoryLength]`: floats, each sample's mean individual mass (g)
- `sampleMeanLength[sampleHistoryLength]`: floats, each sample's mean individual fork length (mm)
- `sampleMeanSpawnTime[sampleHistoryLength]`: floats, each sample's mean individual spawn time (timesteps)

### Sample data

- Snapshot files contain the following dimensions:
- `sampleHistoryLength`: Indicates sample number for sample history entries (not equivalent to time)
- Sample data files contain the following variables:
- `sampleSiteID[sampleHistoryLength]`: ints, each sample's site ID
- Refer to [data/sampling_sites.csv](data/sampling_sites.csv) for a list of sample site names and coordinates. Site IDs correspond to line numbers (site ID 0 is Grain of Sand, 1 is FWP New Site, etc.)
- `sampleTime[sampleHistoryLength]`: ints, the timestep when each sample was taken
- `samplePop[sampleHistoryLength]`: ints, the number of individuals in each sample
- `sampleMeanMass[sampleHistoryLength]`: floats, each sample's mean individual mass (g)
- `sampleMeanLength[sampleHistoryLength]`: floats, each sample's mean individual fork length (mm)
- `sampleMeanSpawnTime[sampleHistoryLength]`: floats, each sample's mean individual spawn time (timesteps)

### Summaries

- Summary files contain the following dimensions:
- `n`: Indicates individual
- Summary files contain the following variables:
- `recruitTime[n]`: ints, each fish's entry timestep
- `exitTime[n]`: ints, each fish's exit or death timestep (only valid for a given `n` if `finalStatus[n]` is not 0, since status 0 is Alive)
- `entryForkLength[n]`: floats, fork length of each fish upon entry (mm)
- `entryMass[n]`: floats, mass of each fish upon entry (g)
- `finalForkLength[n]`: floats, current/final fork length of each fish (mm)
- `finalMass[n]`: floats, current/final mass of each fish (g)
- `finalStatus[n]`: ints, current/final status of each fish

### Tagged Fish Histories

- Tagged fish histories contain the following dimensions:
- `n`: Indicates individual
- `t`: Indicates timestep
- Tagged fish histories contain the following variables:
- `recruitTime[n]`: ints, each fish's entry timestep
- `taggedTime[n]`: ints, the timestep when each fish was tagged
- `exitTime[n]`: ints, each fish's exit or death timestep (only valid for a given `n` if `finalStatus[n]` is not 0, since status 0 is Alive)
- `entryForkLength[n]`: floats, fork length of each fish upon entry (mm)
- `entryMass[n]`: floats, mass of each fish upon entry (g)
- `finalForkLength[n]`: floats, current/final fork length of each fish (mm)
- `finalMass[n]`: floats, current/final mass of each fish (g)
- `finalStatus[n]`: ints, current/final status of each fish
- `locationHistoryOut[n, t]`: ints, the map node ID where each fish was on each timestep (or -1 if a fish wasn't in the model on the timestep in question)
- `growthHistoryOut[n, t]`: floats, the growth (g) on each timestep for each fish, or 0 if the fish wasn't in the model on the timestep in question
- `mortalityHistoryOut[n, t]`: floats, the mortality risk (probability) on each timestep for each fish, or 0 if the fish wasn't in the model on the timestep in question

Loading

0 comments on commit 5eec664

Please sign in to comment.