Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
saeed
odb_panel
Commits
a8076a34
Commit
a8076a34
authored
Nov 19, 2019
by
saeed
Browse files
new version
parent
15ff76ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
odb_manger.sh
View file @
a8076a34
...
...
@@ -9,22 +9,21 @@ module add odb_api/0.19.1
.
./functionsodb.sh
do_era5
=
1
do_precise
=
0
do_era5
=
0
do_precise
=
1
do_only_monthy
=
1
use_report_file
=
0
report_type_filename
=
"report_type_list"
list_report
=(
16001
)
startdate
=
"2017-01-01"
enddate
=
"2017-01-06"
time_cycle
=
"12"
PRECISE_ODB_DIR
=
"/scratch/ms/se/smdk/scratchdir/"
OUTPUT_DIR
=
"/home/ms/se/smdk/odb_panel/OUTPUT"
path_cycle
=
"/home/ms/se/smdk/odb_panel/bin/"
startdate
=
"2017-01-01"
enddate
=
"2017-01-20"
time_cycle
=
"21"
if
[
${
use_report_file
}
-eq
1
]
;
then
if
[
!
-f
${
report_type_filename
}
]
;
then
echo
"please provide the file named
${
report_type_filename
}
"
...
...
@@ -109,6 +108,38 @@ if [ ${do_era5} -eq 1 ];then
done
fi
rm
-f
start_end.dat 2>/dev/null
./bin/date_range.exe
${
startdate_out
}
${
enddate_out
}
if
[
!
-f
start_end.dat
]
;
then
echo
"start_end.dat file does not exist"
exit
fi
list
=(
`
cat
start_end.dat
`
)
len
=
${#
list
[*]
}
len
=
$((
len
/
2
))
len_m1
=
$((
len
-
1
))
year_array
=[]
mon_array
=[]
day_array1
=[]
day_array2
=[]
for
j
in
`
seq
0
${
len_m1
}
`
;
do
j1
=
$((
j
*
2
+
0
))
j2
=
$((
j
*
2
+
1
))
year
=
`
getyear_1
${
list
[
${
j1
}
]
}
`
month
=
`
getmonth_1
${
list
[
${
j1
}
]
}
`
dy1
=
`
getday_1
${
list
[
${
j1
}
]
}
`
dy2
=
`
getday_1
${
list
[
${
j2
}
]
}
`
year_array[
${
j
}
]=
${
year
}
mon_array[
${
j
}
]=
${
month
}
day_array1[
${
j
}
]=
${
dy1
}
day_array2[
${
j
}
]=
${
dy2
}
done
if
[
${
do_precise
}
-eq
1
]
;
then
...
...
@@ -116,20 +147,10 @@ if [ ${do_precise} -eq 1 ];then
echo
"directory
${
PRECISE_ODB_DIR
}
does not exist"
exit
fi
year
=
"
`
getyear
${
startdate
}
`
"
mon
=
"
`
getmon
${
startdate
}
`
"
if
[
!
-d
${
PRECISE_ODB_DIR
}
/
${
year
}
/
${
mon
}
]
;
then
echo
"directory
${
PRECISE_ODB_DIR
}
/
${
year
}
/
${
mon
}
does not exist"
exit
fi
cd
${
PRECISE_ODB_DIR
}
cd
${
year
}
cd
${
mon
}
HERE_P
=
`
pwd
`
for
j
in
${
!list_report[*]
}
;
do
report_type
=
${
list_report
[j]
}
nc
=
`
echo
${
time_cycle
}
|
awk
-F
','
'{print NF}'
`
...
...
@@ -141,8 +162,7 @@ if [ ${do_precise} -eq 1 ];then
fi
done
done
for
j
in
${
!list_report[*]
}
;
do
cd
${
HERE_P
}
report_type
=
${
list_report
[j]
}
...
...
@@ -151,29 +171,46 @@ if [ ${do_precise} -eq 1 ];then
vb
=
`
echo
${
time_cycle
}
|
cut
-d
,
-f
${
nf
}
`
fout
=
"odb_precise_
${
report_type
}
_
${
startdate_out
}
_
${
enddate_out
}
_cycle
${
vb
}
.txt"
if
[
!
-f
${
OUTPUT_DIR
}
/
${
fout
}
]
;
then
for
va
in
${
drange
[*]
}
;
do
echo
"va "
${
va
}
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
\
for
ii
in
${
!year_array[*]
}
;
do
iy
=
${
year_array
[
${
ii
}
]
}
im
=
${
mon_array
[
${
ii
}
]
}
id1
=
${
day_array1
[
${
ii
}
]
}
id2
=
${
day_array2
[
${
ii
}
]
}
cd
${
HERE_P
}
for
dy
in
`
seq
-w
${
id1
}
${
id2
}
`
;
do
va
=
"
${
iy
}
/
${
im
}
/
${
dy
}
"
if
[
-d
"
${
va
}
"
/
"
${
vb
}
"
/odb_ccma/CCMA
]
;
then
echo
"va "
${
va
}
cd
"
${
va
}
"
/
"
${
vb
}
"
/odb_ccma/CCMA
pwd
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
fi
cd
${
HERE_P
}
done
cd
${
HERE_P
}
done
cd
${
HERE_P
}
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
>>
${
OUTPUT_DIR
}
/
${
fout
}
for
ii
in
${
!year_array[*]
}
;
do
iy
=
${
year_array
[
${
ii
}
]
}
im
=
${
mon_array
[
${
ii
}
]
}
id1
=
${
day_array1
[
${
ii
}
]
}
id2
=
${
day_array2
[
${
ii
}
]
}
cd
${
HERE_P
}
for
dy
in
`
seq
-w
${
id1
}
${
id2
}
`
;
do
va
=
"
${
iy
}
/
${
im
}
/
${
dy
}
"
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
>>
${
OUTPUT_DIR
}
/
${
fout
}
fi
fi
fi
cd
${
HERE_P
}
cd
${
HERE_P
}
done
done
cd
${
HERE_P
}
fi
done
cd
${
HERE_P
}
done
fi
...
...
Write
Preview
Supports
Markdown
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