[6d420c3] | 1 | #!/bin/bash |
---|
[e4925fb] | 2 | # Ignacio Pisso, May 2017 |
---|
[6d420c3] | 3 | |
---|
[941db73] | 4 | echo CREATE A NEW FLEXPART DISTRIBUTION |
---|
[348abf6] | 5 | |
---|
[e4925fb] | 6 | # get current commit hash |
---|
[348abf6] | 7 | githash=$(git rev-parse --short --verify HEAD) |
---|
[941db73] | 8 | echo githash $githash |
---|
[e4925fb] | 9 | #define version number with hash |
---|
| 10 | version=10.4_$githash |
---|
[941db73] | 11 | echo version $version |
---|
[6d420c3] | 12 | |
---|
[6616daf] | 13 | # define tarball name |
---|
[a816416] | 14 | targetdir=../flexpart_distribution/ |
---|
[941db73] | 15 | echo targetdir $targetdir |
---|
| 16 | |
---|
[e4925fb] | 17 | # name distribution version |
---|
[941db73] | 18 | distribution_name=flexpart_v$version |
---|
| 19 | |
---|
[e4925fb] | 20 | # name distribution temporary dir |
---|
[941db73] | 21 | tarball_tmp=${targetdir}flexpart_v$version |
---|
| 22 | echo tarball_tmp $tarball_tmp |
---|
| 23 | |
---|
[e4925fb] | 24 | # name distribution tarball file |
---|
[348abf6] | 25 | #tarball=${targetdir}flexpart_v$version.tar |
---|
| 26 | tarball=${tarball_tmp}.tar |
---|
[941db73] | 27 | echo tarball $tarball |
---|
[6616daf] | 28 | |
---|
[e4925fb] | 29 | # if needed clean old package |
---|
[a816416] | 30 | if [ -d $tarball_tmp ]; then |
---|
[941db73] | 31 | echo |
---|
| 32 | echo clean old tarball |
---|
| 33 | hora=$(date +"%Y-%m-%d_%H%M%S") |
---|
| 34 | tarball_tmp_bk=$tarball_tmp$tarball_tmp_$hora |
---|
| 35 | echo tarball_tmp=$tarball_tmp exists: move to tarball_tmp_bk=$tarball_tmp_bk #and exit |
---|
| 36 | mkdir $tarball_tmp_bk |
---|
| 37 | mv $tarball_tmp $tarball_tmp_bk/ |
---|
| 38 | mv $tarball $tarball_tmp_bk/ |
---|
| 39 | #exit |
---|
| 40 | echo old files moved to tarball_tmp_bk=$tarball_tmp_bk |
---|
| 41 | echo |
---|
[a816416] | 42 | fi |
---|
| 43 | |
---|
[e4925fb] | 44 | # start packing |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | ## needs in addition to the git repo ANCILLARY git repos |
---|
| 48 | # VERIFY THESE RESOURCES EXIST BEFORE PACKING DISTRIBUTION |
---|
| 49 | #1 OH file OH_variables.bin || OH_variables=../flexin/OH_FIELDS/OH_variables.bin |
---|
| 50 | #2 flex_extract || flex_extract=../flex_extract_v7.0.4/ |
---|
| 51 | #3 flex_read_fortran from ../flex_read_matlab/export_basic TODO: add functions to ../flex_read_matlab/export/ |
---|
| 52 | # flex_read_matlab_src=../flex_read_matlab/export_basic |
---|
| 53 | #4 tests/examples ../flex_tests_examples/examples3/* |
---|
| 54 | #5 |
---|
| 55 | #6 |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | # mkdir container |
---|
[a816416] | 61 | echo --------------------------------------------------------- |
---|
[941db73] | 62 | echo ')' create basis dir $tarball_tmp |
---|
[6d420c3] | 63 | mkdir $tarball_tmp |
---|
[a816416] | 64 | echo --------------------------------------------------------- |
---|
[941db73] | 65 | |
---|
| 66 | echo |
---|
| 67 | |
---|
[e4925fb] | 68 | # patnames |
---|
[a816416] | 69 | echo --------------------------------------------------------- |
---|
[941db73] | 70 | echo ')' copy pathnames |
---|
[a816416] | 71 | #cp pathnames_distribution $tarball_tmp/pathnames |
---|
| 72 | cp pathnames $tarball_tmp/pathnames |
---|
| 73 | echo --------------------------------------------------------- |
---|
[941db73] | 74 | |
---|
| 75 | echo |
---|
| 76 | |
---|
[e4925fb] | 77 | # fortran source files |
---|
[941db73] | 78 | echo --------------------------------------------------------- |
---|
| 79 | echo ')' copy src/ |
---|
[6d420c3] | 80 | mkdir $tarball_tmp/src |
---|
| 81 | cp src/*.f90 $tarball_tmp/src |
---|
[6616daf] | 82 | cp -r src/gributils $tarball_tmp/src |
---|
[a816416] | 83 | # echo '3)' copy makefile |
---|
[6d420c3] | 84 | cp src/makefile $tarball_tmp/src |
---|
[6616daf] | 85 | #cp src/makefile.gfs $tarball_tmp/src |
---|
[a816416] | 86 | echo --------------------------------------------------------- |
---|
[941db73] | 87 | |
---|
| 88 | echo |
---|
| 89 | |
---|
[e4925fb] | 90 | # options dir |
---|
[941db73] | 91 | echo --------------------------------------------------------- |
---|
| 92 | echo ')' copy options/ |
---|
[e4925fb] | 93 | echo --------------------------------------------------------- |
---|
[a816416] | 94 | # (for the distribution they work with the defult flex_ecmwf test winds) |
---|
| 95 | #cp -r options_flex_ecmwf_EA $tarball_tmp/options |
---|
| 96 | mkdir $tarball_tmp/options |
---|
| 97 | user_input_files="AGECLASSES COMMAND IGBP_int1.dat OUTGRID OUTGRID_NEST RECEPTORS RELEASES surfdata.t surfdepo.t" |
---|
| 98 | for i in $user_input_files |
---|
| 99 | do |
---|
| 100 | echo $i |
---|
| 101 | cp -r options/$i $tarball_tmp/options |
---|
[941db73] | 102 | #echo copy $i to $tarball_tmp/options |
---|
[a816416] | 103 | done |
---|
| 104 | mkdir $tarball_tmp/options/SPECIES |
---|
| 105 | cp options/SPECIES/SPECIES* $tarball_tmp/options/SPECIES/ |
---|
| 106 | cp options/SPECIES/specoverview.f90 $tarball_tmp/options/SPECIES/ |
---|
[941db73] | 107 | echo copy options/SPECIES/ to $tarball_tmp/options/SPECIES/ |
---|
[e4925fb] | 108 | echo --------------------------------------------------------- |
---|
| 109 | |
---|
| 110 | echo |
---|
[941db73] | 111 | |
---|
[e4925fb] | 112 | # OH file |
---|
| 113 | echo --------------------------------------------------------- |
---|
| 114 | echo ')' copy OH_variables.bin to flexin |
---|
| 115 | mkdir $tarball_tmp/flexin |
---|
| 116 | OH_variables=../flexin/OH_FIELDS/OH_variables.bin |
---|
| 117 | cp $OH_variables $tarball_tmp/flexin/ |
---|
[a816416] | 118 | echo --------------------------------------------------------- |
---|
[941db73] | 119 | |
---|
| 120 | echo |
---|
| 121 | |
---|
[e4925fb] | 122 | # AVAILABLE |
---|
[941db73] | 123 | echo --------------------------------------------------------- |
---|
| 124 | echo ')' copy AVAILABLE |
---|
[a816416] | 125 | #cp AVAILABLE_flex_ecmwf_EA $tarball_tmp/AVAILABLE |
---|
| 126 | cp AVAILABLE $tarball_tmp/AVAILABLE |
---|
[941db73] | 127 | echo --------------------------------------------------------- |
---|
| 128 | |
---|
| 129 | echo |
---|
[a816416] | 130 | |
---|
[e4925fb] | 131 | # output |
---|
[a816416] | 132 | echo --------------------------------------------------------- |
---|
[941db73] | 133 | echo ')' create output/ # mkdir $tarball_tmp/output |
---|
[a816416] | 134 | mkdir $tarball_tmp/output |
---|
| 135 | echo --------------------------------------------------------- |
---|
[e4925fb] | 136 | echo output reference? |
---|
| 137 | echo --------------------------------------------------------- |
---|
[941db73] | 138 | |
---|
[e4925fb] | 139 | echo |
---|
[941db73] | 140 | |
---|
[e4925fb] | 141 | # preprocess |
---|
[941db73] | 142 | echo --------------------------------------------------------- |
---|
[a816416] | 143 | echo ')' preprocess/ |
---|
[6616daf] | 144 | mkdir $tarball_tmp/preprocess |
---|
[a816416] | 145 | echo -----------------flex_extract------------------- |
---|
| 146 | #echo '6)' mkdir $tarball_tmp/flex_extract [a separate repository] |
---|
| 147 | #mkdir $tarball_tmp/preprocess |
---|
[6616daf] | 148 | #mkdir $tarball_tmp/preprocess/flex_ecmwf |
---|
| 149 | mkdir $tarball_tmp/preprocess/flex_extract |
---|
[a816416] | 150 | #echo '7) add ECMWF retrieve routines (change EA wind files for latest source code)' |
---|
| 151 | #mkdir $tarball_tmp/preprocess/flex_extract |
---|
| 152 | #mkdir $tarball_tmp/preprocess/flex_extract/work |
---|
[6616daf] | 153 | #cp -r flex_ecmwf_src/* $tarball_tmp/preprocess/flex_ecmwf/ |
---|
[a816416] | 154 | #cp -r flex_ecmwf_src/* $tarball_tmp/preprocess/flex_extract/ |
---|
| 155 | ## cp -r flex_extract/work/EA* $tarball_tmp/preprocess/flex_extract/work |
---|
[a2e9de4] | 156 | flex_extract=../flex_extract_v7.0.4/ |
---|
[941db73] | 157 | echo include flex_extract v7.0.4 b7c1c04a204c91e53759ef590504bf52dfaece64 |
---|
| 158 | echo from $flex_extract [use git modules?] IP 3/2018 |
---|
[a2e9de4] | 159 | cp $flex_extract/README.md $tarball_tmp/preprocess/flex_extract |
---|
| 160 | cp -r $flex_extract/docs $tarball_tmp/preprocess/flex_extract |
---|
| 161 | cp -r $flex_extract/grib_templates $tarball_tmp/preprocess/flex_extract |
---|
| 162 | cp -r $flex_extract/python $tarball_tmp/preprocess/flex_extract |
---|
| 163 | cp -r $flex_extract/src $tarball_tmp/preprocess/flex_extract |
---|
[941db73] | 164 | echo flex_extract copied |
---|
| 165 | echo --------------------------------------------------------- |
---|
[e4925fb] | 166 | echo AVAILABLE generation scripts? |
---|
| 167 | echo --------------------------------------------------------- |
---|
[6616daf] | 168 | |
---|
[a816416] | 169 | #echo '10)' cp example generating scripts [a separate repository] |
---|
| 170 | #echo moved below |
---|
| 171 | #mkdir $tarball_tmp/examples |
---|
| 172 | #cp -r examples/*.sh $tarball_tmp/examples/ |
---|
| 173 | #cp -r examples/Makefile $tarball_tmp/examples/ |
---|
[941db73] | 174 | |
---|
| 175 | echo |
---|
| 176 | |
---|
[e4925fb] | 177 | # postprocess |
---|
[a816416] | 178 | echo --------------------------------------------------------- |
---|
[941db73] | 179 | echo ')' postprocess/ |
---|
[a816416] | 180 | |
---|
| 181 | postprocess=postprocess |
---|
| 182 | mkdir $tarball_tmp/$postprocess |
---|
| 183 | echo -----------------flex_read_fortran------------------- |
---|
[e4925fb] | 184 | flex_read_fortran_src=$postprocess/flex_read_fortran/ |
---|
[a816416] | 185 | #echo ')' directory for reading routines |
---|
| 186 | #echo '12)' add fortran reading routines [a separate repository] |
---|
| 187 | mkdir $tarball_tmp/$postprocess/flex_read_fortran |
---|
| 188 | cp $postprocess/flex_read_fortran/*.f $tarball_tmp/$postprocess/flex_read_fortran |
---|
| 189 | cp $postprocess/flex_read_fortran/*.f90 $tarball_tmp/$postprocess/flex_read_fortran |
---|
| 190 | cp $postprocess/flex_read_fortran/makefile $tarball_tmp/$postprocess/flex_read_fortran |
---|
[e4925fb] | 191 | echo flex_read_fortran copied from $flex_read_fortran_src |
---|
[a816416] | 192 | |
---|
| 193 | echo -----------------flex_read_matlab------------------- |
---|
[e4925fb] | 194 | flex_read_matlab_src=../flex_read_matlab/export_basic |
---|
| 195 | mkdir $tarball_tmp/$postprocess/flex_read_matlab |
---|
| 196 | cp -r $flex_read_matlab_src/* $tarball_tmp/$postprocess/flex_read_matlab |
---|
| 197 | echo flex_read_fortran from $flex_read_matlab_src # NOT copied |
---|
[6616daf] | 198 | # add matlab reading routines |
---|
[a816416] | 199 | #mkdir $tarball_tmp/postprocess/flex_read_matlab |
---|
| 200 | #cp postprocess/flex_read_matlab/*.m $tarball_tmp/postprocess/flex_read_matlab |
---|
[941db73] | 201 | echo --------------------------------------------------------- |
---|
[6616daf] | 202 | |
---|
[941db73] | 203 | echo |
---|
[6616daf] | 204 | |
---|
[a816416] | 205 | echo --------------------------------------------------------- |
---|
[941db73] | 206 | echo ')' tests/ |
---|
| 207 | ############################################################### |
---|
[a816416] | 208 | #echo '13) tests' |
---|
[6d420c3] | 209 | mkdir $tarball_tmp/tests |
---|
[e4925fb] | 210 | #echo -----------------flex_read_fortran------------------- |
---|
[a816416] | 211 | #echo 'b) ./tests/flex_read_fortran/' |
---|
[e4925fb] | 212 | #echo fixme |
---|
[a816416] | 213 | #mkdir $tarball_tmp/tests/flex_read_fortran |
---|
| 214 | #cp tests/flex_read_fortran/test_read_default.sh $tarball_tmp/tests/flex_read_fortran |
---|
| 215 | |
---|
[941db73] | 216 | |
---|
[a816416] | 217 | ############################################################### |
---|
[e4925fb] | 218 | echo ----------------- examples ------------------- |
---|
[a816416] | 219 | |
---|
| 220 | #echo ') ./tests/examples/' |
---|
| 221 | mkdir $tarball_tmp/tests/examples |
---|
[e4925fb] | 222 | #echo ') scripts' |
---|
| 223 | #cp -r ./tests/examples/*.sh $tarball_tmp/tests/examples/ |
---|
| 224 | #echo ') makefile' |
---|
| 225 | #cp -r ./tests/examples/Makefile $tarball_tmp/tests/examples/ |
---|
[a816416] | 226 | # echo USAGE: ~/repos/flexpart/tests/examples'$' make run |
---|
[e4925fb] | 227 | cp -r ../flex_tests_examples/examples3/* $tarball_tmp/tests/examples/ |
---|
| 228 | |
---|
| 229 | echo ----------------- examples_reference ------------------- |
---|
| 230 | cp -r ./tests/examples_reference $tarball_tmp/tests/ |
---|
| 231 | |
---|
[6d420c3] | 232 | |
---|
| 233 | |
---|
[a816416] | 234 | ############################################################### |
---|
[e4925fb] | 235 | # echo -----------------postprocess examples------------------- |
---|
| 236 | echo -----------------read examples------------------- |
---|
[a816416] | 237 | |
---|
| 238 | #echo '13 c) ./tests/read_examples/' |
---|
| 239 | mkdir $tarball_tmp/tests/read_examples |
---|
[e4925fb] | 240 | |
---|
| 241 | cp tests/read_examples/declare_examples $tarball_tmp/tests/read_examples/ |
---|
| 242 | cp tests/read_examples/display_examples.sh $tarball_tmp/tests/read_examples/ |
---|
| 243 | cp tests/read_examples/examples_output.txt $tarball_tmp/tests/read_examples/ |
---|
| 244 | cp tests/read_examples/read_examples.sh $tarball_tmp/tests/read_examples/ |
---|
[a816416] | 245 | cp tests/read_examples/read_grids.sh $tarball_tmp/tests/read_examples/ |
---|
[e4925fb] | 246 | cp tests/read_examples/read_parts.sh $tarball_tmp/tests/read_examples/ |
---|
| 247 | cp tests/read_examples/set_examples_all $tarball_tmp/tests/read_examples/ |
---|
| 248 | cp tests/read_examples/set_examples_3.sh $tarball_tmp/tests/read_examples/ |
---|
[a816416] | 249 | cp tests/read_examples/read_headers.sh $tarball_tmp/tests/read_examples/ |
---|
[e4925fb] | 250 | cp tests/read_examples/read_examples_output.txt $tarball_tmp/tests/ #read_examples/ |
---|
[a816416] | 251 | # echo USAGE ~/repos/flexpart/tests/read_examples'$'./read_grids.sh |
---|
| 252 | |
---|
| 253 | ############################################################### |
---|
[e4925fb] | 254 | echo ------------compare examples------------------- |
---|
[a816416] | 255 | #echo tests/compare_examples.sh |
---|
[e4925fb] | 256 | mkdir $tarball_tmp/tests/compare_examples |
---|
| 257 | |
---|
[a816416] | 258 | |
---|
| 259 | #mkdir $tarball_tmp/tests/compare_examples |
---|
| 260 | #cp tests/compare_examples/compare_grids.sh $tarball_tmp/tests/compare_examples |
---|
[e4925fb] | 261 | #cp tests/compare_grids.sh $tarball_tmp/tests/ |
---|
| 262 | cp tests/compare_examples/*.sh $tarball_tmp/tests/compare_examples |
---|
| 263 | cp tests/compare_examples/compare_grids_output.txt $tarball_tmp/tests/ #compare_examples |
---|
[a816416] | 264 | # list of examples with units |
---|
[e4925fb] | 265 | #cp tests/declare_examples $tarball_tmp/tests/ |
---|
[a816416] | 266 | |
---|
[941db73] | 267 | echo |
---|
[a816416] | 268 | |
---|
| 269 | # ~/repos/flexpart/tests$./compare_grids.sh |
---|
| 270 | |
---|
| 271 | #echo mkdir $tarball_tmp/tests/examples2/ |
---|
| 272 | #echo cp tests/examples2/setup.sh $tarball_tmp/tests/examples2/ |
---|
[941db73] | 273 | # echo --repeat examples------------------- |
---|
| 274 | # echo FIXME |
---|
[a816416] | 275 | |
---|
| 276 | ############################################################### |
---|
[941db73] | 277 | #echo -----------------ctbto------------------- |
---|
| 278 | # mkdir $tarball_tmp/tests/ctbto |
---|
[a816416] | 279 | |
---|
| 280 | # cp -r tests/NILU/test_1 $tarball_tmp/tests/ |
---|
| 281 | # cp -r tests/default_cases $tarball_tmp/tests/ |
---|
| 282 | |
---|
[941db73] | 283 | echo --------------------------------------------------------- |
---|
| 284 | echo create tarball |
---|
| 285 | #tar cvf $tarball $tarball_tmp |
---|
| 286 | #tar cf $tarball $tarball_tmp |
---|
| 287 | #cd |
---|
| 288 | |
---|
| 289 | cd $targetdir |
---|
| 290 | tar cf $distribution_name.tar $distribution_name |
---|
| 291 | |
---|
| 292 | pwd |
---|
[a816416] | 293 | |
---|
[941db73] | 294 | |
---|
| 295 | echo tarball $tarball complete |
---|
[348abf6] | 296 | echo exported untarred files in $tarball_tmp |
---|
[e4925fb] | 297 | |
---|
| 298 | echo cp -r preprocess/flex_extract/work $tarball_tmp/preprocess/flex_extract/ |
---|
| 299 | echo cd $tarball_tmp/src |
---|
| 300 | echo $HOME/repos/flexpart/src/make_in_laptop.sh |
---|
| 301 | echo cd .. ';' ./src/FLEXPART |
---|
| 302 | echo cd postprocess/flex_read_fortran |
---|
| 303 | echo make test |
---|
| 304 | echo max: 0.115784094 mean: 4.70877676E-05 |
---|
| 305 | #echo cd $tarball_tmp/tests/examples ';' make run |
---|
| 306 | echo cd ../../tests/examples ';' make run |
---|
| 307 | #echo cd $tarball_tmp/tests/read_examples |
---|
| 308 | echo cd ../read_examples |
---|
| 309 | echo ./read_examples.sh |
---|
| 310 | echo ./read_examples.sh '>' ../read_examples_output.txt |
---|
| 311 | echo cd ../compare_examples |
---|
| 312 | echo ./compare_grids.sh |
---|
| 313 | echo ./compare_grids.sh '>' ../compare_grids_output.txt |
---|
| 314 | |
---|
| 315 | echo e.g. tar --append --file=$tarball_tmp/ ../compare_grids_output.txt ../read_examples_output.txt |
---|
| 316 | |
---|
| 317 | |
---|
| 318 | |
---|
| 319 | |
---|
[a816416] | 320 | exit |
---|
[6616daf] | 321 | #return |
---|
[a816416] | 322 | ############################################################### |
---|
| 323 | |
---|
[941db73] | 324 | # obtain $FLEXHOME (and set) |
---|
| 325 | #1 cd $FLEXHOME/src |
---|
| 326 | |
---|
| 327 | #2 compile |
---|
| 328 | # |
---|
| 329 | #[laptop] source /Users/ignacio/repos/flexpart/src/make_in_laptop.sh |
---|
| 330 | # [njord] make |
---|
| 331 | # ->created executable (FLEXPART) |
---|
| 332 | |
---|
| 333 | #3 execute in src (absolute paths) |
---|
| 334 | # |
---|
| 335 | #[laptop] cp /Users/ignacio/repos/flexpart/src/pathnames . |
---|
| 336 | #[njord] FIXME |
---|
| 337 | # |
---|
| 338 | # mkdir output |
---|
| 339 | # ./FLEXPART |
---|
| 340 | # ->created output in output/ |
---|
| 341 | |
---|
| 342 | #4 read output |
---|
| 343 | # cd $FLEXHOME/postprocess/flex_read_fortran/ |
---|
| 344 | # make |
---|
| 345 | # -> printheader* printgrid* flex_read_compare2* |
---|
| 346 | #/postprocess/flex_read_fortran$./printheader ../../src/output/ |
---|
| 347 | #/postprocess/flex_read_fortran$./printgrid ../../src/output/ conc |
---|
| 348 | # -> output in stdout (max: 11122924.0 sum: 90330784.0) |
---|
| 349 | |
---|
| 350 | #5 execute in $FLEXHOME |
---|
| 351 | # cd $FLEXHOME |
---|
| 352 | # get winds |
---|
| 353 | #[laptop] cp -r ~/repos/flex_winds/work/ ./preprocess/flex_extract/ |
---|
| 354 | #[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 |
---|
| 355 | |
---|
| 356 | # src/FLEXPART |
---|
| 357 | # -> output in $FLEXHOME/output/ |
---|
| 358 | |
---|
| 359 | #6 read output |
---|
| 360 | # postprocess/flex_read_fortran/printheader output/ |
---|
| 361 | # postprocess/flex_read_fortran/printgrid output/ conc |
---|
| 362 | # -> output in stdout ( max: 11578738.0 sum: 104058720.) |
---|
| 363 | |
---|
| 364 | #7 gnererate examples |
---|
| 365 | # cd $FLEXHOME/tests/examples |
---|
| 366 | |
---|
| 367 | #make run |
---|
| 368 | |
---|
| 369 | #make examples |
---|
| 370 | #make batch |
---|
| 371 | #./run_batch_cl.sh |
---|
| 372 | |
---|
| 373 | #make (set_default_example.sh) |
---|
| 374 | #tests/examples$../../src/FLEXPART |
---|
| 375 | #output |
---|
| 376 | |
---|
| 377 | #8 read examples: |
---|
| 378 | #cd $FLEXHOME/tests/read_examples |
---|
| 379 | # ./read_headers.sh |
---|
| 380 | # ./read_grids.sh |
---|
| 381 | |
---|
| 382 | #9 compare examples with reference |
---|