Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
MetObs
AossCeilo
Commits
9406c4a9
Verified
Commit
9406c4a9
authored
Mar 02, 2021
by
David Hoese
Browse files
Remove legacy quicklook generation
parent
56a60344
Changes
1
Hide whitespace changes
Inline
Side-by-side
aossceilo/tidy.py
View file @
9406c4a9
...
...
@@ -23,7 +23,8 @@ Copyright (c) 2009 University of Wisconsin SSEC. All rights reserved.
import
os
,
sys
,
logging
from
datetime
import
datetime
,
timedelta
from
aossceilo
import
quicklook
,
nc
# from aossceilo import quicklook
from
aossceilo
import
nc
from
aossceilo
import
CONFIG
as
c
from
metobscommon.util
import
raw_manager
rel
=
raw_manager
.
relativedir
...
...
@@ -41,29 +42,29 @@ CEILO_CACHE_DIR = c.CEILO_CACHE_DIR
CEILO_LATEST_DIR
=
c
.
CEILO_LATEST_DIR
CEILO_DIR_FORMAT
=
c
.
CEILO_DIR_FORMAT
def
create_quicklook
(
when
=
None
):
"""run quicklook.py with the proper arguments to create various quicklooks."""
when
=
when
or
datetime
.
now
()
created_files
=
quicklook
.
make_plot
(
dt
=
when
,
site
=
site
,
description
=
description
)
if
len
(
created_files
)
!=
4
:
LOG
.
error
(
"Expected four quicklooks to be created, latest files were not linked, %d filenames were returned"
%
len
(
created_files
))
raise
ValueError
(
"Latest quicklooks could not be linked because there were not the correct amount of images"
)
ptypes
=
[
c
.
_handle_plot_type
(
t
)
for
t
in
range
(
1
,
2
)
]
for
file
,
ptype
,
tag
in
zip
(
created_files
[
1
::
2
],
ptypes
+
ptypes
,
[
""
,
"tn"
]):
link_latest_quicklooks
(
c
.
get_latest_dir
(),
file
,
ptype
,
tag
=
tag
)
def
link_latest_quicklooks
(
latest_dir
,
filename
,
ptype
,
tag
=
""
):
_
,
ext
=
os
.
path
.
splitext
(
filename
)
tag
=
tag
and
"_"
+
tag
or
""
ptype
=
ptype
and
"_"
+
ptype
or
""
linkname
=
"latest_quicklook%s%s%s"
%
(
ptype
,
tag
,
ext
)
tmpname
=
"."
+
linkname
tmppath
=
os
.
path
.
join
(
latest_dir
,
tmpname
)
linkpath
=
os
.
path
.
join
(
latest_dir
,
linkname
)
if
os
.
path
.
islink
(
tmppath
):
os
.
unlink
(
tmppath
)
LOG
.
debug
(
'symlink %s -> %s'
%
(
linkpath
,
filename
))
os
.
symlink
(
rel
(
latest_dir
,
filename
),
tmppath
)
os
.
rename
(
tmppath
,
linkpath
)
#
def create_quicklook(when=None):
#
"""run quicklook.py with the proper arguments to create various quicklooks."""
#
when = when or datetime.now()
#
created_files = quicklook.make_plot(dt=when, site=site, description=description)
#
if len(created_files) != 4:
#
LOG.error("Expected four quicklooks to be created, latest files were not linked, %d filenames were returned" % len(created_files))
#
raise ValueError("Latest quicklooks could not be linked because there were not the correct amount of images")
#
ptypes = [ c._handle_plot_type(t) for t in range(1, 2) ]
#
for file,ptype,tag in zip(created_files[1::2], ptypes+ptypes, ["","tn"]):
#
link_latest_quicklooks(c.get_latest_dir(), file, ptype, tag=tag)
#
#
def link_latest_quicklooks(latest_dir, filename, ptype, tag=""):
#
_,ext = os.path.splitext(filename)
#
tag = tag and "_" + tag or ""
#
ptype = ptype and "_" + ptype or ""
#
linkname = "latest_quicklook%s%s%s" % (ptype,tag,ext)
#
tmpname = "." + linkname
#
tmppath = os.path.join( latest_dir, tmpname )
#
linkpath = os.path.join( latest_dir, linkname )
#
if os.path.islink(tmppath): os.unlink(tmppath)
#
LOG.debug('symlink %s -> %s' % (linkpath, filename))
#
os.symlink( rel(latest_dir, filename), tmppath )
#
os.rename( tmppath, linkpath )
def
create_nc
(
when
=
None
):
"""run external nc_gen module with proper arguments to create a new netCDF
...
...
@@ -225,11 +226,11 @@ run "%prog help" to list commands
"""
unload_incoming_all
(
when
=
date
)
def
quicklook
(
*
args
):
"""Create set of quicklooks for date specified or today.
"""
create_quicklook
(
when
=
date
)
#
def quicklook(*args):
#
"""Create set of quicklooks for date specified or today.
#
"""
#
create_quicklook(when=date)
#
def
nc
(
*
args
):
"""Create multiple nc files for (date - 2 days) to date.
"""
...
...
Write
Preview
Markdown
is supported
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