Skip to content

Commit 150f2b1

Browse files
committed
fixed datetime conversions
1 parent f56f11e commit 150f2b1

3 files changed

Lines changed: 3 additions & 7 deletions

File tree

sliderule/gedi.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ def __todataframe(columns, time_key="time", lon_key="longitude", lat_key="latitu
7575
return sliderule.emptyframe(**kwargs)
7676

7777
# Generate Time Column
78-
timestamp = (columns[time_key]*1e9).astype('timedelta64[ns]')
79-
gps_epoch = numpy.datetime64(sliderule.gps_epoch)
80-
columns['time'] = geopandas.pd.to_datetime(gps_epoch + timestamp)
78+
columns['time'] = columns[time_key].astype('datetime64[ns]')
8179

8280
# Generate Geometry Column
8381
geometry = geopandas.points_from_xy(columns[lon_key], columns[lat_key])

sliderule/icesat2.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,7 @@ def __todataframe(columns, time_key="time", lon_key="lon", lat_key="lat", **kwar
153153
return sliderule.emptyframe(**kwargs)
154154

155155
# Generate Time Column
156-
timestamp = (columns[time_key]*1e9).astype('timedelta64[ns]')
157-
gps_epoch = numpy.datetime64(sliderule.gps_epoch)
158-
columns['time'] = geopandas.pd.to_datetime(gps_epoch + timestamp)
156+
columns['time'] = columns[time_key].astype('datetime64[ns]')
159157

160158
# Generate Geometry Column
161159
geometry = geopandas.points_from_xy(columns[lon_key], columns[lat_key])

sliderule/sliderule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
"BITFIELD": { "fmt": 'x', "size": 0, "nptype": numpy.byte }, # unsupported
120120
"FLOAT": { "fmt": 'f', "size": 4, "nptype": numpy.single },
121121
"DOUBLE": { "fmt": 'd', "size": 8, "nptype": numpy.double },
122-
"TIME8": { "fmt": 'Q', "size": 8, "nptype": numpy.datetime64 },
122+
"TIME8": { "fmt": 'q', "size": 8, "nptype": numpy.int64 }, # numpy.datetime64
123123
"STRING": { "fmt": 's', "size": 1, "nptype": numpy.byte }
124124
}
125125

0 commit comments

Comments
 (0)