Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
ICARTT Python Package
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
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
MBEES
ICARTT Python Package
Commits
405c44f7
Commit
405c44f7
authored
3 years ago
by
Florian Obersteiner
Browse files
Options
Downloads
Patches
Plain Diff
__str__ for Dataset
parent
4f5c45d6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!22
towards release
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/icartt/dataset.py
+14
-10
14 additions, 10 deletions
src/icartt/dataset.py
with
14 additions
and
10 deletions
src/icartt/dataset.py
+
14
−
10
View file @
405c44f7
...
...
@@ -317,7 +317,6 @@ class StandardNormalComments(collections.UserList):
self
.
keywords
[
"
UNCERTAINTY
"
].
naAllowed
=
False
self
.
keywords
[
"
REVISION
"
].
naAllowed
=
False
def
__str__
(
self
):
return
"
\n
"
.
join
(
f
"
{
str
(
v
)
}
"
for
v
in
self
.
keywords
.
values
())
...
...
@@ -962,12 +961,18 @@ class Dataset:
if
not
self
.
inputFhandle
.
closed
:
self
.
inputFhandle
.
close
()
def
__repr__
(
self
):
# TODO: this could be more meaningful
return
"
icartt.Dataset()
"
def
__str__
(
self
):
return
f
"
ICARTT Dataset
{
self
.
makeFileName
()
}
"
s
=
[
f
"
ICARTT Dataset
{
self
.
makeFileName
()
}
, format index
{
self
.
format
.
value
}
"
,
f
"
data ID:
{
self
.
dataID
}
"
,
f
"
location ID:
{
self
.
locationID
}
"
,
f
"
PI:
{
self
.
PIName
}
"
,
f
"
Affiliation:
{
self
.
PIAffiliation
}
"
,
f
"
Mission:
{
self
.
missionName
}
"
,
f
"
Collection date, Revision date:
{
self
.
dateOfCollection
}
,
{
self
.
dateOfRevision
}
"
,
f
"
Variables (
{
len
(
self
.
variables
)
}
):
\n
{
'
,
'
.
join
(
x
for
x
in
self
.
variables
)
}
"
,
]
return
"
\n
"
.
join
(
s
)
def
__init__
(
self
,
...
...
@@ -991,7 +996,7 @@ class Dataset:
"""
self
.
format
=
format
self
.
version
=
None
# TODO: should this be 2.0 by default?
self
.
version
=
None
# TODO: should this be 2.0 by default?
self
.
dataID
=
"
dataID
"
self
.
locationID
=
"
locationID
"
...
...
@@ -1038,12 +1043,11 @@ class Dataset:
if
not
self
.
isValidFileName
(
pathlib
.
Path
(
f
).
name
):
warnings
.
warn
(
f
"
{
pathlib
.
Path
(
f
).
name
}
is not a valid ICARTT filename
"
)
else
:
# try to obtain dataID and locationID from file name
else
:
# try to obtain dataID and locationID from file name
parts
=
pathlib
.
Path
(
f
).
name
.
split
(
"
_
"
)
if
len
(
parts
)
>
2
:
self
.
dataID
=
parts
[
0
]
self
.
dataID
=
parts
[
1
]
# TODO: else -> split on "_", then the first part should be dataID, second part locationID
self
.
locationID
=
parts
[
1
]
self
.
readHeader
(
delimiter
)
if
loadData
:
...
...
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