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
70b5c76f
Verified
Commit
70b5c76f
authored
4 years ago
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
Remove legacy netcdf generation
parent
9406c4a9
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
+25
-25
25 additions, 25 deletions
aossceilo/tidy.py
with
25 additions
and
25 deletions
aossceilo/tidy.py
+
25
−
25
View file @
70b5c76f
...
...
@@ -24,7 +24,7 @@ Copyright (c) 2009 University of Wisconsin SSEC. All rights reserved.
import
os
,
sys
,
logging
from
datetime
import
datetime
,
timedelta
# from aossceilo import quicklook
from
aossceilo
import
nc
#
from aossceilo import nc
from
aossceilo
import
CONFIG
as
c
from
metobscommon.util
import
raw_manager
rel
=
raw_manager
.
relativedir
...
...
@@ -66,26 +66,26 @@ CEILO_DIR_FORMAT = c.CEILO_DIR_FORMAT
# 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
file.
"""
when
=
when
or
datetime
.
now
()
# Run for past 3 days
begin
=
when
-
timedelta
(
days
=
2
)
# Create temp nc files in cache location
temp_created_files
=
nc
.
make_ceilo_files
(
begin
=
begin
,
end
=
when
,
basedir
=
None
,
site
=
site
,
description
=
description
)
# Check that some files were created
if
not
temp_created_files
:
LOG
.
warning
(
"
No new nc files were created
"
)
return
# Rename temp files to original files
created_files
=
[
os
.
path
.
join
(
d
,
f
[
1
:])
for
d
,
f
in
[
os
.
path
.
split
(
x
)
for
x
in
temp_created_files
]
]
for
t
,
f
in
zip
(
temp_created_files
,
created_files
):
if
os
.
path
.
exists
(
f
):
os
.
remove
(
f
)
os
.
rename
(
t
,
f
)
# Link latest files
link_latest_file
(
c
.
get_latest_dir
(),
created_files
[
0
],
data_type
=
"
nc
"
)
#
def create_nc(when=None):
#
"""run external nc_gen module with proper arguments to create a new netCDF
#
file.
#
"""
#
when = when or datetime.now()
#
# Run for past 3 days
#
begin = when - timedelta(days=2)
#
# Create temp nc files in cache location
#
temp_created_files = nc.make_ceilo_files(begin=begin, end=when, basedir=None, site=site, description=description)
#
# Check that some files were created
#
if not temp_created_files:
#
LOG.warning("No new nc files were created")
#
return
#
# Rename temp files to original files
#
created_files = [ os.path.join(d,f[1:]) for d,f in [ os.path.split(x) for x in temp_created_files ] ]
#
for t,f in zip(temp_created_files, created_files):
#
if os.path.exists(f): os.remove(f)
#
os.rename(t,f)
#
# Link latest files
#
link_latest_file(c.get_latest_dir(), created_files[0], data_type="nc")
def
file_dirs
(
when
=
None
,
data_type
=
'
ascii
'
):
"""
yield camera-name, incoming-dir, raw_dir, cache_dir, latest_dir for a given datetime object (default now)
...
...
@@ -231,10 +231,10 @@ run "%prog help" to list commands
# """
# create_quicklook(when=date)
#
def
nc
(
*
args
):
"""
Create multiple nc files for (date - 2 days) to date.
"""
create_nc
(
date
)
#
def nc(*args):
#
"""Create multiple nc files for (date - 2 days) to date.
#
"""
#
create_nc(date)
def
help
(
command
=
None
):
"""
print command help or list of commands
...
...
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