Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MetObsSite
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MetObs
MetObsSite
Merge requests
!1
Add information on selecting quicklook data for download
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Add information on selecting quicklook data for download
refactor-code-cleanup
into
develop
Overview
0
Commits
5
Pipelines
0
Changes
23
Merged
David Hoese
requested to merge
refactor-code-cleanup
into
develop
6 years ago
Overview
0
Commits
5
Pipelines
0
Changes
23
Expand
Closes
#2 (closed)
Needs a rerender still and possible other cleanups.
Edited
6 years ago
by
David Hoese
0
0
Merge request reports
Compare
develop
version 2
ce196d93
6 years ago
version 1
365d62d7
6 years ago
develop (base)
and
latest version
latest version
f5ea68aa
5 commits,
6 years ago
version 2
ce196d93
4 commits,
6 years ago
version 1
365d62d7
3 commits,
6 years ago
23 files
+
3801
−
2066
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
23
Search (e.g. *.vue) (Ctrl+P)
cgi-bin~/iqeye/ls.cgi
0 → 100755
+
123
−
0
Options
#!/var/www/wsgi/python-env/metobs/bin/python
"""
List available EyeQ Camera images.
See `print_usage()` for more information
"""
import
cgi
import
cgitb
;
cgitb
.
enable
()
import
os
import
sys
from
datetime
import
datetime
from
datetime
import
timedelta
from
metobs
import
mytime
form
=
cgi
.
FieldStorage
()
def
get
(
name
,
default
=
None
):
if
form
.
has_key
(
name
):
return
form
[
name
].
value
return
default
def
print_usage
():
print
"
ContentType: text/plain
"
print
print
"""
Provides image listings of SSEC RIG EyeQ Camera images.
Because the images may not be exactly spaced, being that processing may increase
the interval, images are listed by searching between the date provided and that
date plus the image resolution.
Parameters
==========
cam - (required) Camera name. West, East, etc ...
d - Date of image in CST (YYYY-MM-DD HH:MM:SS). Defaults to current time.
"""
#: resolution at which images are generated
image_rez
=
10
#: timezone for image filename times
image_tz
=
mytime
.
OffsetTimezone
(
6
)
hostname
=
'
tahiti.ssec.wisc.edu
'
#: convert a file path to a server path`
url_for
=
lambda
fpth
:
"
http://
"
+
hostname
+
fpth
.
replace
(
"
/beach
"
,
"
/pub
"
)
def
image_path
(
cam
,
dt
):
"""
Get a path for an image on disk.
:param cam: Name of the camera
:param dt: datetime of the image file used to parse the name
"""
basedir
=
'
/beach/incoming/Instrument_Data/METOBS/RIG/Cameras
'
return
os
.
path
.
join
(
basedir
,
cam
+
dt
.
strftime
(
'
/%Y/%m/%d/%H_%M_%S.trig+00.jpg
'
))
#
#
# You shouldn't need to change anything below here
#
#
def
redirect_to
(
url
):
print
"
Status: 302 Moved
"
print
"
Location:
"
+
url
print
def
file_not_found
():
print
"
Status: 404 File Not Found
"
print
def
headers
(
typ
=
'
plain
'
):
print
"
ContentType: text/
"
+
typ
print
def
main
():
# required parameter
camera
=
get
(
'
cam
'
)
if
not
camera
:
print_usage
()
return
1
# parse data from parameter, defaulting to current time in the
# timezone specified
date
=
get
(
'
d
'
)
if
not
date
:
date
=
mytime
.
utc_now
()
date
=
mytime
.
set_tz
(
date
,
tz
=
image_tz
)
else
:
date
=
mytime
.
parse_stamp
(
date
)
date
=
mytime
.
set_tz
(
date
,
tz
=
image_tz
)
# images may not be exactly the same interval appart, therefore we have
# to attempt to locate the image
url
=
""
pths
=
[]
for
i
in
range
(
image_rez
):
fpth
=
image_path
(
camera
,
date
+
timedelta
(
seconds
=
i
))
pths
.
append
(
fpth
)
if
os
.
path
.
exists
(
fpth
):
url
=
url_for
(
fpth
)
break
# successfully found an image
if
url
:
redirect_to
(
url
)
if
form
.
has_key
(
'
debug
'
):
headers
()
for
pth
in
pths
:
print
pth
return
1
# we should only get here if the file was not found
file_not_found
()
return
1
sys
.
exit
(
main
())
Loading