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
SSHC
Commits
49eeb463
Commit
49eeb463
authored
Feb 06, 2018
by
saeed
Browse files
a bit modification to sshval.py
parent
632e3966
Changes
1
Hide whitespace changes
Inline
Side-by-side
sshval.py
View file @
49eeb463
...
...
@@ -5,6 +5,7 @@ import requests as req
import
matplotlib.pyplot
as
plt
import
json
import
datetime
from
scipy
import
stats
from
taylorDiagram
import
TaylorDiagram
reload
(
sys
)
sys
.
setdefaultencoding
(
'utf8'
)
...
...
@@ -52,11 +53,12 @@ def fillObs(date_obs,fromt, tot):
if
strDate
(
initd
)
not
in
date_obs
:
dmiss
[
strDate
(
initd
)]
=
{}
dmcor
[
strDate
(
initd
)]
=
{}
dmcor
[
strDate
(
initd
)][
"raw"
]
=
-
999.0
dmcor
[
strDate
(
initd
)][
"raw"
]
=
-
999
9
.0
dmiss
[
strDate
(
initd
)][
"raw"
]
=
np
.
nan
initd
=
initd
+
step
return
dmcor
#return dmiss
def
biasMean
(
vobs
,
vmodel
):
...
...
@@ -65,6 +67,7 @@ def biasMean(vobs, vmodel):
sys
.
exit
()
return
np
.
mean
(
vobs
-
vmodel
)
#return stats.nanmean(vobs- vmodel)
def
readConfig
():
...
...
@@ -93,10 +96,14 @@ def readConfig():
def
readObs
(
server
,
station
,
startdate
,
enddate
,
obstyle
):
if
server
[
"prod"
]:
param
=
{
'from'
:
startdate
,
'too'
:
enddate
}
if
server
[
"utv"
]:
param
=
{
'highfreq'
:
'false'
,
'from'
:
startdate
,
'too'
:
enddate
}
if
server
[
"prod"
]:
res
=
req
.
get
(
"http://oceandata.smhi.se/ssh/"
+
station
+
"/OBSERVATION"
,
params
=
param
)
if
server
[
"utv"
]:
res
=
req
.
get
(
"http://oceandata-utv.smhi.se/ssh/"
+
station
+
"/OBSERVATION"
,
params
=
param
)
if
server
[
"prod"
]:
print
"prod server"
param
=
{
'from'
:
startdate
,
'too'
:
enddate
}
res
=
req
.
get
(
"http://oceandata.smhi.se/ssh/"
+
station
+
"/OBSERVATION"
,
params
=
param
)
if
server
[
"utv"
]:
print
"utv server"
param
=
{
'highfreq'
:
'false'
,
'from'
:
startdate
,
'too'
:
enddate
}
res
=
req
.
get
(
"http://oceandata-utv.smhi.se/ssh/"
+
station
+
"/OBSERVATION"
,
params
=
param
)
dobs
=
res
.
json
()
date_obs
=
dobs
.
keys
()
dmiss
=
fillObs
(
date_obs
,
startdate
,
enddate
)
...
...
@@ -106,7 +113,9 @@ def readObs(server,station, startdate,enddate,obstyle):
voc
=
pd
.
DataFrame
.
from_dict
(
dobs
,
orient
=
"index"
)
vobc
=
voc
.
loc
[
startdate
:
enddate
].
values
vobsc
=
np
.
squeeze
(
vobc
)
vobsm
=
np
.
ma
.
masked_where
(
vobsc
==-
999.0
,
vobsc
)
print
vobsc
vobsm
=
np
.
ma
.
masked_where
(
vobsc
==-
9999.0
,
vobsc
)
print
vobsm
obstd
=
np
.
std
(
vobsm
)
rms
.
append
(
round
(
obstd
,
3
))
cor
.
append
(
1.0
)
...
...
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