create_tarball.sh 9.46 KB
Newer Older
1 2
#!/bin/bash

Ignacio Pisso's avatar
Ignacio Pisso committed
3
echo CREATE A NEW FLEXPART DISTRIBUTION
4

Ignacio Pisso's avatar
Ignacio Pisso committed
5
#define version number
6
githash=$(git rev-parse --short --verify HEAD)
Ignacio Pisso's avatar
Ignacio Pisso committed
7
echo githash $githash 
8

Ignacio Pisso's avatar
Ignacio Pisso committed
9 10
version=10.3.1_$githash
echo version $version  
11

12
# define tarball name
13
targetdir=../flexpart_distribution/
Ignacio Pisso's avatar
Ignacio Pisso committed
14 15 16 17 18 19 20
echo targetdir $targetdir

distribution_name=flexpart_v$version

tarball_tmp=${targetdir}flexpart_v$version
echo tarball_tmp $tarball_tmp

21 22
#tarball=${targetdir}flexpart_v$version.tar 
tarball=${tarball_tmp}.tar 
Ignacio Pisso's avatar
Ignacio Pisso committed
23
echo tarball $tarball
24 25

# clean old package
26
if [ -d $tarball_tmp ]; then
Ignacio Pisso's avatar
Ignacio Pisso committed
27 28 29 30 31 32 33 34 35 36 37
  echo
  echo clean old tarball
  hora=$(date +"%Y-%m-%d_%H%M%S")
  tarball_tmp_bk=$tarball_tmp$tarball_tmp_$hora
  echo tarball_tmp=$tarball_tmp exists: move to tarball_tmp_bk=$tarball_tmp_bk #and exit  
  mkdir $tarball_tmp_bk 
  mv $tarball_tmp $tarball_tmp_bk/ 
  mv $tarball $tarball_tmp_bk/ 
  #exit 
  echo old files moved to tarball_tmp_bk=$tarball_tmp_bk 
  echo
38 39 40
fi

echo ---------------------------------------------------------
Ignacio Pisso's avatar
Ignacio Pisso committed
41
echo ')' create basis dir $tarball_tmp
42
mkdir $tarball_tmp
43
echo ---------------------------------------------------------
Ignacio Pisso's avatar
Ignacio Pisso committed
44 45 46

echo

47
echo ---------------------------------------------------------
Ignacio Pisso's avatar
Ignacio Pisso committed
48
echo ')' copy pathnames 
49 50 51
#cp pathnames_distribution $tarball_tmp/pathnames
cp pathnames $tarball_tmp/pathnames
echo ---------------------------------------------------------
Ignacio Pisso's avatar
Ignacio Pisso committed
52 53 54 55 56

echo 

echo ---------------------------------------------------------
echo ')' copy src/
57 58
mkdir $tarball_tmp/src
cp src/*.f90 $tarball_tmp/src
59
cp -r src/gributils $tarball_tmp/src 
60
# echo '3)' copy makefile
61
cp src/makefile $tarball_tmp/src
62
#cp src/makefile.gfs $tarball_tmp/src
63 64
echo ---------------------------------------------------------
################################################################
Ignacio Pisso's avatar
Ignacio Pisso committed
65 66 67 68 69

echo

echo ---------------------------------------------------------
echo ')' copy options/ 
70 71 72 73 74 75 76 77 78 79
# (for the distribution they work with the defult flex_ecmwf test winds)
#cp -r options_flex_ecmwf_EA $tarball_tmp/options
mkdir $tarball_tmp/options

user_input_files="AGECLASSES     COMMAND        IGBP_int1.dat  OUTGRID        OUTGRID_NEST   RECEPTORS      RELEASES       surfdata.t     surfdepo.t"

for i in $user_input_files
do
  echo $i
  cp -r options/$i $tarball_tmp/options
Ignacio Pisso's avatar
Ignacio Pisso committed
80
  #echo copy $i to $tarball_tmp/options
81 82 83 84 85 86
done


mkdir $tarball_tmp/options/SPECIES
cp options/SPECIES/SPECIES* $tarball_tmp/options/SPECIES/
cp options/SPECIES/specoverview.f90 $tarball_tmp/options/SPECIES/
Ignacio Pisso's avatar
Ignacio Pisso committed
87 88
echo copy options/SPECIES/ to $tarball_tmp/options/SPECIES/

89
echo ---------------------------------------------------------
Ignacio Pisso's avatar
Ignacio Pisso committed
90 91 92 93 94

echo

echo ---------------------------------------------------------
echo ')' copy AVAILABLE
95 96
#cp AVAILABLE_flex_ecmwf_EA $tarball_tmp/AVAILABLE
cp AVAILABLE $tarball_tmp/AVAILABLE
Ignacio Pisso's avatar
Ignacio Pisso committed
97 98 99
echo ---------------------------------------------------------

echo 
100 101

echo ---------------------------------------------------------
Ignacio Pisso's avatar
Ignacio Pisso committed
102
echo  ')' create output/ #  mkdir $tarball_tmp/output
103 104 105
mkdir $tarball_tmp/output
echo ---------------------------------------------------------
################################################################
Ignacio Pisso's avatar
Ignacio Pisso committed
106 107 108 109

echo 

echo ---------------------------------------------------------
110
echo ')' preprocess/
111
mkdir $tarball_tmp/preprocess
Ignacio Pisso's avatar
Ignacio Pisso committed
112 113 114

echo 

115 116 117
echo -----------------flex_extract-------------------
#echo '6)'  mkdir $tarball_tmp/flex_extract [a separate repository]
#mkdir $tarball_tmp/preprocess
118 119
#mkdir $tarball_tmp/preprocess/flex_ecmwf
mkdir $tarball_tmp/preprocess/flex_extract
120 121 122 123

#echo '7)  add ECMWF retrieve routines (change EA wind files for latest source code)'
#mkdir $tarball_tmp/preprocess/flex_extract
#mkdir $tarball_tmp/preprocess/flex_extract/work
124
#cp -r flex_ecmwf_src/* $tarball_tmp/preprocess/flex_ecmwf/
125 126
#cp -r flex_ecmwf_src/* $tarball_tmp/preprocess/flex_extract/
## cp -r flex_extract/work/EA* $tarball_tmp/preprocess/flex_extract/work   
127

128
flex_extract=../flex_extract_v7.0.4/
Ignacio Pisso's avatar
Ignacio Pisso committed
129 130 131
echo include flex_extract v7.0.4 b7c1c04a204c91e53759ef590504bf52dfaece64
echo from $flex_extract [use git modules?] IP 3/2018 

132 133 134 135 136
cp $flex_extract/README.md $tarball_tmp/preprocess/flex_extract
cp -r $flex_extract/docs $tarball_tmp/preprocess/flex_extract
cp -r $flex_extract/grib_templates $tarball_tmp/preprocess/flex_extract
cp -r $flex_extract/python $tarball_tmp/preprocess/flex_extract
cp -r $flex_extract/src $tarball_tmp/preprocess/flex_extract
Ignacio Pisso's avatar
Ignacio Pisso committed
137 138
echo flex_extract copied
echo ---------------------------------------------------------
139 140


141 142 143 144 145 146
#echo '10)' cp example generating scripts [a separate repository]
#echo moved below

#mkdir $tarball_tmp/examples
#cp -r examples/*.sh $tarball_tmp/examples/ 
#cp -r examples/Makefile $tarball_tmp/examples/ 
Ignacio Pisso's avatar
Ignacio Pisso committed
147 148 149

echo 

150 151
echo ---------------------------------------------------------
################################################################
Ignacio Pisso's avatar
Ignacio Pisso committed
152
echo ')' postprocess/
153 154 155 156 157 158 159 160 161 162

postprocess=postprocess
mkdir $tarball_tmp/$postprocess
echo -----------------flex_read_fortran-------------------
#echo ')'  directory for reading routines
#echo '12)'  add fortran reading routines [a separate repository]
mkdir $tarball_tmp/$postprocess/flex_read_fortran
cp $postprocess/flex_read_fortran/*.f $tarball_tmp/$postprocess/flex_read_fortran
cp $postprocess/flex_read_fortran/*.f90 $tarball_tmp/$postprocess/flex_read_fortran
cp $postprocess/flex_read_fortran/makefile $tarball_tmp/$postprocess/flex_read_fortran
Ignacio Pisso's avatar
Ignacio Pisso committed
163
echo flex_read_fortran copied
164 165

echo -----------------flex_read_matlab-------------------
Ignacio Pisso's avatar
Ignacio Pisso committed
166
echo flex_read_fortran NOT copied
167 168

# add matlab reading routines
169 170
#mkdir $tarball_tmp/postprocess/flex_read_matlab
#cp postprocess/flex_read_matlab/*.m $tarball_tmp/postprocess/flex_read_matlab
Ignacio Pisso's avatar
Ignacio Pisso committed
171
echo ---------------------------------------------------------
172

Ignacio Pisso's avatar
Ignacio Pisso committed
173
echo
174

175
echo ---------------------------------------------------------
Ignacio Pisso's avatar
Ignacio Pisso committed
176 177
echo ')' tests/
###############################################################
178
#echo '13) tests' 
179
mkdir $tarball_tmp/tests
180 181 182 183 184 185
echo -----------------flex_read_fortran-------------------
#echo 'b) ./tests/flex_read_fortran/' 
echo fixme
#mkdir $tarball_tmp/tests/flex_read_fortran
#cp tests/flex_read_fortran/test_read_default.sh  $tarball_tmp/tests/flex_read_fortran

Ignacio Pisso's avatar
Ignacio Pisso committed
186

187 188 189 190 191 192 193 194 195 196 197
###############################################################
echo -----------------examples-------------------

#echo ') ./tests/examples/' 
mkdir $tarball_tmp/tests/examples
echo ') scripts' 
cp -r ./tests/examples/*.sh $tarball_tmp/tests/examples/ 
echo ') makefile' 
cp -r ./tests/examples/Makefile $tarball_tmp/tests/examples/ 

# echo USAGE: ~/repos/flexpart/tests/examples'$' make run
198 199


200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
###############################################################
echo -----------------postprocess examples-------------------
echo --read examples-------------------

#echo '13 c) ./tests/read_examples/' 
mkdir $tarball_tmp/tests/read_examples
cp tests/read_examples/read_grids.sh $tarball_tmp/tests/read_examples/
cp tests/read_examples/read_headers.sh $tarball_tmp/tests/read_examples/

# echo USAGE ~/repos/flexpart/tests/read_examples'$'./read_grids.sh

###############################################################
echo --compare examples-------------------
#echo tests/compare_examples.sh

#mkdir $tarball_tmp/tests/compare_examples
#cp tests/compare_examples/compare_grids.sh $tarball_tmp/tests/compare_examples
cp tests/compare_grids.sh $tarball_tmp/tests/
# list of examples with units
cp tests/declare_examples $tarball_tmp/tests/

Ignacio Pisso's avatar
Ignacio Pisso committed
221
echo 
222 223 224 225 226

# ~/repos/flexpart/tests$./compare_grids.sh 

#echo mkdir $tarball_tmp/tests/examples2/
#echo cp tests/examples2/setup.sh $tarball_tmp/tests/examples2/
Ignacio Pisso's avatar
Ignacio Pisso committed
227 228
# echo --repeat examples-------------------
# echo FIXME 
229 230

###############################################################
Ignacio Pisso's avatar
Ignacio Pisso committed
231 232
#echo -----------------ctbto-------------------
# mkdir $tarball_tmp/tests/ctbto
233 234 235 236

# cp -r tests/NILU/test_1 $tarball_tmp/tests/
# cp -r tests/default_cases $tarball_tmp/tests/

Ignacio Pisso's avatar
Ignacio Pisso committed
237 238 239 240 241 242 243 244 245 246
echo ---------------------------------------------------------
echo create tarball
#tar cvf $tarball  $tarball_tmp  
#tar cf $tarball  $tarball_tmp  
#cd 

cd $targetdir
tar cf $distribution_name.tar $distribution_name 

pwd
247

Ignacio Pisso's avatar
Ignacio Pisso committed
248 249

echo  tarball $tarball complete
250
echo exported untarred files in $tarball_tmp 
251
exit
252
#return
253 254
###############################################################

Ignacio Pisso's avatar
Ignacio Pisso committed
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313
# obtain $FLEXHOME (and set)
#1 cd $FLEXHOME/src 

#2 compile
#
#[laptop] source /Users/ignacio/repos/flexpart/src/make_in_laptop.sh 
# [njord] make
# ->created executable (FLEXPART)

#3 execute in src (absolute paths)
#
#[laptop] cp  /Users/ignacio/repos/flexpart/src/pathnames .
#[njord] FIXME
#
# mkdir output
# ./FLEXPART
# ->created output in output/

#4 read output
# cd  $FLEXHOME/postprocess/flex_read_fortran/
# make
# -> printheader* printgrid* flex_read_compare2*
#/postprocess/flex_read_fortran$./printheader ../../src/output/
#/postprocess/flex_read_fortran$./printgrid ../../src/output/ conc
# -> output in stdout (max:   11122924.0     sum:   90330784.0)

#5 execute in $FLEXHOME
# cd $FLEXHOME
# get winds
#[laptop] cp -r ~/repos/flex_winds/work/ ./preprocess/flex_extract/ 
#[njord] curl https://folk.nilu.no/~ignacio/FLEXPART/EA120101.tar --output EA120101.tar ; tar -xvf EA120101.tar ; mv flex_extract/work preprocess/flex_extract/ ; rmdir flex_extract

# src/FLEXPART
# -> output in $FLEXHOME/output/

#6 read output
# postprocess/flex_read_fortran/printheader output/
# postprocess/flex_read_fortran/printgrid output/ conc
# -> output in stdout ( max:   11578738.0     sum:   104058720.)

#7 gnererate examples
# cd $FLEXHOME/tests/examples

#make run

#make examples
#make batch
#./run_batch_cl.sh

#make (set_default_example.sh)
#tests/examples$../../src/FLEXPART
#output

#8 read examples:
#cd $FLEXHOME/tests/read_examples  
# ./read_headers.sh
# ./read_grids.sh 

#9 compare examples with reference