Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AossCeilo
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Analyze
Contributor 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
AossCeilo
Commits
9406c4a9
Verified
Commit
9406c4a9
authored
4 years ago
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
Remove legacy quicklook generation
parent
56a60344
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
aossceilo/tidy.py
+30
-29
30 additions, 29 deletions
aossceilo/tidy.py
with
30 additions
and
29 deletions
aossceilo/tidy.py
+
30
−
29
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.
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment