Skip to content
Snippets Groups Projects

code refactor

Merged Florian Obersteiner requested to merge (removed):master into master
2 files
+ 17
8
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 15
8
@@ -362,8 +362,8 @@ class Variable:
self.miss = miss
def __repr__(self):
# TODO: this sould be more meaningful
return "ICARTT Variable object repr"
# TODO: this sould be something else than __str__ ?
return self.desc()
def __str__(self):
return self.desc()
@@ -419,9 +419,10 @@ class Dataset:
:return: list of time steps
:rtype: list
"""
# TODO: this method currently does not work at all.
# suggest to also change to return a numpy array of numpy.datetime64
# for consistency with other data output
return [
# TODO see commit f5208db0 - this will do unexpected things if
# self.dateOfCollection is a naive datetime object (think DST transitions...)
self.dateOfCollection + datetime.timedelta(seconds=x)
for x in self.independentVariable
]
@@ -507,8 +508,11 @@ class Dataset:
# line 7 - UTC date when data begin, UTC date of data reduction or revision
# - comma delimited (yyyy, mm, dd, yyyy, mm, dd).
dmp = f.readline()
self.dateOfCollection = datetime.datetime(*map(int, dmp[:3])) # TODO: set UTC ?!
self.dateOfCollection = datetime.datetime(*map(int, dmp[:3]))
self.dateOfRevision = datetime.datetime(*map(int, dmp[3:6]))
# TODO: we should either use aware datetime (UTC), date objects or
# numpy.datetime64 here to avoid some 'rough edges' of Python's datetime library...
# line 8 - Data Interval (This value describes the time spacing (in seconds)
# between consecutive data records. It is the (constant) interval between
@@ -865,7 +869,8 @@ class Dataset:
# TODO: this could be more meaningful
return "ICARTT Dataset string representation"
def __init__(self, f=None, loadData=True, splitChar=",", format=Formats.FFI1001): # TODO: why is init comming last?
# TODO: why is init comming last?
def __init__(self, f=None, loadData=True, splitChar=",", format=Formats.FFI1001):
"""Constructor method"""
self.format = format
self.version = None
@@ -883,8 +888,10 @@ class Dataset:
self.dataSourceDescription = "Musterdatenprodukt"
self.missionName = "MUSTEREX"
# TODO: not 100% sure if this is relevant here, but those dates should refer to UTC
# - if you leave the datetime objects naive (no tzinfo set), they represent local time.
# TODO: see also comment on _readData method.
# we should either use aware datetime (UTC), date objects or
# numpy.datetime64 here to avoid some 'rough edges' of Python's
# datetime library...
self.dateOfCollection = datetime.datetime.today()
self.dateOfRevision = datetime.datetime.today()
self.dataIntervalCode = [0.0]
Loading