Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MetObsCommon
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
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
MetObsCommon
Commits
99da0f34
Commit
99da0f34
authored
7 years ago
by
Alex Diebold
Browse files
Options
Downloads
Patches
Plain Diff
adding descriptions to yaml files
parent
d180f968
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
metobscommon/archive/config.yaml
+10
-0
10 additions, 0 deletions
metobscommon/archive/config.yaml
metobscommon/archive/db.py
+14
-6
14 additions, 6 deletions
metobscommon/archive/db.py
metobscommon/tests/archive/unit_tests.py
+1
-1
1 addition, 1 deletion
metobscommon/tests/archive/unit_tests.py
with
25 additions
and
7 deletions
metobscommon/archive/config.yaml
+
10
−
0
View file @
99da0f34
instruments
:
aoss
:
display_name
:
'
AOSS'
description
:
'
AOSS
description'
aeri
:
dispay_name
:
'
AERI'
description
:
'
AERI
description'
filetypes
:
-
aoss.aeri.par.l00.v00
-
aoss.aeri.qc.l00.v00
...
...
@@ -24,6 +26,7 @@ instruments:
-
aoss.aeri.scr-sumary.l00.v00
ceilo
:
display_name
:
'
Ceilo'
description
:
'
Ceilo
description'
filetypes
:
-
aoss.ceilo.ascii
-
aoss.ceilo.nc
...
...
@@ -31,14 +34,17 @@ instruments:
#- aoss.ceilo.tn.png
tower
:
display_name
:
'
Tower'
description
:
'
Tower
description'
filetypes
:
-
aoss.tower.ascii
-
aoss.tower.png
#- aoss.tower.tn.png
bago
:
display_name
:
'
BAGO'
description
:
'
BAGO
description'
aeri
:
display_name
:
'
AERI'
description
:
'
AERI
description'
filetypes
:
-
bago.aeri.png
-
bago.aeri.sum.cdf
...
...
@@ -46,15 +52,19 @@ instruments:
-
bago.aeri.c2-rnc.cdf
mendota
:
display_name
:
'
Mendota'
description
:
'
Mendota
desciption'
buoy
:
display_name
:
'
Buoy'
description
:
'
Buoy
description'
filetypes
:
-
mendota.buoy.ascii
-
mendota.buoy.png
test_site_1
:
display_name
:
'
test_site_1'
description
:
'
test_site_1
description'
test_inst_1
:
display_name
:
'
test_inst_1'
description
:
'
test_inst_1
description'
filetypes
:
-
test_site_1.test_inst_1.qc
-
test_site_1.test_inst_1.ascii
...
...
This diff is collapsed.
Click to expand it.
metobscommon/archive/db.py
+
14
−
6
View file @
99da0f34
#!/usr/bin/env python
# encoding: utf8
"""
File Database model and utilities
Example of properly deleting an Instrument:
TODO
"""
from
sqlalchemy.ext.declarative
import
declarative_base
from
sqlalchemy
import
Table
,
Column
,
Integer
,
String
,
DateTime
,
ForeignKey
from
sqlalchemy.orm
import
relationship
,
backref
...
...
@@ -576,8 +584,8 @@ def _create(args):
#site doesn't exist; new site is made
else
:
curr_site
=
Site
(
name
=
s
)
session
.
add
(
curr_site
)
session
.
commit
()
session
.
add
(
curr_site
)
session
.
commit
()
#cycle through instruments of yaml
for
i
in
docs
[
'
instruments
'
][
s
].
keys
():
#skip display name
...
...
@@ -585,14 +593,14 @@ def _create(args):
#check if instrument exists with specific site
inst_q
=
session
.
query
(
Instrument
).
filter
(
Instrument
.
name
==
i
)
inst_q
=
inst_q
.
filter
(
Instrument
.
site
.
has
(
name
=
curr_site
.
name
)).
all
()
#i
s
ntrument exists
#in
s
trument exists
if
len
(
inst_q
)
>
0
:
curr_inst
=
inst_q
[
0
]
#instrument doesn't exist; new instrument is made
else
:
curr_inst
=
Instrument
(
name
=
i
,
site
=
curr_site
)
session
.
add
(
curr_inst
)
session
.
commit
()
session
.
add
(
curr_inst
)
session
.
commit
()
#cycle through filetypes in yaml
for
f
in
docs
[
'
instruments
'
][
s
][
i
][
'
filetypes
'
]:
#skip display name
...
...
@@ -1314,7 +1322,7 @@ def _add(args):
#check glob_pattern of file against glob_pattern of filetypes for a match
if
glob
.
fnmatch
.
fnmatch
(
f
,
ft
.
glob_pattern
):
#endtime not given, defaults to start_time + period
if
not
args
.
endtime
:
if
not
hasattr
(
args
,
'
endtime
'
)
:
if
ft
.
period
==
'
Daily
'
:
end_time
=
args
.
start_time
+
timedelta
(
hours
=
24
)
elif
ft
.
period
==
'
Half-Daily
'
:
...
...
This diff is collapsed.
Click to expand it.
metobscommon/tests/archive/unit_tests.py
+
1
−
1
View file @
99da0f34
...
...
@@ -2,7 +2,7 @@ import db
from
sqlalchemy
import
create_engine
from
sqlalchemy.orm
import
sessionmaker
import
mock
from
unittest
import
mock
import
pytest
import
os
...
...
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