[6d420c3] | 1 | #!/bin/bash |
---|
[e4925fb] | 2 | # Ignacio Pisso, May 2017 |
---|
[577bd04] | 3 | # Changes 2018-2019 |
---|
[6d420c3] | 4 | |
---|
[941db73] | 5 | echo CREATE A NEW FLEXPART DISTRIBUTION |
---|
[348abf6] | 6 | |
---|
[e4925fb] | 7 | # get current commit hash |
---|
[348abf6] | 8 | githash=$(git rev-parse --short --verify HEAD) |
---|
[941db73] | 9 | echo githash $githash |
---|
[e4925fb] | 10 | #define version number with hash |
---|
| 11 | version=10.4_$githash |
---|
[941db73] | 12 | echo version $version |
---|
[6d420c3] | 13 | |
---|
[6616daf] | 14 | # define tarball name |
---|
[a816416] | 15 | targetdir=../flexpart_distribution/ |
---|
[941db73] | 16 | echo targetdir $targetdir |
---|
| 17 | |
---|
[e4925fb] | 18 | # name distribution version |
---|
[941db73] | 19 | distribution_name=flexpart_v$version |
---|
| 20 | |
---|
[e4925fb] | 21 | # name distribution temporary dir |
---|
[941db73] | 22 | tarball_tmp=${targetdir}flexpart_v$version |
---|
| 23 | echo tarball_tmp $tarball_tmp |
---|
| 24 | |
---|
[e4925fb] | 25 | # name distribution tarball file |
---|
[348abf6] | 26 | #tarball=${targetdir}flexpart_v$version.tar |
---|
| 27 | tarball=${tarball_tmp}.tar |
---|
[941db73] | 28 | echo tarball $tarball |
---|
[6616daf] | 29 | |
---|
[e4925fb] | 30 | # if needed clean old package |
---|
[a816416] | 31 | if [ -d $tarball_tmp ]; then |
---|
[941db73] | 32 | echo |
---|
| 33 | echo clean old tarball |
---|
| 34 | hora=$(date +"%Y-%m-%d_%H%M%S") |
---|
| 35 | tarball_tmp_bk=$tarball_tmp$tarball_tmp_$hora |
---|
| 36 | echo tarball_tmp=$tarball_tmp exists: move to tarball_tmp_bk=$tarball_tmp_bk #and exit |
---|
| 37 | mkdir $tarball_tmp_bk |
---|
| 38 | mv $tarball_tmp $tarball_tmp_bk/ |
---|
| 39 | mv $tarball $tarball_tmp_bk/ |
---|
| 40 | #exit |
---|
| 41 | echo old files moved to tarball_tmp_bk=$tarball_tmp_bk |
---|
| 42 | echo |
---|
[a816416] | 43 | fi |
---|
| 44 | |
---|
[e4925fb] | 45 | # start packing |
---|
| 46 | ## needs in addition to the git repo ANCILLARY git repos |
---|
| 47 | # VERIFY THESE RESOURCES EXIST BEFORE PACKING DISTRIBUTION |
---|
| 48 | #1 OH file OH_variables.bin || OH_variables=../flexin/OH_FIELDS/OH_variables.bin |
---|
| 49 | #2 flex_extract || flex_extract=../flex_extract_v7.0.4/ |
---|
| 50 | #3 flex_read_fortran from ../flex_read_matlab/export_basic TODO: add functions to ../flex_read_matlab/export/ |
---|
| 51 | # flex_read_matlab_src=../flex_read_matlab/export_basic |
---|
[577bd04] | 52 | #4 tests/examples ../flex_tests_examples/examples/* |
---|
[e4925fb] | 53 | |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | |
---|
| 57 | # mkdir container |
---|
[a816416] | 58 | echo --------------------------------------------------------- |
---|
[941db73] | 59 | echo ')' create basis dir $tarball_tmp |
---|
[6d420c3] | 60 | mkdir $tarball_tmp |
---|
[a816416] | 61 | echo --------------------------------------------------------- |
---|
[941db73] | 62 | |
---|
| 63 | echo |
---|
| 64 | |
---|
[e4925fb] | 65 | # patnames |
---|
[a816416] | 66 | echo --------------------------------------------------------- |
---|
[941db73] | 67 | echo ')' copy pathnames |
---|
[a816416] | 68 | cp pathnames $tarball_tmp/pathnames |
---|
| 69 | echo --------------------------------------------------------- |
---|
[941db73] | 70 | |
---|
| 71 | echo |
---|
| 72 | |
---|
[e4925fb] | 73 | # fortran source files |
---|
[941db73] | 74 | echo --------------------------------------------------------- |
---|
| 75 | echo ')' copy src/ |
---|
[6d420c3] | 76 | mkdir $tarball_tmp/src |
---|
| 77 | cp src/*.f90 $tarball_tmp/src |
---|
[6616daf] | 78 | cp -r src/gributils $tarball_tmp/src |
---|
[6d420c3] | 79 | cp src/makefile $tarball_tmp/src |
---|
[a816416] | 80 | echo --------------------------------------------------------- |
---|
[941db73] | 81 | |
---|
| 82 | echo |
---|
| 83 | |
---|
[e4925fb] | 84 | # options dir |
---|
[941db73] | 85 | echo --------------------------------------------------------- |
---|
| 86 | echo ')' copy options/ |
---|
[e4925fb] | 87 | echo --------------------------------------------------------- |
---|
[a816416] | 88 | mkdir $tarball_tmp/options |
---|
| 89 | user_input_files="AGECLASSES COMMAND IGBP_int1.dat OUTGRID OUTGRID_NEST RECEPTORS RELEASES surfdata.t surfdepo.t" |
---|
| 90 | for i in $user_input_files |
---|
| 91 | do |
---|
| 92 | echo $i |
---|
| 93 | cp -r options/$i $tarball_tmp/options |
---|
| 94 | done |
---|
| 95 | mkdir $tarball_tmp/options/SPECIES |
---|
| 96 | cp options/SPECIES/SPECIES* $tarball_tmp/options/SPECIES/ |
---|
| 97 | cp options/SPECIES/specoverview.f90 $tarball_tmp/options/SPECIES/ |
---|
[941db73] | 98 | echo copy options/SPECIES/ to $tarball_tmp/options/SPECIES/ |
---|
[e4925fb] | 99 | echo --------------------------------------------------------- |
---|
| 100 | |
---|
| 101 | echo |
---|
[941db73] | 102 | |
---|
[e4925fb] | 103 | # OH file |
---|
| 104 | echo --------------------------------------------------------- |
---|
| 105 | echo ')' copy OH_variables.bin to flexin |
---|
| 106 | mkdir $tarball_tmp/flexin |
---|
| 107 | OH_variables=../flexin/OH_FIELDS/OH_variables.bin |
---|
| 108 | cp $OH_variables $tarball_tmp/flexin/ |
---|
[a816416] | 109 | echo --------------------------------------------------------- |
---|
[941db73] | 110 | |
---|
| 111 | echo |
---|
| 112 | |
---|
[e4925fb] | 113 | # AVAILABLE |
---|
[941db73] | 114 | echo --------------------------------------------------------- |
---|
| 115 | echo ')' copy AVAILABLE |
---|
[a816416] | 116 | cp AVAILABLE $tarball_tmp/AVAILABLE |
---|
[941db73] | 117 | echo --------------------------------------------------------- |
---|
| 118 | |
---|
| 119 | echo |
---|
[a816416] | 120 | |
---|
[e4925fb] | 121 | # output |
---|
[a816416] | 122 | echo --------------------------------------------------------- |
---|
[941db73] | 123 | echo ')' create output/ # mkdir $tarball_tmp/output |
---|
[a816416] | 124 | mkdir $tarball_tmp/output |
---|
| 125 | echo --------------------------------------------------------- |
---|
[e4925fb] | 126 | echo output reference? |
---|
| 127 | echo --------------------------------------------------------- |
---|
[941db73] | 128 | |
---|
[e4925fb] | 129 | echo |
---|
[941db73] | 130 | |
---|
[e4925fb] | 131 | # preprocess |
---|
[941db73] | 132 | echo --------------------------------------------------------- |
---|
[a816416] | 133 | echo ')' preprocess/ |
---|
[6616daf] | 134 | mkdir $tarball_tmp/preprocess |
---|
[a816416] | 135 | echo -----------------flex_extract------------------- |
---|
[6616daf] | 136 | mkdir $tarball_tmp/preprocess/flex_extract |
---|
[a2e9de4] | 137 | flex_extract=../flex_extract_v7.0.4/ |
---|
[941db73] | 138 | echo include flex_extract v7.0.4 b7c1c04a204c91e53759ef590504bf52dfaece64 |
---|
| 139 | echo from $flex_extract [use git modules?] IP 3/2018 |
---|
[a2e9de4] | 140 | cp $flex_extract/README.md $tarball_tmp/preprocess/flex_extract |
---|
| 141 | cp -r $flex_extract/docs $tarball_tmp/preprocess/flex_extract |
---|
| 142 | cp -r $flex_extract/grib_templates $tarball_tmp/preprocess/flex_extract |
---|
| 143 | cp -r $flex_extract/python $tarball_tmp/preprocess/flex_extract |
---|
| 144 | cp -r $flex_extract/src $tarball_tmp/preprocess/flex_extract |
---|
[941db73] | 145 | echo flex_extract copied |
---|
| 146 | echo --------------------------------------------------------- |
---|
[e4925fb] | 147 | echo AVAILABLE generation scripts? |
---|
| 148 | echo --------------------------------------------------------- |
---|
[6616daf] | 149 | |
---|
[941db73] | 150 | echo |
---|
| 151 | |
---|
[e4925fb] | 152 | # postprocess |
---|
[a816416] | 153 | echo --------------------------------------------------------- |
---|
[941db73] | 154 | echo ')' postprocess/ |
---|
[a816416] | 155 | |
---|
| 156 | postprocess=postprocess |
---|
| 157 | mkdir $tarball_tmp/$postprocess |
---|
| 158 | echo -----------------flex_read_fortran------------------- |
---|
[e4925fb] | 159 | flex_read_fortran_src=$postprocess/flex_read_fortran/ |
---|
[a816416] | 160 | mkdir $tarball_tmp/$postprocess/flex_read_fortran |
---|
| 161 | cp $postprocess/flex_read_fortran/*.f $tarball_tmp/$postprocess/flex_read_fortran |
---|
| 162 | cp $postprocess/flex_read_fortran/*.f90 $tarball_tmp/$postprocess/flex_read_fortran |
---|
| 163 | cp $postprocess/flex_read_fortran/makefile $tarball_tmp/$postprocess/flex_read_fortran |
---|
[e4925fb] | 164 | echo flex_read_fortran copied from $flex_read_fortran_src |
---|
[a816416] | 165 | |
---|
| 166 | echo -----------------flex_read_matlab------------------- |
---|
[e4925fb] | 167 | flex_read_matlab_src=../flex_read_matlab/export_basic |
---|
| 168 | mkdir $tarball_tmp/$postprocess/flex_read_matlab |
---|
| 169 | cp -r $flex_read_matlab_src/* $tarball_tmp/$postprocess/flex_read_matlab |
---|
| 170 | echo flex_read_fortran from $flex_read_matlab_src # NOT copied |
---|
[941db73] | 171 | echo --------------------------------------------------------- |
---|
[6616daf] | 172 | |
---|
[941db73] | 173 | echo |
---|
[6616daf] | 174 | |
---|
[a816416] | 175 | echo --------------------------------------------------------- |
---|
[941db73] | 176 | echo ')' tests/ |
---|
[a816416] | 177 | #echo '13) tests' |
---|
[6d420c3] | 178 | mkdir $tarball_tmp/tests |
---|
[e4925fb] | 179 | echo ----------------- examples ------------------- |
---|
[a816416] | 180 | |
---|
| 181 | mkdir $tarball_tmp/tests/examples |
---|
[e4925fb] | 182 | cp -r ../flex_tests_examples/examples3/* $tarball_tmp/tests/examples/ |
---|
| 183 | |
---|
| 184 | echo ----------------- examples_reference ------------------- |
---|
| 185 | cp -r ./tests/examples_reference $tarball_tmp/tests/ |
---|
| 186 | |
---|
| 187 | echo -----------------read examples------------------- |
---|
[a816416] | 188 | |
---|
| 189 | mkdir $tarball_tmp/tests/read_examples |
---|
[e4925fb] | 190 | |
---|
| 191 | cp tests/read_examples/declare_examples $tarball_tmp/tests/read_examples/ |
---|
| 192 | cp tests/read_examples/display_examples.sh $tarball_tmp/tests/read_examples/ |
---|
| 193 | cp tests/read_examples/examples_output.txt $tarball_tmp/tests/read_examples/ |
---|
| 194 | cp tests/read_examples/read_examples.sh $tarball_tmp/tests/read_examples/ |
---|
[a816416] | 195 | cp tests/read_examples/read_grids.sh $tarball_tmp/tests/read_examples/ |
---|
[e4925fb] | 196 | cp tests/read_examples/read_parts.sh $tarball_tmp/tests/read_examples/ |
---|
| 197 | cp tests/read_examples/set_examples_all $tarball_tmp/tests/read_examples/ |
---|
| 198 | cp tests/read_examples/set_examples_3.sh $tarball_tmp/tests/read_examples/ |
---|
[a816416] | 199 | cp tests/read_examples/read_headers.sh $tarball_tmp/tests/read_examples/ |
---|
[e4925fb] | 200 | cp tests/read_examples/read_examples_output.txt $tarball_tmp/tests/ #read_examples/ |
---|
[a816416] | 201 | |
---|
[e4925fb] | 202 | echo ------------compare examples------------------- |
---|
| 203 | mkdir $tarball_tmp/tests/compare_examples |
---|
| 204 | |
---|
[a816416] | 205 | |
---|
[e4925fb] | 206 | cp tests/compare_examples/*.sh $tarball_tmp/tests/compare_examples |
---|
| 207 | cp tests/compare_examples/compare_grids_output.txt $tarball_tmp/tests/ #compare_examples |
---|
[a816416] | 208 | |
---|
[941db73] | 209 | echo |
---|
[a816416] | 210 | |
---|
[941db73] | 211 | echo --------------------------------------------------------- |
---|
| 212 | echo create tarball |
---|
| 213 | |
---|
| 214 | cd $targetdir |
---|
| 215 | tar cf $distribution_name.tar $distribution_name |
---|
| 216 | |
---|
| 217 | pwd |
---|
[a816416] | 218 | |
---|
[941db73] | 219 | echo tarball $tarball complete |
---|
[348abf6] | 220 | echo exported untarred files in $tarball_tmp |
---|
[e4925fb] | 221 | |
---|
[577bd04] | 222 | echo verify: |
---|
[e4925fb] | 223 | echo cp -r preprocess/flex_extract/work $tarball_tmp/preprocess/flex_extract/ |
---|
| 224 | echo cd $tarball_tmp/src |
---|
| 225 | echo $HOME/repos/flexpart/src/make_in_laptop.sh |
---|
| 226 | echo cd .. ';' ./src/FLEXPART |
---|
| 227 | echo cd postprocess/flex_read_fortran |
---|
| 228 | echo make test |
---|
[577bd04] | 229 | echo e.g.: max: 0.115784094 mean: 4.70877676E-05 |
---|
[e4925fb] | 230 | echo cd ../../tests/examples ';' make run |
---|
| 231 | echo cd ../read_examples |
---|
| 232 | echo ./read_examples.sh |
---|
| 233 | echo ./read_examples.sh '>' ../read_examples_output.txt |
---|
| 234 | echo cd ../compare_examples |
---|
| 235 | echo ./compare_grids.sh |
---|
| 236 | echo ./compare_grids.sh '>' ../compare_grids_output.txt |
---|
| 237 | |
---|
| 238 | echo e.g. tar --append --file=$tarball_tmp/ ../compare_grids_output.txt ../read_examples_output.txt |
---|
| 239 | |
---|