Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
saeed
odb_panel
Commits
5a114c2a
Commit
5a114c2a
authored
Nov 15, 2019
by
saeed
Browse files
m
parent
5c2187c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
functionsodb.sh
0 → 100644
View file @
5a114c2a
function
getyear
(){
time_d
=
${
1
}
year
=
`
echo
${
time_d
}
|cut
-d-
-f1
`
echo
${
year
}
}
function
getmon
(){
time_d
=
${
1
}
mon
=
`
echo
${
time_d
}
|
cut
-d-
-f2
`
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
`
mon
=
`
echo
${
time_d
}
|
cut
-d-
-f2
`
day
=
`
echo
${
time_d
}
|
cut
-d-
-f3
`
echo
${
year
}${
mon
}${
day
}
}
function
addbackslash
(){
str
=
${
1
}
echo
${
str
/,/\\\/
}
}
function
output_name
(){
fin
=
${
1
}
fout
=
${
fin
/
".odb"
/
".txt"
}
echo
${
fout
}
}
function
output_name_cycle
(){
fin
=
${
1
}
cycle
=
${
2
}
fout
=
${
fin
/
".txt"
/
}
fout_cycle
=
${
fout
}
"_cycle""
${
cycle
}
"".txt"
echo
${
fout_cycle
}
}
function
ismonthly
(){
result
=
0
date1
=
$1
date2
=
$2
y1
=
`
getyear
${
date1
}
`
y2
=
`
getyear
${
date2
}
`
m1
=
`
getmon
${
date1
}
`
m2
=
`
getmon
${
date2
}
`
if
[
${
y1
}
-eq
${
y2
}
-a
${
m1
}
-eq
${
m2
}
]
;
then
result
=
1
fi
echo
${
result
}
}
function
do_filter
(){
fin
=
${
1
}
fout
=
${
fin
/
".odb"
/
".txt"
}
if
[
-f
${
fin
}
]
;
then
odb sql
'SELECT
date@hdr,
time@hdr,
lat@hdr,
lon@hdr,
obsvalue@body,
varno@body,
codetype@hdr,
count(*)
WHERE
datum_status.active@body == 1'
-i
${
fin
}
-o
${
fout
}
fi
}
odb_manger.sh
View file @
5a114c2a
...
...
@@ -7,112 +7,36 @@
module add odb/1.0.3
module add odb_api/0.19.1
function
getyear
(){
time_d
=
${
1
}
year
=
`
echo
${
time_d
}
|cut
-d-
-f1
`
echo
${
year
}
}
function
getmon
(){
time_d
=
${
1
}
mon
=
`
echo
${
time_d
}
|
cut
-d-
-f2
`
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
`
mon
=
`
echo
${
time_d
}
|
cut
-d-
-f2
`
day
=
`
echo
${
time_d
}
|
cut
-d-
-f3
`
echo
${
year
}${
mon
}${
day
}
}
function
addbackslash
(){
str
=
${
1
}
echo
${
str
/,/\\\/
}
}
function
output_name
(){
fin
=
${
1
}
fout
=
${
fin
/
".odb"
/
".txt"
}
echo
${
fout
}
}
function
output_name_cycle
(){
fin
=
${
1
}
cycle
=
${
2
}
fout
=
${
fin
/
".txt"
/
}
fout_cycle
=
${
fout
}
"_cycle""
${
cycle
}
"".txt"
echo
${
fout_cycle
}
}
function
ismonthly
(){
result
=
0
date1
=
$1
date2
=
$2
y1
=
`
getyear
${
date1
}
`
y2
=
`
getyear
${
date2
}
`
m1
=
`
getmon
${
date1
}
`
m2
=
`
getmon
${
date2
}
`
if
[
${
y1
}
-eq
${
y2
}
-a
${
m1
}
-eq
${
m2
}
]
;
then
result
=
1
fi
echo
${
result
}
}
function
do_filter
(){
fin
=
${
1
}
fout
=
${
fin
/
".odb"
/
".txt"
}
if
[
-f
${
fin
}
]
;
then
odb sql
'SELECT
date@hdr,
time@hdr,
lat@hdr,
lon@hdr,
obsvalue@body,
varno@body,
codetype@hdr,
count(*)
WHERE
datum_status.active@body == 1'
-i
${
fin
}
-o
${
fout
}
fi
}
.
./functionsodb.sh
do_era5
=
1
do_precise
=
0
do_only_monthy
=
1
use_report_file
=
0
report_type_filename
=
"report_type_list"
list_report
=(
16001 16005
)
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/"
list_report
=[]
startdate
=
"2017-01-01"
enddate
=
"2017-01-02"
time_cycle
=
"00,12"
if
[
${
use_report_file
}
-eq
1
]
;
then
if
[
!
-f
report_type_
list
]
;
then
echo
"please provide the file named report_type_
list
"
if
[
!
-f
${
report_type_
filename
}
]
;
then
echo
"please provide the file named
${
report_type_
filename
}
"
exit
fi
list_report
=(
`
cat
report_type_list
`
)
else
list_report
=(
16001 16005
)
list_report
=(
`
cat
${
report_type_filename
}
`
)
fi
startdate
=
"2017-01-01"
enddate
=
"2017-01-02"
time_cycle
=
"00,12"
checkmonthly
=
`
ismonthly
${
startdate
}
${
enddate
}
`
if
[
${
checkmonthly
}
-eq
0
]
;
then
echo
"we
only support
the monthly data retrieval from mars"
if
[
${
do_only_monthy
}
-eq
1
-a
${
checkmonthly
}
-eq
0
]
;
then
echo
"we
chose
the monthly data retrieval from mars"
echo
"please adjust the startdate
${
startdate
}
or enddate
${
enddate
}
"
exit
fi
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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