Skip to content

Commit be37916

Browse files
committed
Add scripts meant to replace some of the actions inside Dockerfiles so that this installation steps can be done inside of an interactive Jupyterlab.
1 parent b24e9a7 commit be37916

File tree

8 files changed

+150
-58
lines changed

8 files changed

+150
-58
lines changed

.dockerignore

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +0,0 @@
1-
# Ignore certain files when copying that are large and unneeded for the build context
2-
src/**/acctest/**/in/**/*.cdl
3-
src/**/acctest/**/in/**/*.nc
4-
src/**/acctest/**/in/**/*.orig
5-
src/**/acctest/**/in/**/*.PDS
6-
src/**/acctest/**/expected
7-
src/**/unittest
8-
src/**/unittests

Dockerfile.common

Lines changed: 0 additions & 21 deletions
This file was deleted.

docker-compose.yml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,15 @@
11
# ${DOCKER_GROUP} and ${DOCKER_TAG} default values defined in the .env file
22
version: '3'
33
services:
4-
sips_base:
5-
image: ${DOCKER_GROUP}/sounder_sips_base:${DOCKER_TAG}
6-
hostname: local
7-
build:
8-
context: base/
9-
dockerfile: $PWD/base/Dockerfile
10-
spss_pge_common:
11-
image: ${DOCKER_GROUP}/sounder_sips_pge_common:${DOCKER_TAG}
12-
hostname: local
13-
build:
14-
context: spss/
15-
dockerfile: $PWD/spss/Dockerfile.common
16-
spss_l1a_pge:
4+
l1a_pge:
175
image: ${DOCKER_GROUP}/sounder_sips_l1a_pge:${DOCKER_TAG}
186
hostname: local
197
build:
208
context: spss/
21-
dockerfile: $PWD/spss/Dockerfile.l1a
22-
spss_l1b_pge:
9+
dockerfile: $PWD/Dockerfile.l1a
10+
l1b_pge:
2311
image: ${DOCKER_GROUP}/sounder_sips_l1b_pge:${DOCKER_TAG}
2412
hostname: local
2513
build:
2614
context: spss/
27-
dockerfile: $PWD/spss/Dockerfile.l1b
15+
dockerfile: $PWD/Dockerfile.l1b

install/build_common.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
# Parallel build can cause the build to failr
4+
export NUM_COMPILE_JOBS=1
5+
6+
usage () {
7+
echo "Usage:"
8+
echo "$0 <source_code_directory>"
9+
exit 1
10+
}
11+
12+
src_dir=$1
13+
14+
if [ -z "$src_dir" ]; then
15+
usage
16+
fi
17+
18+
# PGE common directories
19+
cd $src_dir/src/common/make && make -j $NUM_COMPILE_JOBS
20+
cd $src_dir/src/shared_io/make && make -j $NUM_COMPILE_JOBS
21+
cd $src_dir/src/shared_alg/make && make -j $NUM_COMPILE_JOBS
22+
cd $src_dir/src/pge_wrapper/make && make -j $NUM_COMPILE_JOBS
23+
24+
# MetExtractor compilation
25+
cd $src_dir/src/scf_shared/make && make -j $NUM_COMPILE_JOBS
26+
cd $src_dir/src/scf_pge/make && make -j $NUM_COMPILE_JOBS
27+
cd $src_dir/src/scf_metextractors/make && make -j $NUM_COMPILE_JOBS

install/build_l1a.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
# Parallel build can cause the build to failr
4+
export NUM_COMPILE_JOBS=1
5+
6+
usage () {
7+
echo "Usage:"
8+
echo "$0 <source_code_directory> [<destination_binary_directory>]"
9+
exit 1
10+
}
11+
12+
src_dir=$1
13+
dst_dir=$2
14+
15+
if [ -z "$src_dir" ]; then
16+
usage
17+
fi
18+
19+
cd $src_dir/src/sips_pge/l1a_atms/make && make -j $NUM_COMPILE_JOBS
20+
21+
if [ ! -z "$dst_dir" ]; then
22+
mkdir -p $dst_dir
23+
cp $src_dir/src/sips_pge/l1a_atms/pge/bin/L1AMw_main $dst_dir
24+
cp $src_dir/src/scf_metextractors/main/bin/MetExtractor $dst_dir
25+
fi
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
3+
script_dir=$(dirname $0)
4+
5+
src_dir=$1
6+
dst_dir=$2
7+
static_dir=$3
8+
9+
if [ -z "$src_dir" ]; then
10+
usage
11+
fi
12+
13+
if [ -z "$dst_dir" ]; then
14+
usage
15+
fi
16+
17+
if [ ! -e "$dst_dir" ]; then
18+
mkdir -p $dst_dir
19+
fi
20+
21+
if [ -z "$static_dir" ]; then
22+
static_dir=$DEFAULT_STATIC_FILES_DIR
23+
fi
24+
25+
# Copy SDPTK toolkit files
26+
cp $script_dir/../ephemeris/leapsec.dat $dst_dir
27+
cp $script_dir/../ephemeris/utcpole.dat $dst_dir
28+
29+
# Copy files from acceptance test directories, these are referenced by the input XML file
30+
cp $src_dir/src/sips_pge/l1a_atms_snpp/acctest/in/pcf/SNDR.PGSToolkit_ProcessControlFile.pcf $dst_dir
31+
cp $src_dir/src/sips_pge/l1a_atms_snpp/acctest/in/SNDR.SNPP.ATMS.L1A.sfif_201214135000.xml $dst_dir
32+
cp $src_dir/src/sips_pge/l1a_atms_snpp/acctest/in/SNDR.SchemaParameterfile.060401120000.xsd $dst_dir
33+
34+
# Modify SFIF file to point to destination paths
35+
sed -i 's|../../../static|'$dst_dir'|' $dst_dir/SNDR.SNPP.ATMS.L1A.sfif_201214135000.xml
36+
37+
# Modify to point leapsec.dat and utcpole.dat to our configuration static dir
38+
sed -i -e 's|utcpole_20201220.dat|utcpole.dat|' \
39+
-e 's|../../in/pcf|'$dst_dir'|' \
40+
-e 's|~/database/common/TD|'$dst_dir'|' \
41+
$dst_dir/SNDR.PGSToolkit_ProcessControlFile.pcf
42+
43+
# Modify to point DEMs to a path controlled by Docker
44+
sed -i -e 's|/peate/support/static/dem|'$static_dir'/dem|' \
45+
-e 's|/ref/devstable/STORE/mcf|'$static_dir'/mcf|' \
46+
$dst_dir/SNDR.PGSToolkit_ProcessControlFile.pcf
47+
48+
# Static files referenced in SFIF file
49+
cp $src_dir/src/sips_pge/l1a_atms_snpp/static/SNDR.SNPP.ATMS.L1A.template.v02_02_08_201214135000.nc $dst_dir
50+
cp $src_dir/src/sips_pge/l1a_atms_snpp/static/ATMS-SDR-CC_npp_20131201000000Z_20140101000000Z_ee00000000000000Z_PS-1-O-CCR-14-1487-JPSS-DPA-008-SIDEA-PE_noaa_all_all-_all.xml $dst_dir
51+
cp $src_dir/src/sips_pge/l1a_atms_snpp/static/SNDR.SNPP.ATMS.L1A.calibration_data_200204184500.csv $dst_dir
52+
cp $src_dir/src/sips_pge/l1a_atms_snpp/static/SNDR.SNPP.ATMS.APID_531_ENGHSKP_v11_200204184500.xml $dst_dir
53+
cp $src_dir/src/sips_pge/l1a_atms_snpp/static/SNDR.SNPP.ATMS.L1A.apf_180412120000.xml $dst_dir
54+
cp $src_dir/src/sips_pge/l1a_atms_snpp/static/SNDR.SIPS.SNPP.ATMS.L1A.SPDCMetConstants_170905120000.pev $dst_dir
55+
cp $src_dir/src/sips_pge/l1a_atms_snpp/static/SNDR.SIPS.ATMS.L1A.SPDCMetStructure_161130151628.xml $dst_dir
56+
cp $src_dir/src/sips_pge/l1a_atms_snpp/static/SNDR.SIPS.SNPP.ATMS.L1A.SPDCMetMappings_170905120000.xml $dst_dir
57+
58+
# Template PGE configuration file to be modified by the Jupyter notebook
59+
cp $src_dir/src/sips_pge/l1a_atms_snpp/acctest/spdc_nominal2/in/SNDR.SNPP.ATMS.L1A.nominal2.config_201214135000.xml $dst_dir/pge_config_template.xml

interface/run_l1a_pge.ipynb

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,31 @@
3535
"from xml.dom import minidom"
3636
]
3737
},
38+
{
39+
"cell_type": "markdown",
40+
"id": "1fc21ce3-a47a-40f9-8039-d04970151ef5",
41+
"metadata": {},
42+
"source": [
43+
"## Constants"
44+
]
45+
},
46+
{
47+
"cell_type": "code",
48+
"execution_count": null,
49+
"id": "40c333f0-aff0-4813-9a59-5fdff4681bcf",
50+
"metadata": {},
51+
"outputs": [],
52+
"source": [
53+
"# Base path where configuration and executables have been installed\n",
54+
"install_base_path = \"/pge\"\n",
55+
"\n",
56+
"# Where PGE static config files\n",
57+
"config_static_path = os.path.join(install_base_path, \"static\")\n",
58+
"\n",
59+
"# Where PGE binaries are located\n",
60+
"pge_bin_path = os.path.join(install_base_path, \"bin\")"
61+
]
62+
},
3863
{
3964
"cell_type": "markdown",
4065
"id": "0f1c1c7e",
@@ -55,10 +80,10 @@
5580
"outputs": [],
5681
"source": [
5782
"# Location of input L0 files\n",
58-
"input_path = \"/pge/in\"\n",
83+
"input_path = \"/tmp/in\"\n",
5984
"\n",
6085
"# Where PGE output files and log files get written\n",
61-
"output_path = \"/pge/out\"\n",
86+
"output_path = \"/tmp/out\"\n",
6287
"\n",
6388
"# Location of dem and mcf static files\n",
6489
"data_static_path = \"/tmp/static\"\n",
@@ -76,7 +101,7 @@
76101
"id": "e80baccd",
77102
"metadata": {},
78103
"source": [
79-
"## Constants"
104+
"## Configuration"
80105
]
81106
},
82107
{
@@ -86,11 +111,8 @@
86111
"metadata": {},
87112
"outputs": [],
88113
"source": [
89-
"# Where PGE static config files\n",
90-
"config_static_path = \"/pge/static\"\n",
91-
"\n",
92114
"# Source XML file to be modified with execution parameters\n",
93-
"config_template_filename = \"/pge/static/pge_config_template.xml\"\n",
115+
"config_template_filename = os.path.join(config_static_path, \"pge_config_template.xml\")\n",
94116
"\n",
95117
"# Where config file gets written\n",
96118
"config_output_filename = os.path.join(output_path, \"l1a_config.xml\")\n",
@@ -99,10 +121,10 @@
99121
"log_filename = os.path.join(output_path, \"L1AMw_main.log\")\n",
100122
"\n",
101123
"# Location of PGE executable\n",
102-
"pge_executable = \"/pge/bin/L1AMw_main\"\n",
124+
"pge_executable = os.path.join(pge_bin_path, \"L1AMw_main\")\n",
103125
"\n",
104126
"# Location of MetExtractor executable\n",
105-
"met_extractor_executable = \"/pge/bin/MetExtractor\""
127+
"met_extractor_executable = os.path.join(pge_bin_path, \"MetExtractor\")"
106128
]
107129
},
108130
{
@@ -175,7 +197,7 @@
175197
"\n",
176198
"dem_dst_path = \"/tmp/static/dem\"\n",
177199
"mcf_dst_path = \"/tmp/static/mcf\"\n",
178-
"\n",
200+
" \n",
179201
"for src_path, dst_path in [(dem_src_path, dem_dst_path), (mcf_src_path, mcf_dst_path)]:\n",
180202
" # Only error if the destination path exists and is not the same as the source\n",
181203
" if os.path.exists(dst_path) and not os.path.realpath(src_path) == os.path.realpath(dst_path):\n",
@@ -569,7 +591,7 @@
569591
],
570592
"metadata": {
571593
"kernelspec": {
572-
"display_name": "Python 3",
594+
"display_name": "Python 3 (ipykernel)",
573595
"language": "python",
574596
"name": "python3"
575597
},
@@ -583,7 +605,7 @@
583605
"name": "python",
584606
"nbconvert_exporter": "python",
585607
"pygments_lexer": "ipython3",
586-
"version": "3.6.8"
608+
"version": "3.10.5"
587609
}
588610
},
589611
"nbformat": 4,

test/common/copy_l1a_input.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Copy input files from SPSS repo
2-
acc_case_in_dir=$(realpath $(dirname $0)/../src/src/sips_pge/l1a_atms_snpp/acctest/spdc_nominal2/in/)
2+
acc_case_in_dir=$(realpath $(dirname $0)/../../src/src/sips_pge/l1a_atms_snpp/acctest/spdc_nominal2/in/)
33

44
# Copy the input files referenced by the test XML file1
55
for src_fn in $acc_case_in_dir/atms_science $acc_case_in_dir/ephatt; do

0 commit comments

Comments
 (0)