1 |
#!/bin/bash |
#!/bin/bash |
2 |
|
|
3 |
echo -n "Would you like to use default settings? (y/n): " |
echo -n "What format is the data in? (netcdf/binary): " |
4 |
read yn |
read nb |
5 |
|
|
6 |
if echo $yn | grep -q n |
if [ $nb = 'binary' ]; then |
|
then |
|
7 |
|
|
8 |
rm .darwinview/filenames |
echo -n "Would you like to use default settings? (y/n): " |
9 |
rm .darwinview/*.dat |
read yn |
10 |
|
|
11 |
echo -n "Please enter screen resolution: " |
if [ $yn = 'n' ]; then |
12 |
read win |
|
13 |
echo $win > .darwinview/config |
rm -f .darwinview/binfilenames |
14 |
echo -n "Please enter dimensions of data: " |
rm -f .darwinview/*.datbin |
15 |
read dim |
|
16 |
echo $dim >> .darwinview/config |
echo -n "Please enter screen resolution: " |
17 |
echo -n "Please enter dimensions of data sets: " |
read win |
18 |
read dimset |
echo $win > .darwinview/binconfig |
19 |
echo $dimset >> .darwinview/config |
echo -n "Please enter dimensions of data: " |
20 |
echo .darwinview/filenames >> .darwinview/config |
read dim |
21 |
echo -n "Please enter directory containing data: " |
echo $dim >> .darwinview/binconfig |
22 |
read dir |
echo -n "Please enter dimensions of data sets: " |
23 |
|
read dimset |
24 |
name="start" |
echo $dimset >> .darwinview/binconfig |
25 |
|
echo .darwinview/binfilenames >> .darwinview/binconfig |
26 |
while [ $name != 'q' ] |
echo -n "Please enter directory containing data: " |
27 |
do |
read dir |
28 |
echo -n "Please enter name of species: " |
|
29 |
read name |
echo -n "Please enter name of file containing desired species: " |
30 |
if [ $name != 'q' ] |
read fn |
31 |
then |
|
32 |
echo .darwinview/$name.dat >> .darwinview/filenames |
vn=( `cat $fn` ) |
33 |
for i in `ls $dir` |
|
34 |
do |
for name in ${vn[@]}; do |
35 |
touch .darwinview/$name.dat |
touch .darwinview/$name.datbin |
36 |
echo $dir/$i/`ls $dir/$i | grep $name` >> .darwinview/$name.dat |
echo .darwinview/$name.datbin >> .darwinview/binfilenames |
37 |
|
for i in `ls $dir`; do |
38 |
|
echo $dir/$i/`ls $dir/$i | grep $name` >> .darwinview/$name.datbin |
39 |
|
done |
40 |
|
done |
41 |
|
|
42 |
|
fi |
43 |
|
|
44 |
|
elif [ $nb = 'netcdf' ]; then |
45 |
|
|
46 |
|
echo -n "Would you like to use default settings? (y/n): " |
47 |
|
read yn |
48 |
|
|
49 |
|
if [ $yn = 'n' ]; then |
50 |
|
|
51 |
|
rm -f .darwinview/ncfilenames |
52 |
|
rm -f .darwinview/*.datnc |
53 |
|
|
54 |
|
echo -n "Please enter screen resolution: " |
55 |
|
read win |
56 |
|
echo $win > .darwinview/ncconfig |
57 |
|
echo -n "Please enter dimensions of data: " |
58 |
|
read dim |
59 |
|
echo $dim >> .darwinview/ncconfig |
60 |
|
echo -n "Please enter dimensions of data sets: " |
61 |
|
read dimset |
62 |
|
echo $dimset >> .darwinview/ncconfig |
63 |
|
echo .darwinview/ncfilenames >> .darwinview/ncconfig |
64 |
|
|
65 |
|
echo -n "Please enter directory containing data: " |
66 |
|
read tmp |
67 |
|
echo $tmp > .darwinview/netcdf |
68 |
|
echo -n "Please enter directory to write to: " |
69 |
|
read tmp |
70 |
|
echo $tmp >> .darwinview/netcdf |
71 |
|
|
72 |
|
echo -n "Please enter name of file containing desired species: " |
73 |
|
read tmp |
74 |
|
echo $tmp >> .darwinview/netcdf |
75 |
|
echo -n "Please enter name of file containing desired tiles: " |
76 |
|
read tmp |
77 |
|
echo $tmp >> .darwinview/netcdf |
78 |
|
echo -n "Please enter name of file containing desired time steps: " |
79 |
|
read tmp |
80 |
|
echo $tmp >> .darwinview/netcdf |
81 |
|
|
82 |
|
fi |
83 |
|
|
84 |
|
indir=( `cat .darwinview/netcdf | head -1` ) |
85 |
|
outdir=( `cat .darwinview/netcdf | head -2 | tail -1` ) |
86 |
|
fn=( `cat .darwinview/netcdf | head -3 | tail -1` ) |
87 |
|
vn=( `cat $fn` ) |
88 |
|
fn=( `cat .darwinview/netcdf | head -4 | tail -1` ) |
89 |
|
tlist=( `cat $fn` ) |
90 |
|
fn=( `cat .darwinview/netcdf | tail -1` ) |
91 |
|
itlist=( `cat $fn` ) |
92 |
|
|
93 |
|
initdir=`pwd` |
94 |
|
gcc ~/netcdf.c -I/usr/include/netcdf-3 -L/usr/lib/netcdf-3 -lnetcdf |
95 |
|
for tstep in ${itlist[@]}; do |
96 |
|
cd $initdir |
97 |
|
cd $outdir |
98 |
|
mkdir -p $tstep |
99 |
|
cd $tstep |
100 |
|
for name in ${vn[@]}; do |
101 |
|
for tile in ${tlist[@]}; do |
102 |
|
/home/marissa/a.out ~/${indir}/ptr_tave.${tstep}.${tile}.nc $name |
103 |
|
done |
104 |
|
done |
105 |
|
done |
106 |
|
|
107 |
|
cd $initdir |
108 |
|
|
109 |
|
for name in ${vn[@]}; do |
110 |
|
touch .darwinview/$name.datnc |
111 |
|
echo .darwinview/$name.datnc >> .darwinview/ncfilenames |
112 |
|
for i in `ls $outdir`; do |
113 |
|
echo $outdir/$i/`ls $outdir/$i | grep $name` >> .darwinview/$name.datnc |
114 |
done |
done |
|
fi |
|
115 |
done |
done |
116 |
|
|
117 |
fi |
fi |
118 |
|
|
119 |
make |
gcc darwin.c -lglut |
120 |
./a.out |
./a.out $nb |