Skip to content

Commit

Permalink
copying JCSDA-internal/crtm release/crtm_jedi_v2.4.1 into public.
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminTJohnson committed Apr 12, 2023
1 parent 8bf1007 commit 11faf56
Show file tree
Hide file tree
Showing 223 changed files with 34,585 additions and 6,614 deletions.
36 changes: 36 additions & 0 deletions CI/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#
# CRTM
# Copyright and License: see LICENSE

cmake_minimum_required( VERSION 3.12 )
project( crtm VERSION 2.4.1 LANGUAGES Fortran )

## Ecbuild integration
find_package( ecbuild QUIET )
include( ecbuild_system NO_POLICY_SCOPE )
ecbuild_declare_project()
list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
set( CMAKE_DIRECTORY_LABELS ${PROJECT_NAME} )

## Configuration options
include( ${PROJECT_NAME}_compiler_flags )
include(GNUInstallDirs)

## Dependencies
find_package( OpenMP COMPONENTS Fortran )
find_package( NetCDF REQUIRED COMPONENTS Fortran )

## Sources
add_subdirectory(src)
add_subdirectory(test)


## Finalise configuration
# prepares a tar.gz of the sources and/or binaries
ecbuild_install_project( NAME crtm )

# print the summary of the configuration
ecbuild_print_summary()

include(cmake/cdash-integration.cmake)
include(CTest)
107 changes: 107 additions & 0 deletions CI/buildspec_clang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@

version: 0.2

env:
shell: bash
parameter-store:
GIT_USER: "/CodeBuild/Git_USER"
GIT_PASS: "/CodeBuild/Git_PASS"

phases:
install:
commands:
- echo Executing install phase
- echo $CODEBUILD_RESOLVED_SOURCE_VERSION
- echo $CODEBUILD_SOURCE_REPO_URL
- echo $CODEBUILD_SOURCE_VERSION

- echo $CODEBUILD_WEBHOOK_MERGE_COMMIT
- echo $CODEBUILD_WEBHOOK_PREV_COMMIT
- echo $CODEBUILD_WEBHOOK_HEAD_REF
- echo $CODEBUILD_WEBHOOK_ACTOR_ACCOUNT_ID
- echo $CODEBUILD_WEBHOOK_EVENT
- echo $CODEBUILD_WEBHOOK_TRIGGER
- echo $CODEBUILD_WEBHOOK_BASE_REF

# Codebuild only runs on PUSH events if HEAD_REF
# is refs/heads/develop (merge to develop). In this
# case CODEBUILD_GIT_BRANCH="develop"

- if [ "$CODEBUILD_WEBHOOK_EVENT" = "PUSH" ];
then export CODEBUILD_GIT_BRANCH="develop";
echo "Merging to develop";
else export CODEBUILD_GIT_BRANCH=${CODEBUILD_WEBHOOK_HEAD_REF#refs/heads/};
fi

- if [ "$CODEBUILD_WEBHOOK_BASE_REF" = "refs/heads/develop" ];
then echo "base is develop";
export FALLBACK_BRANCH="develop";
else echo "base is release/crtm_jedi";
export FALLBACK_BRANCH="release/crtm_jedi";
fi


- echo "CODEBUILD_GIT_BRANCH=${CODEBUILD_GIT_BRANCH}"
- echo "FALLBACK_BRANCH=${FALLBACK_BRANCH}"
- echo "CODEBUILD_SOURCE_VERSION=${CODEBUILD_SOURCE_VERSION}"

- mkdir /jcsda
- git lfs install # creates .gitconfig
- cd CI
- ./clone.sh $GIT_USER $GIT_PASS jcsda-internal/crtm $CODEBUILD_GIT_BRANCH crtm /jcsda $FALLBACK_BRANCH

pre_build:
commands:
- pwd
- echo $CODEBUILD_SRC_DIR
- mkdir /jcsda/build

# Upload branch name and commit sha as CodeBuild artifact to S3
- mkdir -p /jcsda/artifacts
- echo ${CODEBUILD_GIT_BRANCH} > /jcsda/artifacts/branch_name.txt
- echo ${CODEBUILD_RESOLVED_SOURCE_VERSION} > /jcsda/artifacts/commit_sha.txt

build:
on-failure: CONTINUE
commands:
- echo Executing build phase
- echo $CODEBUILD_BUILD_SUCCEEDING
- export BUILD_STATUS="0"
- echo $BUILD_STATUS
#- ./Set_CRTM_Environment.sh
- cd /jcsda/build
- ecbuild -Wno-dev -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCDASH_OVERRIDE_GIT_BRANCH=$CODEBUILD_GIT_BRANCH -DCTEST_UPDATE_VERSION_ONLY=FALSE /jcsda/crtm
- make -j4

- if [ "$CODEBUILD_BUILD_SUCCEEDING" = "1" ];
then export BUILD_STATUS="1";
echo "Build passed";
fi
- echo $BUILD_STATUS
- ctest -VV -R get_crtm_coeffs
- ctest -C RelWithDebInfo -D ExperimentalTest

finally:
- ctest -C RelWithDebInfo -D ExperimentalSubmit -M Continuous -- --track Continuous --group Continuous

post_build:
commands:
- echo Executing post_build phase
- echo $CODEBUILD_BUILD_SUCCEEDING
- echo $BUILD_STATUS

# upload find cdash url and upload it as CodeBuild artifact to S3
- if [ "$BUILD_STATUS" = "1" ];
then echo "Build & tests passed, find cdash url";
bash $CODEBUILD_SRC_DIR/CI/cdash-url.sh $CODEBUILD_SRC_DIR/build/Testing;
url=$(bash $CODEBUILD_SRC_DIR/CI/cdash-url.sh $CODEBUILD_SRC_DIR/build/Testing);
echo $url;
echo ${url} > /jcsda/artifacts/cdash-url.txt;
cat /jcsda/artifacts/cdash-url.txt;
else echo "Build failed";
fi

artifacts:
files:
- '/jcsda/artifacts/*'
name: crtm-clang-url
8 changes: 8 additions & 0 deletions CI/cdash-url.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

dir=$1
tag=$(head -1 $dir/TAG)
Done=$(cat $dir/$tag/Done.xml)
buildID=$(echo $Done | grep -o -P '(?<=buildId>).*(?=</build)')
URL=http://cdash.jcsda.org:8080/viewTest.php?buildid=$buildID
echo $URL
63 changes: 63 additions & 0 deletions CI/clone.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash

# clones specific branch of a given repo
# if branch does not exist clones develop

git_user=$1
git_token=$2
org_repo_name=$3
branch_name=$4
save_name=$5
save_dir=$6
branch_name_default=$7

repo_name="$(cut -d'/' -f2 <<<$org_repo_name)"
org_name="$(cut -d'/' -f1 <<<$org_repo_name)"


if [ "${branch_name}" = "develop" ] || [ "${branch_name}" = "master" ]; then

echo "merging into develop or master"
branch_name_clone=${branch_name_default}
org_repo_name_clone=${org_name}
echo "==============================================================================="
echo " Merge into develop or master"
echo " Clone " $org_repo_name_clone "/" $repo_name
echo "==============================================================================="
git clone -b $branch_name_clone https://$git_user:$git_token@github.com/$org_repo_name_clone/$repo_name $save_dir/$save_name

else

# check jcsda-internal for branch
git ls-remote --heads --exit-code https://$git_user:$git_token@github.com/jcsda-internal/$repo_name $branch_name
exit_code_internal=$?

git ls-remote --heads --exit-code https://$git_user:$git_token@github.com/jcsda/$repo_name $branch_name
exit_code=$?

# if branch exists in both jcsda-internal and jcsda it will clone jcsda-internal
# it searches in jcsda only if org_name is jcsda

if test "${exit_code_internal}" == "0"; then
echo ${branch_name} " branch found in jcsda-internal"
branch_name_clone=${branch_name}
org_repo_name_clone="jcsda-internal"

# search in jcsda only if cloning from jcsda
elif [ "${exit_code}" == "0" ] && [ "${org_name}" == "jcsda" ]; then
echo ${branch_name} " branch found in jcsda"
branch_name_clone=${branch_name}
org_repo_name_clone="jcsda"

else
echo ${branch_name} " branch does not exist in jcsda-internal or jcsda"
echo "clone " ${branch_name_clone}
branch_name_clone=${branch_name_default}
org_repo_name_clone=${org_name}
fi
echo "==============================================================================="
echo "Clone " $org_repo_name_clone "/" $repo_name " branch " $branch_name_clone
echo "==============================================================================="
git clone --depth 1 -b $branch_name_clone https://$git_user:$git_token@github.com/$org_repo_name_clone/$repo_name $save_dir/$save_name

fi
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright and License: see LICENSE

cmake_minimum_required( VERSION 3.12 )
project( crtm VERSION 2.4.0 LANGUAGES Fortran )
project( crtm VERSION 2.4.1 LANGUAGES Fortran )

## Ecbuild integration
find_package( ecbuild QUIET )
Expand All @@ -24,10 +24,13 @@ find_package( NetCDF REQUIRED COMPONENTS Fortran )
add_subdirectory(src)
add_subdirectory(test)


## Finalise configuration
# prepares a tar.gz of the sources and/or binaries
ecbuild_install_project( NAME crtm )

# print the summary of the configuration
ecbuild_print_summary()

include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cdash-integration.cmake)
include(CTest)
6 changes: 6 additions & 0 deletions CTestConfig.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set(CTEST_PROJECT_NAME "crtm")
set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
set(CTEST_SUBMIT_URL "http://cdash.jcsda.org:8080/submit.php?project=${CTEST_PROJECT_NAME}")
set(CTEST_USE_LAUNCHERS 1)
set(ENV{CTEST_USE_LAUNCHERS_DEFAULT} 1)
set(CTEST_LABELS_FOR_SUBPROJECTS crtm)
12 changes: 7 additions & 5 deletions Get_CRTM_Binary_Files.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
filename="fix_REL-2.4.0.tgz" #rel 2.4.0 files
#foldername="fix_REL-2.4.0" #rel 2.4.0 files
foldername="fix_REL-2.4.1_latest"

filename="${foldername}.tgz"
if test -f "$filename"; then
if [ -d "fix/" ]; then #fix directory exists
echo "fix/ already exists, doing nothing."
else
#untar the file and move directory to fix
tar -zxvf $filename
mv fix_crtm-internal_develop fix
mv $foldername fix
echo "fix/ directory created from existing $filename file."
fi
else
#download, untar, move
echo "downloading $filename, please wait about 5 minutes (3.2 GB tar file)"
wget -q ftp://ftp.ssec.wisc.edu/pub/s4/CRTM/$filename #jedi set of CRTM binary files
echo "downloading $filename, please wait about 5 minutes (3.3 GB tar file)"
wget -q ftp://ftp.ssec.wisc.edu/pub/s4/CRTM/$filename # CRTM binary files
tar -zxvf $filename
mv fix_crtm-internal_develop fix
mv $foldername fix
echo "fix/ directory created from downloaded $filename."
fi
echo "Completed."
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The Community Radiative Transfer Model (CRTM) v2.4.0 by Various Authors
The Community Radiative Transfer Model (CRTM) v2.4.1 by Various Authors

To the extent possible under law, the author(s) have dedicated all
copyright and related and neighboring rights to this software to the
Expand Down
Loading

0 comments on commit 11faf56

Please sign in to comment.