Skip to content

Commit

Permalink
Merge pull request #198 from WilhelmusLab/merge-attempt-1
Browse files Browse the repository at this point in the history
feat: add Buckley's preprocessing to the pipeline
  • Loading branch information
hollandjg authored Dec 17, 2024
2 parents 2e0e2f7 + a1766f4 commit 005f8ff
Show file tree
Hide file tree
Showing 112 changed files with 3,983 additions and 1,525 deletions.
2 changes: 2 additions & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
style = "blue"
indent = 4
5 changes: 5 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM mcr.microsoft.com/devcontainers/base:debian

RUN apt-get update
RUN apt-get install -y software-properties-common
RUN apt-get install -y gdal-bin libgdal-dev libgtk-3-dev graphviz
38 changes: 38 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "Ice Floe Tracker Pipeline",

"build": {
"dockerfile": "Dockerfile"
},

"features": {
"ghcr.io/julialang/devcontainer-features/julia:1": {
"channel": "lts"
},
"ghcr.io/devcontainers/features/python:1": {
"installTools": true,
"version": "3.11"
},
"ghcr.io/devcontainers-contrib/features/pipx-package:1": {
"includeDeps": true,
"package": "cylc-rose",
"interpreter": "python3.11"
},
"ghcr.io/devcontainers/features/docker-in-docker:2": {}

},

"customizations": {
"vscode": {
"extensions": [
"ms-azuretools.vscode-docker",
"github.vscode-github-actions",
"mechatroner.rainbow-csv",
"analytic-signal.preview-tiff",
"cylc.vscode-cylc"
]
}
},

"postCreateCommand": ""
}
Empty file added .dockerignore
Empty file.
23 changes: 19 additions & 4 deletions .github/workflows/build-docker-julia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ on:
- 'main'
tags:
- 'v*.*.*'
pull_request:
branches:
- 'main'
pull_request:
workflow_dispatch:

env:
REGISTRY: hub.docker.com
IMAGE_NAME: brownccv/icefloetracker-julia
TEST_TAG: brownccv/icefloetracker-julia:test

jobs:
build_and_push:
Expand All @@ -39,6 +38,20 @@ jobs:
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}

- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
load: true
tags: ${{ env.TEST_TAG }}
build-args: |
JULIA_CPU_TARGET=generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1);x86-64-v4,-rdrnd,base(1)
- name: Test CLI
working-directory: ./test
run: source ./test-IFTPipeline.jl-cli.sh && IFT="docker run -v `pwd`:/app -w /app --rm ${{ env.TEST_TAG }}" preprocess_lopez input_data/ne-greenland.20220914.terra.250m

- name: Build and push Docker image
uses: docker/build-push-action@v6
Expand All @@ -47,4 +60,6 @@ jobs:
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
JULIA_CPU_TARGET=generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1);x86-64-v4,-rdrnd,base(1)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# from https://docs.github.com/en/actions/guides/publishing-docker-images

name: Build and PushContainer - Fetchdata
name: Build and PushContainer - SOIT
on:
push:
branches:
Expand All @@ -13,7 +13,8 @@ on:

env:
REGISTRY: hub.docker.com
IMAGE_NAME: brownccv/icefloetracker-fetchdata
IMAGE_NAME: brownccv/icefloetracker-soit
TEST_TAG: brownccv/icefloetracker-soit:test

jobs:
build_and_push:
Expand All @@ -39,11 +40,29 @@ jobs:
with:
images: ${{ env.IMAGE_NAME }}

- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: ./satellite-overpass-identification-tool
platforms: linux/amd64
load: true
tags: ${{ env.TEST_TAG }}

- name: Test SOIT
run: |
docker run -v `pwd`:/app -w /app --rm ${{ env.TEST_TAG }} \
-u ${{ secrets.SPACEUSER }} -p ${{ secrets.SPACEPSWD }} \
--startdate 2013-03-31 --enddate 2013-05-01 \
--lat 76.0015 --lon -18.4315 \
--csvoutpath .
- name: Build and push Docker image
uses: docker/build-push-action@v6
uses: docker/build-push-action@v5
with:
context: ./workflow/scripts
context: ./satellite-overpass-identification-tool
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

22 changes: 13 additions & 9 deletions .github/workflows/test-soit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9

- name: Install dependencies
run: pip install -r requirements.txt
- name: Run SOIT with a directory
run: |
pipx run --spec ./satellite-overpass-identification-tool soit \
--SPACEUSER ${{ secrets.SPACEUSER }} --SPACEPSWD ${{ secrets.SPACEPSWD }} \
--startdate 2013-03-31 --enddate 2013-05-01 \
--lat 76.0015 --lon -18.4315 \
--csvoutpath .
- name: Run SOIT
- name: Run SOIT with a particular path
run: |
python ./workflow/scripts/pass_time_cylc.py -u ${{ secrets.SPACEUSER }} -p ${{ secrets.SPACEPSWD }} --startdate 2013-03-31 --enddate 2013-05-01 --lat 76.0015 --lon -18.4315 --csvoutpath .
pipx run --spec ./satellite-overpass-identification-tool soit \
--SPACEUSER ${{ secrets.SPACEUSER }} --SPACEPSWD ${{ secrets.SPACEPSWD }} \
--startdate 2013-03-31 --enddate 2013-05-01 \
--lat 76.0015 --lon -18.4315 \
--csvoutpath tracker-results.csv
18 changes: 7 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,21 @@ jobs:
arch: x64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: update pip
run: python -m pip install -U pip
- name: install python deps
run: python -m pip install -U -r requirements.txt
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v2
- run: julia --project=PythonSetupForIFTPipeline.jl PythonSetupForIFTPipeline.jl/setup.jl
- uses: julia-actions/julia-buildpkg@v1
env:
PYTHON: python
with:
project: IFTPipeline.jl
- uses: julia-actions/julia-runtest@v1
env:
PYTHON: python
with:
project: IFTPipeline.jl
- uses: julia-actions/julia-processcoverage@v1
with:
directories: IFTPipeline.jl/src
- uses: codecov/codecov-action@v4
with:
files: lcov.info
8 changes: 1 addition & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Manifest.toml

resources/*
!resources/README.md

Expand All @@ -10,8 +8,6 @@ workflow/cylc-run/*
workflow/report/*
!workflow/report/README.md

test/__temp__

icetest.sh
trackplayground.jl

Expand All @@ -20,6 +16,4 @@ trackplayground.jl

*.simg

.JuliaFormatter.toml

test/test_inputs/input_pipeline/*.jls
runtime/
9 changes: 9 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Development Guide

We have found VSCode to be a good IDE for development. You can use the [devcontainer](https://code.visualstudio.com/docs/devcontainers/containers) configuration to initialize a virtual machine with the Julia, Python and the geospatial dependencies for this project.

Before running any Julia code for the first time, follow the instructions in
[PythonSetupForIFTPipeline.jl](./PythonSetupForIFTPipeline.jl/README.md)
to initialize a working Conda environment.

Follow the instructions in [IFTPipeline.jl](./IFTPipeline.jl/) to run the tests of the pipeline.
43 changes: 22 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
FROM julia:1.9-bookworm
ENV TERM=xterm
ENV JULIA_PROJECT=/opt/ice-floe-tracker-pipeline
ENV JULIA_DEPOT_PATH=/opt/julia
ENV JULIA_PKGDIR=/opt/julia
ENV JULIA_BUILD='ENV["PYTHON"]=""; using Pkg; Pkg.build()'
ENV IFTPIPELINE_REPO='https://github.com/WilhelmusLab/ice-floe-tracker-pipeline.git'
ENV LOCAL_PATH_TO_IFT_CLI='/usr/local/bin/ice-floe-tracker.jl'
FROM --platform=$BUILDPLATFORM julia:1.11-bookworm
ARG TARGETARCH
ARG JULIA_CPU_TARGET="generic"
ENV JULIA_CPU_TARGET=${JULIA_CPU_TARGET}

WORKDIR /opt
# Dependencies
#===========================================
ENV TERM=xterm

# DEPENDENCIES
# Python environment build
#===========================================
RUN apt-get -y update && \
apt-get install -y git python3.10 && \
rm -rf /var/lib/apt/list/*
ENV CONDA_JL_HOME=/opt/conda
ENV JULIA_DEPOT_PATH=/opt/julia
COPY ./PythonSetupForIFTPipeline.jl /opt/PythonSetupForIFTPipeline.jl
RUN julia --project="/opt/PythonSetupForIFTPipeline.jl" "/opt/PythonSetupForIFTPipeline.jl/setup.jl"

# Julia package build
# IFT Pipeline package build
#===========================================
COPY ./IFTPipeline.jl /opt/IFTPipeline.jl
RUN julia --project="/opt/IFTPipeline.jl" -e "using Pkg; Pkg.instantiate(); Pkg.precompile();"

# Test the package
# RUN julia --project="/opt/IFTPipeline.jl" -e "using Pkg; Pkg.test();"

RUN git clone --single-branch --branch main --depth 1 ${IFTPIPELINE_REPO}
RUN /usr/local/julia/bin/julia --project=${JULIA_PROJECT} -e ${JULIA_BUILD}
RUN /usr/local/julia/bin/julia --project=${JULIA_PROJECT} -e 'using Pkg; Pkg.instantiate()'
COPY workflow/scripts/ice-floe-tracker.jl ${LOCAL_PATH_TO_IFT_CLI}
RUN chmod a+x ${LOCAL_PATH_TO_IFT_CLI}
ENV JULIA_DEPOT_PATH="/usr/local/bin/julia:$JULIA_DEPOT_PATH"
CMD [ "/bin/bash", "-c" ]
# CLI setup
#===========================================
SHELL ["/bin/bash", "-c"]
ENTRYPOINT ["julia", "--project=/opt/IFTPipeline.jl", "/opt/IFTPipeline.jl/src/cli.jl" ]
Loading

0 comments on commit 005f8ff

Please sign in to comment.