Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
IPSL
SIRTA
CL31
CL raw to 1a
Commits
d25ccbf3
Commit
d25ccbf3
authored
Jan 24, 2022
by
Marc-Antoine Drouin
Browse files
add file checking for P7
parent
83424471
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
36 deletions
+49
-36
run_raw2l1.sh
run_raw2l1.sh
+49
-36
No files found.
run_raw2l1.sh
View file @
d25ccbf3
...
...
@@ -152,8 +152,8 @@ if [[ $ERREUR != 0 ]]; then
exit
1
fi
if
[[
$fich_type
!=
"SIRTA"
&&
$fich_type
!=
"MF"
]]
;
then
echo
"Le type de fichier doit etre SIRTA ou
MF
"
if
[[
$fich_type
!=
"SIRTA"
&&
$fich_type
!=
"MF"
&&
$fich_type
!=
"P7"
]]
;
then
echo
"Le type de fichier doit etre SIRTA
, MF
ou
P7
"
exit
1
fi
...
...
@@ -233,14 +233,14 @@ fi
# create temp directory for data
tmp_check
=
$(
mktemp
-d
-p
"
$REP_TRAVAIL
"
)
consignerMsg
"Vérification des données brutes"
for
file_
in
"
${
input_files
[@]
}
"
;
do
consignerMsg
"Vérification des données brutes"
tmp_file_
=
$(
basename
"
$file_
"
)
cl31_cor
=
"
$tmp_check
/
${
tmp_file_
%.*
}
.cor"
if
[[
$fich_type
==
"SIRTA"
]]
;
the
n
case
$fich_type
i
n
"SIRTA"
)
awk
--posix
-v
cl31_cor
=
"
$cl31_cor
"
'\
BEGIN {l=1;p=0;e=0;printf "" > cl31_cor}
NR<3 {print $0 >> cl31_cor;next}
...
...
@@ -254,9 +254,8 @@ for file_ in "${input_files[@]}"; do
p==1 {printf bloc"\n" >> cl31_cor;l=1;p=0}
e==1 {err++;print NR;l=1}
END {if ($0 ~ "File") printf "\n%s\n",$0>>cl31_cor; if (err>0)print "err=",err}'
"
$file_
"
elif
[[
$fich_type
==
"MF"
]]
;
then
;;
"MF"
)
awk
--posix
-v
cl31_cor
=
"
$cl31_cor
"
'\
BEGIN {l=1;p=0;e=0;printf "" > cl31_cor}
l==1 {if ($0 ~ /^[\001]$/) {l++;bloc=$0;e=0;next} else if (e==1) {next} else e=1}
...
...
@@ -270,8 +269,22 @@ for file_ in "${input_files[@]}"; do
p==1 {printf bloc"\n" >> cl31_cor;l=1;p=0}
e==1 {err++;print NR;l=1}
END {if ($0 ~ "File") printf "\n%s\n",$0>>cl31_cor; if (err>0)print "err=",err}'
"
$file_
"
fi
;;
"P7"
)
awk
--posix
-v
cl31_cor
=
"
$cl31_cor
"
'\
BEGIN {l=1;p=0;e=0;printf "" > cl31_cor}
NR<3 {print $0 >> cl31_cor;next}
l==1 {if ($0 ~ /^-[0-9-]{10} [0-9:]{8}.$/) {l++;bloc=$0;e=0;next} else if (e==1) {next} else e=1}
l==2 {if ($0 ~ /^[\001]CL020123[\002].$/) {l++;bloc=bloc"\n"$0;next} else e=1}
l==3 {if (NF==5) {l++;bloc=bloc"\n"$0;next} else e=1}
l==4 {if (NF==10) {l++;bloc=bloc"\n"$0;next} else e=1}
l==5 {if (NF==10) {l++;bloc=bloc"\n"$0;next} else e=1}
l==6 {if (length($0) == 7501) {l++;bloc=bloc"\n"$0;next} else e=1}
l==7 {if ($0 ~ /^[\003][0-9a-z]{4}[\004].$/) {p=1;bloc=bloc"\n"$0} else e=1}
p==1 {printf bloc"\n" >> cl31_cor;l=1;p=0}
e==1 {err++;print NR;l=1}
END {if ($0 ~ "File") printf "\n%s\n",$0>>cl31_cor; if (err>0)print "err=",err}'
"
$file_
"
esac
done
mapfile
-t
input_files < <
(
find
"
$tmp_check
"
-name
"*.cor"
|
sort
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment