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