Skip to content

Commit

Permalink
More compact date output for "tabular" mode
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Mar 14, 2018
1 parent e2b530d commit 43fbe18
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ phenodata changelog
development
===========
- Add "--show-ids" parameter to show IDs alongside resolved text representation when using "--humanize"
- More compact date output for "tabular" mode

2018-03-14 0.5.0
================
Expand Down
9 changes: 7 additions & 2 deletions phenodata/dwd/pheno.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ def get_observations(self, options, humanize=False):
if humanize:
megaframe = self.create_megaframe(observations)
observations = self.humanizer.get_observations(megaframe)
else:
observations['Eintrittsdatum'] = observations['Eintrittsdatum'].astype(str)

return observations

Expand Down Expand Up @@ -206,6 +208,9 @@ def get_forecast(self, options, humanize=False):
megaframe = self.create_megaframe(forecast)
forecast = self.humanizer.get_forecast(megaframe)

else:
forecast['Datum'] = forecast['Datum'].astype(str)

return forecast

def query(self, partition=None, files=None):
Expand Down Expand Up @@ -387,7 +392,7 @@ def get_observations(self, frame):

# Build fresh DataFrame with designated order of columns
canvas['Jahr'] = frame['Referenzjahr']
canvas['Datum'] = frame['Eintrittsdatum']
canvas['Datum'] = frame['Eintrittsdatum'].astype(str)
canvas['Spezies'] = species
canvas['Phase'] = phases
canvas['Station'] = stations
Expand All @@ -403,7 +408,7 @@ def get_forecast(self, frame):
stations, species, phases, quality_levels, quality_bytes = self.get_fields(frame)

# Build fresh DataFrame with designated order of columns
canvas['Datum'] = frame['Datum'].values
canvas['Datum'] = frame['Datum'].astype(str)
canvas['Spezies'] = species
canvas['Phase'] = phases
canvas['Station'] = stations
Expand Down

0 comments on commit 43fbe18

Please sign in to comment.