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
2f347c7a
Verified
Commit
2f347c7a
authored
11 months ago
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup round 3
parent
f4b50fae
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
aossceilo/CONFIG.py
+19
-18
19 additions, 18 deletions
aossceilo/CONFIG.py
aossceilo/__init__.py
+7
-11
7 additions, 11 deletions
aossceilo/__init__.py
pyproject.toml
+2
-0
2 additions, 0 deletions
pyproject.toml
with
28 additions
and
29 deletions
aossceilo/CONFIG.py
+
19
−
18
View file @
2f347c7a
"""
This module holds all directory/path/URL information for metobs.ceilo
packages. This file should be the only place that holds this static information.
"""
All directory/path/URL information for metobs.ceilo packages.
This file should be the only place that holds this static information.
This file should not do any file manipulation at all, only return strings or pass
other static information such as what plot number goes with what data.
...
...
@@ -13,7 +14,6 @@ import re
from
datetime
import
datetime
,
timedelta
from
metobscommon.util
import
CONFIG
as
c
from
metobscommon.util
import
RODict
CEILO_INCOMING_DIR
=
os
.
environ
.
get
(
"
CEILO_INCOMING_DIR
"
,
"
/beach/incoming/Instrument_Data/METOBS/RIG/Ceilo/raw
"
...
...
@@ -32,18 +32,18 @@ RE_DIGITS = re.compile(r"\d+")
def
get_incoming_dir
():
"""
Return incoming directory for specified date
"""
"""
Return incoming directory for specified date
.
"""
return
os
.
path
.
join
(
CEILO_INCOMING_DIR
)
def
get_praw_dir
(
when
=
None
):
"""
Return raw directory for specified date and data_type
"""
"""
Return raw directory for specified date and data_type
.
"""
when
=
when
or
datetime
.
now
()
return
os
.
path
.
join
(
CEILO_PRAW_DIR
,
when
.
strftime
(
CEILO_DIR_FORMAT
))
def
get_sraw_dir
(
when
=
None
):
"""
Return raw directory for specified date and data_type
"""
"""
Return raw directory for specified date and data_type
.
"""
raise
NotImplementedError
(
"
This function is not used anymore, there should only be one primary storage location
"
)
...
...
@@ -52,24 +52,24 @@ def get_sraw_dir(when=None):
def
get_cache_dir
(
data_type
,
when
=
None
):
"""
Return cache directory for specified date and data_type
"""
"""
Return cache directory for specified date and data_type
.
"""
when
=
when
or
datetime
.
now
()
return
os
.
path
.
join
(
CEILO_CACHE_DIR
,
data_type
,
when
.
strftime
(
CEILO_DIR_FORMAT
))
def
get_latest_dir
():
"""
Return latest directory
"""
"""
Return latest directory
.
"""
return
os
.
path
.
join
(
CEILO_LATEST_DIR
)
def
get_ascii_filename
(
when
=
None
,
site
=
"
rig
"
,
description
=
""
):
"""
Return the standard filename of the ascii file for the specified date
"""
"""
Return the standard filename of the ascii file for the specified date
.
"""
when
=
when
or
datetime
.
now
()
return
c
.
get_filename
(
site
,
inst
,
when
,
ext
=
"
ascii
"
,
description
=
description
)
def
get_ascii_url
(
when
=
None
,
site
=
"
rig
"
,
description
=
""
):
"""
Return the standard url of the ascii file for the specified date
"""
"""
Return the standard url of the ascii file for the specified date
.
"""
when
=
when
or
datetime
.
now
()
return
os
.
path
.
join
(
CEILO_ASCII_LOC
,
...
...
@@ -80,13 +80,13 @@ def get_ascii_url(when=None, site="rig", description=""):
def
get_nc_filename
(
when
=
None
,
site
=
"
rig
"
,
description
=
""
):
"""
Return the standard filename of the netCDF file for the specified date
"""
"""
Return the standard filename of the netCDF file for the specified date
.
"""
when
=
when
or
datetime
.
now
()
return
c
.
get_filename
(
site
,
inst
,
when
,
ext
=
"
nc
"
,
description
=
description
)
def
get_nc_url
(
when
=
None
,
site
=
"
rig
"
,
description
=
""
):
"""
Return the standard url of the netCDF file for the specified date
"""
"""
Return the standard url of the netCDF file for the specified date
.
"""
when
=
when
or
datetime
.
now
()
return
os
.
path
.
join
(
CEILO_NC_LOC
,
...
...
@@ -97,7 +97,7 @@ def get_nc_url(when=None, site="rig", description=""):
def
get_img_filename
(
begin
,
end
,
ptype
=
1
,
tag
=
""
,
site
=
"
rig
"
,
description
=
""
):
"""
Return the standard filename of the image that goes from begin to end
"""
"""
Return the standard filename of the image that goes from begin to end
.
"""
pname
=
_handle_plot_type
(
ptype
)
return
c
.
get_filename
(
site
,
...
...
@@ -112,19 +112,21 @@ def get_img_filename(begin, end, ptype=1, tag="", site="rig", description=""):
def
get_quicklook_filename
(
begin
,
end
,
ptype
=
1
,
site
=
"
rig
"
,
description
=
""
):
"""
Generate filename for a quicklook.
"""
return
get_img_filename
(
begin
,
end
,
ptype
,
tag
=
""
,
site
=
site
,
description
=
description
)
def
get_thumbnail_filename
(
begin
,
end
,
ptype
=
1
,
site
=
"
rig
"
,
description
=
""
):
"""
Generate filename for a quicklook thumbnail.
"""
return
get_img_filename
(
begin
,
end
,
ptype
,
tag
=
"
tn
"
,
site
=
site
,
description
=
description
)
def
get_img_url
(
begin
,
end
,
ptype
=
1
,
tag
=
""
,
site
=
"
rig
"
,
description
=
""
):
"""
Return the standard url of the image that goes from begin to end
"""
"""
Return the standard url of the image that goes from begin to end
.
"""
return
os
.
path
.
join
(
CEILO_IMG_LOC
,
"
img
"
,
...
...
@@ -136,14 +138,17 @@ def get_img_url(begin, end, ptype=1, tag="", site="rig", description=""):
def
get_quicklook_url
(
begin
,
end
,
ptype
=
1
,
site
=
"
rig
"
,
description
=
""
):
"""
Generate URL for a quicklook.
"""
return
get_img_url
(
begin
,
end
,
ptype
,
tag
=
""
,
site
=
site
,
description
=
description
)
def
get_thumbnail_url
(
begin
,
end
,
ptype
=
1
,
site
=
"
rig
"
,
description
=
""
):
"""
Generate URL for a quicklook thumbnail.
"""
return
get_img_url
(
begin
,
end
,
ptype
,
tag
=
"
tn
"
,
site
=
site
,
description
=
description
)
def
rename_incoming
(
incoming_file
,
site
=
"
rig
"
,
description
=
""
):
"""
Generate filenames for various parts of the archive for the provided incoming file.
"""
file_date
=
datetime
(
*
tuple
([
int
(
x
)
for
x
in
RE_DIGITS
.
findall
(
incoming_file
)]))
present_date
=
datetime
.
now
()
praw
=
get_praw_dir
(
when
=
file_date
)
...
...
@@ -153,10 +158,6 @@ def rename_incoming(incoming_file, site="rig", description=""):
return
praw
,
cache
,
rn
,
remove
def
get_type_name
():
return
RODict
({
1
:
"
Backscatter
"
,
2
:
"
Cloud Base Height
"
,
3
:
"
Vertical Visibility
"
})
def
_handle_plot_type
(
plottype
=
1
):
if
plottype
==
1
:
return
""
...
...
This diff is collapsed.
Click to expand it.
aossceilo/__init__.py
+
7
−
11
View file @
2f347c7a
"""
Processing and archive management code for the AOSS Ceilometer instrument.
"""
from
aossceilo
import
CONFIG
as
c
from
aossceilo.version
import
__version__
# noqa
...
...
@@ -5,8 +6,7 @@ instrument_name = "ceilo"
def
get_ascii_name
(
dt
,
site
=
"
rig
"
):
"""
Make a standard filename for a tower ascii file.
"""
Make a standard filename for a tower ascii file.
@type dt: datetime
@param dt: datetime of the url to generate.
...
...
@@ -17,8 +17,7 @@ def get_ascii_name(dt, site="rig"):
def
get_nc_name
(
dt
,
site
=
"
rig
"
):
"""
Make a standard filename for a ceilometer netcdf file.
"""
Make a standard filename for a ceilometer netcdf file.
@type dt: datetime
@param dt: datetime of the url to generate.
...
...
@@ -34,8 +33,7 @@ def get_thumbnail_name(begin, end=None, site="rig", plottype=1):
def
get_nc_url
(
dt
,
site
=
"
rig
"
,
host
=
None
):
"""
Get a URL to a ceilometer NetCDF file.
"""
Get a URL to a ceilometer NetCDF file.
@type dt: datetime
@param dt: datetime of the url to generate.
...
...
@@ -49,7 +47,7 @@ def get_nc_url(dt, site="rig", host=None):
def
get_ascii_url
(
dt
,
site
=
"
rig
"
,
host
=
None
):
"""
Get a URL to a ceilometer ASCII file on the opendap server
"""
Get a URL to a ceilometer ASCII file on the opendap server
.
@type dt: datetime
@param dt: datetime of the url to generate.
...
...
@@ -63,16 +61,14 @@ def get_ascii_url(dt, site="rig", host=None):
def
get_thumbnail_url
(
begin
,
end
=
None
,
site
=
"
rig
"
,
host
=
None
,
plottype
=
1
):
"""
Get URL for a quicklook thumbnail file.
"""
return
c
.
get_image_url
(
begin
,
end
,
ptype
=
plottype
,
tag
=
"
tn
"
)
def
get_image_url
(
begin
,
end
=
None
,
site
=
"
rig
"
,
host
=
None
,
plottype
=
1
):
"""
Get URL for a quicklook file.
"""
return
c
.
get_image_url
(
begin
,
end
,
ptype
=
plottype
,
tag
=
""
)
def
get_type_name
():
return
c
.
get_type_name
()
def
_handle_plottype
(
plottype
=
1
):
return
c
.
_handle_plot_type
(
plottype
)
This diff is collapsed.
Click to expand it.
pyproject.toml
+
2
−
0
View file @
2f347c7a
...
...
@@ -57,6 +57,8 @@ select = ["A", "D", "E", "W", "F", "I", "PT", "TID", "C90", "Q", "T10", "T20", "
[tool.ruff.lint.per-file-ignores]
"aossceilo/tests/*"
=
[
"S101"
,
"D100"
,
"D103"
]
# assert allowed in tests
"aossceilo/level_b1/nc.py"
=
[
"D"
]
# old module, no time for adding docstrings
"aossceilo/level_b1/message.py"
=
[
"D"
]
# old module, no time for adding docstrings
[tool.ruff.lint.pydocstyle]
convention
=
"numpy"
...
...
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