Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

Commit

Permalink
dataframes return with datetime index
Browse files Browse the repository at this point in the history
  • Loading branch information
rileyhales committed Feb 21, 2020
1 parent 497d1cc commit 314ff61
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion conda.recipes/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package:
name: geomatics
version: 0.3
version: 0.4

about:
author: Riley Hales
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
author = 'Riley Hales'

# The full version, including alpha/beta/rc tags
release = '0.3'
release = '0.4'
master_doc = 'index'

# -- General configuration ---------------------------------------------------
Expand Down
18 changes: 9 additions & 9 deletions geomatics/netcdfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ def point_series(path, variable, coordinates, filename_pattern=None, **kwargs):
timeseries.append((time, val))
nc_obj.close()

# sort the list by the 0 entry (the date), turn it into a pd dataframe, return it
timeseries.sort(key=lambda tup: tup[0])
return pd.DataFrame(timeseries, columns=['datetime', 'values'])
# unzip the timeseries
timeseries = list(zip(*timeseries))
return pd.DataFrame(timeseries[1], columns=['values'], index=timeseries[0])


def box_series(path, variable, coordinates, filename_pattern=None, **kwargs):
Expand Down Expand Up @@ -199,9 +199,9 @@ def box_series(path, variable, coordinates, filename_pattern=None, **kwargs):

nc_obj.close()

# sort the list by the 0 entry (the date), turn it into a pd dataframe, return it
timeseries.sort(key=lambda tup: tup[0])
return pd.DataFrame(timeseries, columns=['datetime', 'values'])
# unzip the timeseries
timeseries = list(zip(*timeseries))
return pd.DataFrame(timeseries[1], columns=['values'], index=timeseries[0])


def shp_series(path, variable, shp_path, filename_pattern=None, **kwargs):
Expand Down Expand Up @@ -302,9 +302,9 @@ def shp_series(path, variable, shp_path, filename_pattern=None, **kwargs):

nc_obj.close()

# sort the list by the 0 entry (the date), turn it into a pd dataframe, return it
timeseries.sort(key=lambda tup: tup[0])
return pd.DataFrame(timeseries, columns=['datetime', 'values'])
# unzip the timeseries
timeseries = list(zip(*timeseries))
return pd.DataFrame(timeseries[1], columns=['values'], index=timeseries[0])


def convert_to_geotiff(files, variable, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
setup(
name='geomatics',
packages=['geomatics'],
version='0.3',
version='0.4',
description='GIS tools developed by Riley Hales for the BYU Hydroinformatics Lab',
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 314ff61

Please sign in to comment.