Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
saeed
odb_panel
Commits
de5f54bc
Commit
de5f54bc
authored
Nov 13, 2019
by
saeed
Browse files
new version
parent
73383271
Changes
1
Hide whitespace changes
Inline
Side-by-side
odb_manger.sh
View file @
de5f54bc
...
...
@@ -4,6 +4,7 @@
##SBATCH -e err
##SBATCH -o log
module add odb/1.0.3
module add odb_api/0.19.0
function
getyear
(){
...
...
@@ -18,6 +19,12 @@ function getmon(){
echo
${
mon
}
}
function
getday
(){
time_d
=
${
1
}
day
=
`
echo
${
time_d
}
|
cut
-d-
-f3
`
echo
${
day
}
}
function
yearmonday
(){
time_d
=
${
1
}
year
=
`
echo
${
time_d
}
|cut
-d-
-f1
`
...
...
@@ -71,15 +78,15 @@ function do_filter(){
fi
}
do_era5
=
1
do_era5
=
0
do_precise
=
1
PRECISE_ODB_DIR
=
""
PRECISE_ODB_DIR
=
"
/scratch/ms/se/smdk/scratchdir/
"
OUTPUT_DIR
=
"OUTPUT"
list_report
=(
16001 16005
)
startdate
=
"2017-01-01"
enddate
=
"2017-01-
1
0"
enddate
=
"2017-01-0
5
"
time_cycle
=
"00,12"
checkmonthly
=
`
ismonthly
${
startdate
}
${
enddate
}
`
...
...
@@ -93,6 +100,17 @@ fi
time_cycle_out
=
`
addbackslash
${
time_cycle
}
`
startdate_out
=
`
yearmonday
${
startdate
}
`
enddate_out
=
`
yearmonday
${
enddate
}
`
day_1
=
`
getday
${
startdate
}
`
day_2
=
`
getday
${
enddate
}
`
drange
=[]
ii
=
0
for
j
in
`
seq
-w
${
day_1
}
${
day_2
}
`
;
do
drange[
${
ii
}
]=
${
j
}
ii
=
$((
ii
+
1
))
done
HERE
=
`
pwd
`
echo
${
startdate_out
}
...
...
@@ -120,7 +138,7 @@ fi
if
[
${
do_precise
}
-eq
1
]
;
then
if
[
!
-d
${
PRECISE_ODB_DIR
}
]
;
then
echo
"directory
${
PRECISE_ODB_DIR
}
does not exist"
exit
...
...
@@ -134,47 +152,50 @@ if [ ${do_precise} -eq 1 ];then
fi
cd
${
PRECISE_ODB_DIR
}
cd
${
year
}
cd
${
mon
}
HERE_P
=
`
pwd
`
list
=
`
ls
-d
*
/
`
nc
=
`
echo
${
time_cycle
}
|
awk
-F
','
'{print NF}'
`
for
va
in
${
list
}
;
do
for
nf
in
`
seq
1
${
nc
}
`
;
do
vb
=
`
echo
${
time_cycle
}
|
cut
-d
,
-f
${
nf
}
`
if
[
-d
${
va
}
/
${
vb
}
/odb_ccma/CCMA
]
;
then
cd
${
va
}
/
${
vb
}
/odb_ccma/CCMA
dcagen
odbsql
-q
"select andate,antime,degrees(lat),degrees(lon),varno,codetype, count(*) from hdr,desc,body where
\
obsvalue/=
\"
NULL
\"
and reportype in (
${
report_type
}
)"
|
grep
-v
"obsvalue"
>
odb_precise_
${
report_type
}
_
${
vb
}
.txt
fi
cd
${
HERE_P
}
done
for
j
in
${
!list_report[*]
}
;
do
cd
${
HERE_P
}
report_type
=
${
list_report
[j]
}
nc
=
`
echo
${
time_cycle
}
|
awk
-F
','
'{print NF}'
`
fout
=
"odb_precise_
${
report_type
}
_
${
startdate_out
}
_
${
enddate_out
}
_cycle
${
vb
}
.txt"
if
[
!
-f
${
OUTPUT
}
/
${
fout
}
]
;
then
for
va
in
${
drange
[*]
}
;
do
echo
"va "
${
va
}
for
nf
in
`
seq
1
${
nc
}
`
;
do
vb
=
`
echo
${
time_cycle
}
|
cut
-d
,
-f
${
nf
}
`
if
[
-d
"
${
va
}
"
/
"
${
vb
}
"
/odb_ccma/CCMA
]
;
then
cd
"
${
va
}
"
/
"
${
vb
}
"
/odb_ccma/CCMA
dcagen
odbsql
-q
"select andate,antime,degrees(lat),degrees(lon),varno,codetype, count(*) from hdr,desc,body where
\
obsvalue/=
\"
NULL
\"
and reportype in (
${
report_type
}
)"
|
grep
-v
"obsvalue"
>
odb_precise_
${
report_type
}
_
${
vb
}
.txt
fi
cd
${
HERE_P
}
done
cd
${
HERE_P
}
done
cd
${
HERE_P
}
nc
=
`
echo
${
time_cycle
}
|
awk
-F
','
'{print NF}'
`
for
nf
in
`
seq
1
${
nc
}
`
;
do
vb
=
`
echo
${
time_cycle
}
|
cut
-d
,
-f
${
nf
}
`
fout
=
"odb_precise_
${
report_type
}
_
${
startdate_out
}
_
${
enddate_out
}
_cycle
${
vb
}
.txt"
for
va
in
${
drange
[*]
}
;
do
if
[
-d
${
va
}
/
${
vb
}
/odb_ccma/CCMA
]
;
then
cd
${
va
}
/
${
vb
}
/odb_ccma/CCMA
if
[
-f
odb_precise_
${
report_type
}
_
${
vb
}
.txt
]
;
then
sed
'1d'
odb_precise_
${
report_type
}
_
${
vb
}
.txt
>>
${
fout
}
fi
fi
done
cd
${
HERE_P
}
if
[
-f
${
fout
}
]
;
then
mv
${
fout
}
${
OUTPUT
}
;
fi
done
cd
${
HERE_P
}
fi
done
fi
cd
${
HERE
}
#!/bin/bash
HERE
=
`
pwd
`
list
=
`
ls
-d
*
/
`
report_type
=
"16005"
fout
=
${
HERE
}
/
"odb_precise_
${
report_type
}
_cycle12.txt"
rm
-f
${
fout
}
2>/dev/null
for
va
in
${
list
}
;
do
vb
=
12
cd
${
va
}
/
${
vb
}
/odb_ccma/CCMA
if
[
-f
odb_precise_
${
report_type
}
_
${
vb
}
.txt
]
;
then
sed
'1d'
odb_precise_
${
report_type
}
_
${
vb
}
.txt
>>
${
fout
}
fi
cd
${
HERE
}
done
cd
${
HERE
}
\ No newline at end of file
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