Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Clément Haëck
submeso-color
Commits
a1a8f2ef
Commit
a1a8f2ef
authored
Mar 31, 2022
by
Clément Haëck
Browse files
Use absolute path in metadata and add hostname
parent
34fa6de6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
lib/__init__.py
lib/__init__.py
+6
-3
No files found.
lib/__init__.py
View file @
a1a8f2ef
...
...
@@ -5,8 +5,9 @@ import configparser
import
itertools
import
os
import
re
import
s
ys
import
s
ocket
import
subprocess
import
sys
from
datetime
import
datetime
from
os
import
path
from
typing
import
Any
,
Dict
,
List
...
...
@@ -167,13 +168,15 @@ def setup_meta_attrs(ds: xr.Dataset,
"""Set some dataset attributes with information on how it was created.
Attributes are:
- "created_with": filename of the python script used
(ie `argv[0]`).
- "created_with":
hostname and
filename of the python script used
- "created_with_args": a string representing the `args` dictionnary,
- "created_on": date of creation
- "created_on_commit": if found, the current/HEAD commit hash.
completed by `kwargs`.
"""
ds
.
attrs
[
"created_with"
]
=
sys
.
argv
[
0
]
hostname
=
socket
.
gethostname
()
script
=
path
.
normpath
(
path
.
abspath
(
sys
.
argv
[
0
]))
ds
.
attrs
[
"created_with"
]
=
"{}:{}"
.
format
(
hostname
,
script
)
if
args
is
None
:
args
=
{}
...
...
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