Skip to content

Commit

Permalink
Added test for perturbation data.
Browse files Browse the repository at this point in the history
  • Loading branch information
lars2015 committed Feb 2, 2025
1 parent 8bffe8a commit 17fd818
Show file tree
Hide file tree
Showing 18 changed files with 79,387 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ src/var1d
src/variance
src/volcano
src/zm_ret
tests/pert_test/data/
15 changes: 13 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
# Executables...
EXC = day2doy diff_apr diff_ret distance doy2day events extract hurricane island issifm map_pert map_rad map_ret noise_pert noise_ret optimize_btd orbit overpass perturbation rayt ret2tab sampling select_ret spec2tab spec_ana spec_qual spec_synth sza var1d variance volcano zm_ret

# List of tests...
TESTS = pert_test

# Installation directory...
DESTDIR ?= ../bin

Expand All @@ -26,7 +29,7 @@ INFO ?= 0
# Compile for profiling...
PROF ?= 0

# Compile for coverage report...
# Compile for coverage testing...
COV ?= 0

# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -93,6 +96,14 @@ nlte: nlte.c jurassic.o
retrieval: retrieval.c jurassic.o
$(MPICC) $(CFLAGS) -o retrieval retrieval.c jurassic.o $(LDFLAGS_RET)

check: $(TESTS)

$(TESTS): all
@(echo "\n===== Running \"$@\" ... =====") ; \
cd ../tests/$@ ; ./run.sh \
&& (echo "\n===== Test \"$@\" passed! =====") \
|| (echo "\n===== Test \"$@\" failed! =====" ; exit 1)

clean:
rm -rf $(EXC) nlte retrieval *.o *.gcda *.gcno *.gcov coverage* *~

Expand All @@ -106,7 +117,7 @@ cppcheck:

dist:
cd .. && tar cvfz airs_$(VERSION).tgz bin/* \
docs/Doxyfile example/* libs/build.sh libs/*gz src/*
docs/Doxyfile example/* libs/build.sh libs/*gz src/* tests/*

doxygen:
cd ../docs && doxygen
Expand Down
Binary file not shown.
Binary file not shown.
15 changes: 15 additions & 0 deletions tests/pert_test/data.ref/events_15mu_high.tab
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# $1 = time [s]
# $2 = longitude [deg]
# $3 = latitude [deg]
# $4 = maximum variance [K^2]

95704884.39 131.703 -6.04832 0.21821
95704968.92 135.993 -11.8883 0.621688
95704969.54 131.585 -11.3364 0.52867
95704932.86 128.295 -8.56357 0.396211
95705030.47 133.341 -15.3609 0.564113
95705012.23 130.9 -13.8967 1.62215
95705050.19 126.653 -15.6258 0.420894
95705094.18 135.263 -19.5257 0.208639
95705097.70 128.989 -18.9441 0.501523
95705092.86 126.026 -18.1882 0.396553
5 changes: 5 additions & 0 deletions tests/pert_test/data.ref/events_15mu_low.tab
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# $1 = time [s]
# $2 = longitude [deg]
# $3 = latitude [deg]
# $4 = maximum variance [K^2]

7 changes: 7 additions & 0 deletions tests/pert_test/data.ref/events_4mu.tab
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# $1 = time [s]
# $2 = longitude [deg]
# $3 = latitude [deg]
# $4 = maximum variance [K^2]

95704969.54 131.585 -11.3364 0.291518
95705012.21 131.027 -13.9133 0.620131
24,580 changes: 24,580 additions & 0 deletions tests/pert_test/data.ref/map_15mu_high.tab

Large diffs are not rendered by default.

24,580 changes: 24,580 additions & 0 deletions tests/pert_test/data.ref/map_15mu_low.tab

Large diffs are not rendered by default.

24,580 changes: 24,580 additions & 0 deletions tests/pert_test/data.ref/map_4mu.tab

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions tests/pert_test/data.ref/noise_15mu_high.tab
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# $1 = longitude [deg]
# $2 = latitude [deg]
# $3 = mean brightness temperature [K]
# $4 = noise estimate [K]

134.813 7.96605 249.008 0.298934
131.723 -6.54831 249.638 0.368227
128.504 -21.0327 250.663 0.338768
8 changes: 8 additions & 0 deletions tests/pert_test/data.ref/noise_15mu_low.tab
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# $1 = longitude [deg]
# $2 = latitude [deg]
# $3 = mean brightness temperature [K]
# $4 = noise estimate [K]

134.813 7.96605 224.029 0.143318
131.723 -6.54831 224.544 0.152036
128.504 -21.0327 226.757 0.139778
8 changes: 8 additions & 0 deletions tests/pert_test/data.ref/noise_4mu.tab
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# $1 = longitude [deg]
# $2 = latitude [deg]
# $3 = mean brightness temperature [K]
# $4 = noise estimate [K]

134.813 7.96605 238.172 0.108375
131.723 -6.54831 238.963 0.187371
128.504 -21.0327 240.272 0.149173
Binary file added tests/pert_test/data.ref/pert.nc
Binary file not shown.
1,847 changes: 1,847 additions & 0 deletions tests/pert_test/data.ref/var_15mu_high.tab

Large diffs are not rendered by default.

1,847 changes: 1,847 additions & 0 deletions tests/pert_test/data.ref/var_15mu_low.tab

Large diffs are not rendered by default.

1,847 changes: 1,847 additions & 0 deletions tests/pert_test/data.ref/var_4mu.tab

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions tests/pert_test/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#! /bin/bash

# Set environment...
export LD_LIBRARY_PATH=../../libs/build/lib:$LD_LIBRARY_PATH
export OMP_NUM_THREADS=4

# Setup...
airs=../../src

# Create directory...
rm -rf data && mkdir -p data

# Create perturbation file...
$airs/perturbation data/pert.nc \
../data/AIRS.2003.01.12.166.L1B.AIRS_Rad.v5.0.0.0.G07074102637.hdf \
../data/AIRS.2003.01.12.167.L1B.AIRS_Rad.v5.0.0.0.G07074102639.hdf

# Loop over channel sets...
for pert in 4mu 15mu_low 15mu_high ; do

# Get map data...
$airs/map_pert - data/pert.nc data/map_$pert.tab PERTNAME $pert

# Estimate noise...
$airs/noise_pert - data/pert.nc data/noise_$pert.tab PERTNAME $pert

# Get variance...
$airs/variance - data/var_$pert.tab data/pert.nc PERTNAME $pert NX 60 NY 30

# Get events...
$airs/events - data/events_$pert.tab data/pert.nc PERTNAME $pert VARMIN 0.2

done

# Compare files...
echo -e "\nCompare results..."
error=0
for f in $(ls data.ref/*.nc data.ref/*.tab) ; do
diff -q -s data/"$(basename "$f")" "$f" || error=1
done
exit $error

0 comments on commit 17fd818

Please sign in to comment.