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