TNO Intern
Skip to content
GitLab
Explore
Sign in
CAMS
CSO
Compare revisions
69c32484973da6ebd22173c2560cb2bb5275c318 to 51e704d93ec25024a37e1f7fea8bffd63b92c9cf
Commits on Source (2)
Improved check on undefined href fields in inquiry listing.
· 822cdb96
Arjo Segers
authored
Nov 15, 2023
822cdb96
Trap errors from "requests.get" during inquire.
· 51e704d9
Arjo Segers
authored
Nov 15, 2023
51e704d9
Hide whitespace changes
Inline
Side-by-side
py/cso_dataspace.py
View file @
51e704d9
...
...
@@ -4,6 +4,9 @@
# 2023-10, Arjo Segers
# Tools to access Copernicus DataSpace.
#
# 2023-10, Arjo Segers
# Trap errors from "requests.get" during inquire.
#
########################################################################
###
...
...
@@ -293,10 +296,10 @@ class CSO_DataSpace_Inquire(utopya.UtopyaRc):
maxtry
=
5
# repeat a few times if necessary:
while
ntry
<=
maxtry
:
# send query to search page; no authorization is needed ...
r
=
requests
.
get
(
search_url
,
params
=
params
)
# check status, raise error if request failed:
try
:
# send query to search page; no authorization is needed ...
r
=
requests
.
get
(
search_url
,
params
=
params
)
# check status, raise error if request failed:
r
.
raise_for_status
()
except
Exception
as
err
:
msg
=
str
(
err
)
...
...
py/cso_s5p.py
View file @
51e704d9
...
...
@@ -21,6 +21,9 @@
# 2023-09, Arjo Segers
# Fixed bug in definition of listing file dates from rcfile settings.
#
# 2023-11, Arjo Segers
# Improved check on undefined 'href' fields in inquiry listing.
#
#
########################################################################
...
...
@@ -2469,8 +2472,14 @@ class CSO_S5p_Convert(utopya.UtopyaRc):
# info ..
logging
.
info
(
"
not present yet, download ...
"
)
# check ..
if
(
"
href
"
not
in
rec
.
keys
())
or
numpy
.
isnan
(
rec
[
"
href
"
]):
logging
.
error
(
f
"
cannot download, no
'
href
'
element in record ...
"
)
if
"
href
"
not
in
rec
.
keys
():
logging
.
error
(
f
"
cannot download, no
'
href
'
column in inquiry ...
"
)
logging
.
error
(
f
"
check inquiry table:
{
filename
}
"
)
raise
Exception
# endif
if
pandas
.
isna
(
rec
[
"
href
"
]):
logging
.
error
(
f
"
cannot download, empty
'
href
'
element in inquiry ...
"
)
logging
.
error
(
f
"
check inquiry table:
{
filename
}
"
)
raise
Exception
# endif
# download ...
...
...