| 1 | #!/bin/sh |
|---|
| 2 | |
|---|
| 3 | if [ "$#" != "2" ] |
|---|
| 4 | then |
|---|
| 5 | echo "Usage:" |
|---|
| 6 | echo "$0 LEVEL1_HDF_FILENAME OUTPUT_FILE.csv" |
|---|
| 7 | echo |
|---|
| 8 | echo "This will produce a CSV file of band no vs. wavelength centre vs. wavelength half-bandwidth" |
|---|
| 9 | echo "Only for use on CCD sensors (CASI, Eagle, Hawk), not ATM" |
|---|
| 10 | echo "Requires azexhdf to be in the path" |
|---|
| 11 | exit |
|---|
| 12 | fi |
|---|
| 13 | |
|---|
| 14 | azexhdf -vn CAwavc -vf /tmp/wavc.txt -h $1 > /dev/null |
|---|
| 15 | if [ "$?" == "127" ] |
|---|
| 16 | then |
|---|
| 17 | echo azexhdf command failed - is it in the PATH? |
|---|
| 18 | exit 1 |
|---|
| 19 | fi |
|---|
| 20 | |
|---|
| 21 | azexhdf -vn CAwavh -vf /tmp/wavh.txt -h $1 > /dev/null |
|---|
| 22 | if [ "$?" == "127" ] |
|---|
| 23 | then |
|---|
| 24 | echo azexhdf command failed - is it in the PATH? |
|---|
| 25 | exit 1 |
|---|
| 26 | fi |
|---|
| 27 | |
|---|
| 28 | cat /tmp/wavc.txt | tr ' ' \\n | tail -n +2 > /tmp/wavc-transposed.txt |
|---|
| 29 | cat /tmp/wavh.txt | tr ' ' \\n | tail -n +2 > /tmp/wavh-transposed.txt |
|---|
| 30 | |
|---|
| 31 | echo '"Band number","Wavelength centre frequency (nm)","Wavelength half-bandwidth (nm)"' > $2 |
|---|
| 32 | |
|---|
| 33 | paste /tmp/wavc-transposed.txt /tmp/wavh-transposed.txt | cat -n | sed -e 's/^\s*//' | sed -e 's/\s\s*/,/g' >> $2 |
|---|
| 34 | |
|---|
| 35 | rm -f /tmp/wavc.txt /tmp/wavh.txt /tmp/wavc-transposed.txt /tmp/wavh-transposed.txt |
|---|