Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tracker): add long tracker support #206

Merged
merged 20 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4ba3b3d
fix: specify type of images
hollandjg Dec 19, 2024
f367f48
feat(tracker): replace pairfloes with the long_tracker
hollandjg Dec 19, 2024
01131dc
fix(test): only run mktemp if DATA_TARGET isn't set
hollandjg Dec 19, 2024
3f74d4f
refactor(test): update name of DATA_ROOT from _DATA_TARGET
hollandjg Dec 19, 2024
dc1b27d
fix: add missing imports
hollandjg Dec 19, 2024
ad6928c
deps: update IceFloeTracker.jl to use version with UUID
hollandjg Dec 19, 2024
39cd1fd
Merge branch 'main' into add-long-tracker-support
hollandjg Dec 19, 2024
b9ff22f
Merge branch 'update-branch-references-in-dependencies' into add-long…
hollandjg Dec 19, 2024
e8eee5c
fix(workflow): move directives to end of tracker block
hollandjg Dec 19, 2024
e62c121
fix(workflow): add handling of UTC timestamps
hollandjg Dec 19, 2024
332fe87
fix(workflow): replace carriage returns too
hollandjg Dec 19, 2024
d0be7cc
remove extra newlines
hollandjg Dec 19, 2024
704acd7
test: make data source and target non-local again
hollandjg Dec 19, 2024
08d1f1c
Merge branch 'update-branch-references-in-dependencies' into add-long…
hollandjg Dec 19, 2024
a7ef11c
Merge branch 'update-branch-references-in-dependencies' into add-long…
hollandjg Dec 19, 2024
c3a87a8
docs(workflow): update IFT_COMMAND to include pseudo-path
hollandjg Jan 14, 2025
08b8cfc
docs(workflow): add comment on when to use the IFT_VERSION parameter
hollandjg Jan 14, 2025
f06f536
Merge branch 'add-long-tracker-support' of https://github.com/Wilhelm…
hollandjg Jan 14, 2025
c536767
Update workflow/rose-suite.conf
hollandjg Jan 22, 2025
9f44ba4
Merge branch 'main' into add-long-tracker-support
hollandjg Jan 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion IFTPipeline.jl/src/IFTPipeline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using ArgParse
using LoggingExtras
using IceFloeTracker
using IceFloeTracker: DataFrames, Dates, @dateformat_str, DataFrame, nrow, rename!, Not, select!, Date, Time, DateTime
using IceFloeTracker: RGB, Gray, load, float64, imsharpen, getlatlon, pairfloes
using IceFloeTracker: RGB, Gray, load, float64, imsharpen, getlatlon, pairfloes, add_passtimes!, addfloemasks!, addψs!, adduuid!, long_tracker
using Folds
using HDF5
using TOML: parsefile
Expand Down
11 changes: 8 additions & 3 deletions IFTPipeline.jl/src/tracker.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function track_single(;

# Load the files – can we drop the memory requirements by doing two at once?
@info "Loading $imgs"
imgs_ = [load_labeled_img(img) for img in imgs]
imgs_::Vector{Matrix{<:Integer}} = [load_labeled_img(img) for img in imgs]

@info "Loading $props"
props_ = [DataFrame(CSV.File(prop)) for prop in props]
Expand Down Expand Up @@ -140,8 +140,13 @@ function track_single(;
),
)

labeled_floes = IceFloeTracker.pairfloes(imgs_, props_, passtimes, latlon, condition_thresholds, mc_thresholds)
FileIO.save(output, labeled_floes)
add_passtimes!(props_, passtimes)
addfloemasks!(props_, imgs_)
addψs!(props_)
adduuid!(props_)

tracked_floes = long_tracker(props_, condition_thresholds, mc_thresholds)
FileIO.save(output, tracked_floes)
return nothing
end

Expand Down
25 changes: 12 additions & 13 deletions test/test-IFTPipeline.jl-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ initialize_test_directory () {
: "${DATA_SOURCE:=./input_data}"
echo "DATA_SOURCE=${DATA_SOURCE}"

TEMPDIR=$(mktemp -d -p .)
: "${DATA_TARGET:=$TEMPDIR}"
: "${DATA_TARGET:=$(mktemp -d -p .)}"
echo "DATA_TARGET=${DATA_TARGET}"

mkdir -p ${DATA_TARGET}/
Expand Down Expand Up @@ -121,25 +120,25 @@ track () {

DATA_SOURCES=$@

TEMPDIR=$(mktemp -d -p .)
: "${_DATA_TARGET:=$TEMPDIR}"
echo "_DATA_TARGET=${_DATA_TARGET}"
local DATA_ROOT
: "${DATA_ROOT:=$(mktemp -d -p .)}"
echo "DATA_ROOT=${DATA_ROOT}"

_DATA_TARGET_SUBDIRS=()
DATA_ROOT_SUBDIRS=()

for source in ${DATA_SOURCES[@]}
do
_THIS_SUBDIR=${_DATA_TARGET}/$(basename $source)/
_DATA_TARGET_SUBDIRS+=(${_THIS_SUBDIR})
_THIS_SUBDIR=${DATA_ROOT}/$(basename $source)/
DATA_ROOT_SUBDIRS+=(${_THIS_SUBDIR})
${PREPROCESS} ${source} ${_THIS_SUBDIR}
done

${IFT} track_single \
--imgs "${_DATA_TARGET_SUBDIRS[@]/%/labeled.tiff}" \
--props "${_DATA_TARGET_SUBDIRS[@]/%/labeled.props.csv}" \
--latlon "${_DATA_TARGET_SUBDIRS[1]/%/truecolor.tiff}" \
--passtimes $(cat ${_DATA_TARGET_SUBDIRS[@]/%/overpass.txt} | tr '\n' ' ') \
--output ${_DATA_TARGET}/paired.csv
--imgs "${DATA_ROOT_SUBDIRS[@]/%/labeled.tiff}" \
--props "${DATA_ROOT_SUBDIRS[@]/%/labeled.props.csv}" \
--latlon "${DATA_ROOT_SUBDIRS[1]/%/truecolor.tiff}" \
--passtimes $(cat ${DATA_ROOT_SUBDIRS[@]/%/overpass.txt} | tr '\n' ' ') \
--output ${DATA_ROOT}/paired.csv
}


Expand Down
8 changes: 4 additions & 4 deletions workflow/flow.cylc
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,6 @@
[[tracking]]
execution retry delays = PT10M
execution time limit = PT120M
[[[directives]]]
--mem = 64G
# Pair and track identified floes across days
script = """
images=(*/labeled.tiff)
Expand All @@ -261,6 +259,8 @@
--imgs ${images[@]} \
--props ${props[@]} \
--latlon ${landmasks[0]} \
--passtimes $(cat ${passtimes[@]} | tr '\n' ' ') \
--passtimes $(cat ${passtimes[@]} | tr 'Z\n\r' ' ') \
--output floes.tracked.csv
"""
"""
[[[directives]]]
--mem = 64G
8 changes: 4 additions & 4 deletions workflow/rose-suite.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ PREPROCESSING="Lopez" # "Lopez" or "Buckley"

# Lopez Ice Floe Tracker settings
# "Apptainer" or "Docker" or "Inject"
IFT_INSTALL="Inject"
# Version of the container image
IFT_VERSION="v2.0-beta.2"
IFT_INSTALL="Docker"
# Version of the container image for "Apptainer" or "Docker" install mode
IFT_VERSION="v2.0.0"
# Command to run the IFT CLI if using "Inject" install mode
IFT_COMMAND="julia --project=/workspaces/ice-floe-tracker-workspace/ice-floe-tracker-pipeline/IFTPipeline.jl /workspaces/ice-floe-tracker-workspace/ice-floe-tracker-pipeline/IFTPipeline.jl/src/cli.jl"
IFT_COMMAND="julia --project=/path/to/IFTPipeline.jl / /path/to/IFTPipeline.jl/src/cli.jl"
hollandjg marked this conversation as resolved.
Show resolved Hide resolved

# Buckley Floe Size Distribution preprocessing settings
# "Source" or "Inject"
Expand Down
Loading